ebaauw / homebridge-rpi

Homebridge plugin for Raspberry Pi.
Apache License 2.0
305 stars 18 forks source link

New temperature sensor #169

Closed JaKubinaa closed 5 months ago

JaKubinaa commented 6 months ago

Hi :)

Would it be possible to add another temperature sensor?

I have a DS18B20 sensor that is also one wire, I would like to use it in the sauna.

The dht22 sensor can't handle it. I need something that can handle higher temperatures than the dht22.

Great plugin, thank you.

ebaauw commented 6 months ago

Don’t know that one. Would you have any technical info on it?

JaKubinaa commented 6 months ago

There is datasheet https://pdf1.alldatasheet.com/datasheet-pdf/view/227472/DALLAS/DS18B20.html

There is description of data structure but in polish https://ntronic.pl/czujnik-temperatury-ds18b20/

ebaauw commented 6 months ago

From what I can tell, the sensor's GPIO pin cannot be read through pigpio directly, see https://github.com/joan2937/pigpio/issues/60#issuecomment-214872513.

But when 1-wire support is enabled on Raspberry Pi OS, the sensor output is available on a file, /sys/bus/w1/devices/28-00*/w1_slave, which could be accessed through pigpiod. Search for 1-wire on https://abyz.me.uk/rpi/pigpio/examples.html.

I could implement polling the file and parsing its contents relatively easily (similar to polling the files for the LED state). I'm afraid the file name would need to be specified in config.json. Or maybe it would be enough to specify only the device ID, as the file name is derived from that. And, obviously, /opt/pigpio/access would need to be edited manually, to allow access to the file.

Could you please enable 1-wire on your Pi and double-check that a /sys/bus/w1/devices/28-00*/w1_slave file is indeed created? Could you please list the contents of that file (using cat when it context text, or od -c when it's binary)? Could you please check that the contents are updated when the temperature changes?