ebaauw / homebridge-rpi

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

Add support for DHT11 or other temperature sensor #139

Closed BloomyInDev closed 2 years ago

BloomyInDev commented 2 years ago

It's could be an good idea ! Some tutorial to use here

ebaauw commented 2 years ago

I need technical documentation how to read the sensor data from the GPIO pin over pigpio, not some end user tutorial. I cannot use a Python library for Homebridge RPi.

BloomyInDev commented 2 years ago

I have trove this or this

ebaauw commented 2 years ago

Thanks. I know the web site from the second link, but never looked into these examples.

The sensor is read using regular pigpio functions, and should work remotely. If I understand the code correctly, you set the GPIO pin low, and then the sensor flips the GPIO pin several times, encoding 40 bits of info, based on the timing between flips: 60-100ms for a 0 and 100-150ms for a 1. The code sets up a callback, that pigpiod calls on each rising edge (when the GPIO changes from low to high). The callback includes a timestamp, so the timing is handled by pigpio.

This looks doable; I might even be able to re-use the existing notification handle. I ordered a DHT11 and a DHT22; my favourite electronics web store even includes the 10kΩ resisters.

BloomyInDev commented 2 years ago

Did that enhancement had some advancements ?

ebaauw commented 2 years ago

Sorry, what enhancement?

BloomyInDev commented 2 years ago

Did you succeed to implement support for dht11 / dht22 (i didn't need it now)

ebaauw commented 2 years ago

In beta v1.4.0-0. Tested with DHT11 and DHT22. Homebridge RPi will configure an internal pull-up resister, so you don't need any external resister. See Wiki for details.

ebaauw commented 2 years ago

In v1.4.0.