ebaauw/homebridge-rpi

DS18B20 Temperature Sensor

Opened this issue · 6 comments

Hi,
is it possible to add the DS18B20 Temperature Sensor to the supported device?
I'd really appreciate.

Regards and keep up the great work,
Marco

Hi,
thanks for response! COuld you please help me understand better?
I'd like to have the possibility to connect a DS18B20 to my remote Raspberry and get a new exposed temperature device on my Homebridge like what can we do with DHT sensors.

I think it should be possible, but the setup is somewhat elaborate. I don't have such sensor myself, but it seems it's exposed over 1-wire using a system file.

Can you confirm that you can get to work the Python example to read the DS18B20 from https://abyz.me.uk/rpi/pigpio/examples.html? Could you please list the contents of /sys/bus/w1/devices/28*/w1_slave?

Hi Ebaauw,
thanks for reply!
The output of the command "ls /sys/bus/w1/devices/28*/w1_slave" is:
/sys/bus/w1/devices/28-011581d14bff/w1_slave

I'm trying to run the Python example you point me but it seems it stuck while connecting to remote Rapy (pi = pigpio.pi()) with both env variable configured with the remote ip address and ip as parameter of pi() function.

Sound strange because I was able to create a contact sensor and it works fine, I can see my door opened and closed on my iPhone :)

Make sure you run pidpiod with -l so it accepts remote connections. Unless you specify 127.0.0.1 explicitly, it somehow sees localhost as a remote connection as well, due to some weird IPv4/IPv6 address conversion. Check with pigs hwver that pigpiod is running and accessible from another host (using the PIGPIO_ADDR environment variable).

What's the contents of the file (cat /sys/bus/w1/devices/28*/w1_slave or, if it contains non-printable characters, od -c /sys/bus/w1/devices/28*/w1_slave

Hi, I found my issue and now I'm able to read the temperature with the python script:
the first issue I had was file access and I solved adding the line "/sys/bus/w1/devices/28-/w1_slave r" on file "/opt/pigpio/access" on my remote Raspy.
After that I also had to modify little bit the Pythion script because it was listing the wrong files so now it is fine with pi.file_list("/sys/bus/w1/devices/**28-
/**w1_slave").
Other than that I just had to add some .decode() on the data returned, here there is the working script:
DS18B20-1.zip
... the output of the script is this (every 3sec):
28-011581d14bff 21.1
28-011581d14bff 21.1
28-011581d14bff 21.1
....

And here there is the output of the command "cat /sys/bus/w1/devices/28*/w1_slave":
51 01 4b 46 7f ff 0c 10 ab : crc=ab YES
51 01 4b 46 7f ff 0c 10 ab t=21062

Thanks for your time!