Mixiaoxiao / Arduino-HomeKit-ESP8266

Native Apple HomeKit accessory implementation for the ESP8266 Arduino core.
MIT License
1.48k stars 278 forks source link

Please help me code DS18B20 #247

Open jockethebastard opened 3 months ago

jockethebastard commented 3 months ago

I hope this is the place, had no success with Reddit or Facebook.

I’m trying to install temperature sensor DS18B20 with my ESP8266 D1 Mini. I’ve had success with blinking lights and a relay switch, but can’t get the temp sensor working. If I use the code included with Mixiaoxiao I get it to show up in HomeKit by simply adding my WiFi credentials. Here’s where the problem begin, it shows different values every 10 sec, anything between 10-30 degrees.

I have no programming experience whatsoever, but I’ve been reading and trying a bunch of stuff already. From what I can see in the code, changes must be made to the part about temp values, I’ve tried adding the numbers -45 and 125, but no luck. I’ve pasted code from some random person who had this problem also, no luck. I have no idea what I can do right now. I also installed the Arduino library DS18B20 and added the .h file, but that just keeps getting error about duplicates, but when removing them some other error comes up.

Also, ” define your accessories here” what the heck does that even mean, and what should I put there?

Hope someone can help a total noob with this, cause it’s a code jungle out there and I just can’t grasp it.

Thanks.

putnik161 commented 3 weeks ago

void my_homekit_report() { // FIXME, read your real sensors here. sensors.requestTemperatures();

float temperature_value = sensors.getTempCByIndex(0);