-->
Page 1 of 1

ESP8266 Not working with Emoncms.org...

PostPosted: Mon Feb 23, 2015 3:57 pm
by SybrenV
Hello!

I just started to thinker with the esp8266 module, and it is really great! However(there always needs to be a however ofcourse) i would like to update values on my emoncms.org account.

So I tried this, following kevin darrah tips form his youtube movie: https://www.youtube.com/watch?v=qU76yWHeQuw
I can update values to thingspeak, however if I try to do this with the emoncms url, it does not do anything :(

How i tried uploading these values:
AT+CIPMODE=0
AT+CIPMUX=1
AT+CWJAP="X","X"
AT+CIPSTART=0,"TCP","emoncms.org",80
AT+CIPSEND=0,100
GET emoncms.org/input/post.json?json={esp:200}&apikey=API HTTP/1.1

It gives me "SEND OK", that is all... With Thingspeak I receive a log like this:

+IPD,0,551:HTTP/1.1 200 OK
Server: nginx/1.7.5
Date: Mon, 23 Feb 2015 20:16:57 GMT
Content-Type: text/html; charset=utf-8
Connection: close
Vary: Accept-Encoding
Status: 200 OK
X-Frame-Options: ALLOWALL
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH
Access-Control-Allow-Headers: origin, content-type, X-Requested-With
Access-Control-Max-Age: 1800
ETag: "8f14e45fceea167a5a36dedd4bea2543"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 474a0542-7e33-4d98-9a61-1ae1f7478b70


Any help would be greatly appriciated!

Re: ESP8266 Not working with Emoncms.org...

PostPosted: Wed Mar 04, 2015 4:43 am
by Alvydas001
Hello,

with AT commands I try to send data to the server emoncms.org.
The data on the server side are not accepted. The database is left without a record.
Maybe someone can tell what's wrong here?
( To thingspeak.com server data are received correctly)

AT+CIPSTART="TCP","emoncms.org",80
CONNECT

OK
AT+CIPSEND=82
> GET /input/post.json?json={power:220}&apikey=5f95184d8fafxx***xx1e0fd9aad868 HTTP/1.0\r\nbusy s...

SEND OK

+IPD,315:<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /input/post.json was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at h80-243-190-58.host.redstation.co.uk Port 80</address>
</body></html>

OK
CLOSED

-------- ESP8266 Firmware --------------------

AT+GMR
00200.9.5(b1)
compiled @ Dec 25 2014 21:40:28
AI-THINKER Dec 25 2014

Re: ESP8266 Not working with Emoncms.org...

PostPosted: Sat Mar 07, 2015 7:37 am
by Alvydas001
AT+CIPSTART="TCP","80.243.190.58",80
CONNECT

OK
AT+CIPSEND=90
> GET /emoncms/input/post.json?json={power:210}&apikey=5f95184d8faf*-*-*-*-*-*-0fd9aad868 HTTP/1.0\r\nbusy s...

SEND OK

+IPD,2:ok
OK
CLOSED
correct version:

#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#define SSID "xxx"
#define PASS "xxx"
#define MODULE_ID "ESP-01"
#define ONE_WIRE_BUS A2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

//*-- Hardware Serial
#define _baudrate 115200

//*-- Software Serial
//
#define _rxpin 2
#define _txpin 4
SoftwareSerial debug( _rxpin, _txpin ); // RX, TX

#define IP "80.243.190.58" // emonsms
//#define IP "api.thingspeak.com"
String GET = "GET /emoncms/input/post.json?apikey=5f95-x-x-x-x-x-x-x-x-ad868&json={boiler:";


void setup()
{
Serial.begin(_baudrate);
debug.begin( _baudrate );
sensors.begin();
Serial.println("AT");
delay(5000);
if(Serial.find("OK")){
connectWiFi();
debug.println("prisijungta");
}
}

void loop(){
sensors.requestTemperatures();
float tempC = sensors.getTempCByIndex(0);
// tempC = DallasTemperature::toFahrenheit(tempC);
debug.println(tempC);
char buffer[10];
String tempF = dtostrf(tempC, 4, 1, buffer);
updateTemp(tempF);
delay(10000);
}

void updateTemp(String tenmpF){
String cmd = "AT+CIPSTART=\"TCP\",\"";
cmd += IP;
cmd += "\",80";
debug.println(cmd);
Serial.println(cmd);
delay(2000);
if(Serial.find("Error")){
return;
}
cmd = GET;
cmd += tenmpF;
cmd += "}\r\n";
Serial.print("AT+CIPSEND=");
Serial.println(cmd.length());
debug.println("AT+CIPSEND=");
debug.println(cmd.length());
if(Serial.find(">")){
Serial.print(cmd);
debug.println(cmd);
}else{
Serial.println("AT+CIPCLOSE");
}
}


boolean connectWiFi(){
Serial.println("AT+CWMODE=1");
delay(2000);
String cmd="AT+CWJAP=\"";
cmd+=SSID;
cmd+="\",\"";
cmd+=PASS;
cmd+="\"";
Serial.println(cmd);
delay(5000);
if(Serial.find("OK")){
debug.println("OK");
return true;
}else{
return false;
}
}