metbosch/homebridge-http-temperature

Right answer for the json-parser

DaPeace80 opened this issue · 1 comments

Hello,
i try to get temperature working with my arduino + homebridge.
Ive tried several possibilitys but cant figure out what sentence i have to send back to your temp-script.
Every time it trys to parse the temp its killing homebridge.

I tried:

String s = "HTTP/1.1 200 OK\r\n{\r\n "temperature": ";
s += temp;
s += "\r\n}";
client.print(s);
client.flush();

as well as:

String s = "{"temperature": ";
s += temp;
s += "}";

i first tried with a fixed variable -> long temp = 20.0;
Could you help?
When i reroute to an php-script with content:

{
"temperature": 20.0
}

the script works... :-(

Regards, Jan

Try (note the the slashes before the internal double-quotes):

String s = "{"temperature": ";
s += temp;
s += "}";
client.print(s);
client.flush();