Arduino Variables to domoticz via http GET json, help:-)

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.

Moderator: leecollings

Post Reply
ngc981
Posts: 7
Joined: Monday 25 January 2016 21:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Arduino Variables to domoticz via http GET json, help:-)

Post by ngc981 »

Hallo

I am new with domoticz i like move from emoncms graphs to my domoticz server PI, please can someone help how to, Where to find , what to do to

To get these graphs in domoticz

I like to have one graph with the HR,Cloud,Light one graph with T,IR-TEMP,Dew and a traffic light based on cloudy, dewing, frizzing where 0 is red and 1 is green ore something like that

Below the arduino code i send to emoncms ;-) This arduino is connected to mijn network based on the s5100 shield

if (client.connect(server, 80)) {
Serial.print("sendData Connecting...to emoncms ");
Serial.println(loopcount);
// send the HTTP PUT request:
client.print("GET http://myserver/input/post.json?node=1& ... 8008&json={");
client.print("\"T\":\"");
client.print(T);
client.print("\",\"Clouds\":\"");
client.print(Clouds);
client.print(",IR:");
client.print(IR);
client.print(",HR:");
client.print(HR);
client.print(",dew:");
client.print(Dew);
client.print(",light:");
client.print(light);
client.print(",Clouds:");
client.print(Clouds);
client.print(",skyT:");
client.print(skyT);
client.print(",cloudy:");
client.print(cloudy);
client.print(",dewing:");
client.print(dewing);
client.print(",frezzing:");
client.print(frezzing);

client.println("\"}");
lastConnectionTime = millis();
client.stop();
}

I hope some can help me to get this running

The Idea is based on this automated things

Thanks on forhand

Chris
Last edited by ngc981 on Saturday 30 January 2016 11:51, edited 1 time in total.
ngc981
Posts: 7
Joined: Monday 25 January 2016 21:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Arduino Variables to domoticz via http GET json, help

Post by ngc981 »

Still having trouble to add my temperature values via Arduino to Domoticz
Adding via url in the browser work my dummy device gets update
translating it to code on the arduino it doesn't work

Please can some help me, what is going wrong
server is defined

char server[] = "192.168.178.42";

It connects because iam in the loop

void sendData(float T) {
// if there's a successful connection:
loopcount++;
if (client.connect(server,8080)) {
Serial.println(server);
// url to use http://192.168.178.42:8080/json.htm?typ ... &svalue=15"
String datastring="/json.htm?type=command&param=udevice&idx=1&nvalue=0&svalue=";
String datainput = datastring+T;
Serial.println(datainput);
client.println("GET "+datainput+" HTTP/1.1");
client.println("Host: 192.168.178.42");
client.println( "Connection: close");
//lastConnectionTime = millis();
delay(1000);
client.stop();
}
else {
// if you couldn't make a connection:
Serial.println("sendData Connection failed");
Serial.println("sendData Disconnecting...");
client.stop();
}
delay(1000);
Serial.println("sendData Connection...done");
}


De result of the serial is

sendData Connecting...to Domoticz 192.168.178.42
/json.htm?type=command&param=udevice&idx=1&nvalue=0&svalue=23.10


Thanks on forehand

Chris
paulvha
Posts: 40
Joined: Friday 29 January 2016 16:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Arduino Variables to domoticz via http GET json, help:-)

Post by paulvha »

Could it have to do with the authorization as indicated on http://www.domoticz.com/wiki/Domoticz_API/JSON_URL's

"When using some method other than a browser to connect to Domoticz it may be necessary to do Authorization differently.
alfred_j_kwak
Posts: 110
Joined: Friday 20 September 2013 18:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.3530
Location: Finland
Contact:

Re: Arduino Variables to domoticz via http GET json, help:-)

Post by alfred_j_kwak »

Maybe port number?
ngc981
Posts: 7
Joined: Monday 25 January 2016 21:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Arduino Variables to domoticz via http GET json, help:-)

Post by ngc981 »

Paulvha, i checked the most of the code on this forum but most don't use any of authorisation. Mijn domoticz us plain SD install on a Pi, i am this will be the first thing to add

@Alfred the port used is 8080, which port can be used also for this?


Chris
paulvha
Posts: 40
Joined: Friday 29 January 2016 16:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Arduino Variables to domoticz via http GET json, help:-)

Post by paulvha »

on authorization : I agree. I use Python and can update, but was not sure what happens on libraries underneath. I add my svalue as a string to the URL. are you added as a float ?
ngc981
Posts: 7
Joined: Monday 25 January 2016 21:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

SOLVED: Arduino Variables to domoticz via http GET json, help:-)

Post by ngc981 »

Paul

Yes i did and its working with de code above, i did reinstall of domoticz on the SD now its working ik think i messed something up :-(
Any way thanks for your help and your reaction i appreciate that.


Chris
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest