Open silversurfer147 opened 6 years ago
Hi,
When I was running this homebridge module, I was running on a NodeMCU since it has all the wireless networking libraries already set.
From what I see, I’d suggest to not add tabs to temperature
etc, just try to create a variable and send that to client.println.
Beside that, I really don’t know what else it could be!
On Apr 29, 2018, 7:01 PM -0400, silversurfer147 notifications@github.com, wrote:
Hi, I have a problem to get data to homekit. I don't know where is a problem, could somene help me? I tried everything. Here is part of my code from arduino (which works without problem) EthernetClient client = server.available(); if(client){ Serial.println("new client"); boolean currentLineIsBlank = true; while(client.connected()){ if(client.available()){ char c = client.read(); Serial.write(c);
if(c == '\n' && currentLineIsBlank){ client.println("HTTP/1.1 200 OK"); client.println("Content-Type: application/json"); client.println("Connection: close"); // the connection will be closed after completion of the response client.println("Refresh: 5"); // refresh the page automatically every 5 sec client.println(); client.println(F("{")); client.print(F("\t\"temperature\": ")); client.print(temperature); client.println(F(",")); client.print(F("\t\"humidity\": ")); client.println(humidity); client.println(F("}")); break; } if (c == '\n') { // you're starting a new line currentLineIsBlank = true; } else if (c != '\r') { // you've gotten a character on the current line currentLineIsBlank = false; } }
} delay(1); // close the connection: client.stop(); "accessories": [ { "accessory": "HttpTemphum", "name": "Office Temperature", "url": "http://192.168.1.170", "http_method": "GET", "humidity": true, "cacheExpiration": 60 } ] Thank you in advance. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hi @lucacri , thank you very much, it helps :) . However I have one more problem, maybe you will know, where could be a problem. The humidity in json is 44
{"temperature": 26.60, "humidity": 44}
However in home app I see 22, when I set manually humidity 66, in home was 33, for 10 it was 5. Do you know, where could be a problem? Thank you so much.
That's very very strange. Are you sure you don't have any other plugin doing something fancy?
@silversurfer147 see #37
@b2un0 thank you very much for update
Hi, I have a problem to get data to homebridge. I still get messages HTTP Failure. I don't know where is a problem, could somene help me? I tried everything. Here is part of my code from arduino (which works without problem)
Thank you in advance.