NorthernMan54 / homebridge-dht

Homebridge plugin for DHT22 Temperature / Humidity Sensors
73 stars 14 forks source link

Can't start plugin on boot #20

Closed kaminetzky closed 5 years ago

kaminetzky commented 5 years ago

Hello, @NorthernMan54!

First of all, thank you very much for this plugin. It's been really useful.

I tested homebridge-dht by running sudo pigpiod and then homebridge. That worked perfectly. My problems began when I tried to run homebridge on boot. I configured cron to run the two commands mentioned before, but this didn't work. I'm not really sure why, but maybe sudo pigpiod wasn't being called before homebridge. Afterwards, I tried with sudo systemctl enable pigpiod and a script that called homebridge after waiting 15 seconds with cron. This method didn't work, too.

Homebridge starts successfully with these methods, but the DHT plugin does not. If my problem is that sudo pigpiod is not called before homebridge, how can I make sure it is called first?

Thank you very much in advance!

NorthernMan54 commented 5 years ago

How did you install pigpiod? I followed these steps which setup pigpiod to autostart on boot.

http://abyz.me.uk/rpi/pigpio/download.html

sudo apt-get update sudo apt-get install pigpio python-pigpio python3-pigpio

kaminetzky commented 5 years ago

I think I used the same method. When I run the second command, the following is shown.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
pigpio is already the newest version (1.64-1).
python-pigpio is already the newest version (1.64-1).
python3-pigpio is already the newest version (1.64-1).
The following packages were automatically installed and are no longer required:
  arduino-core avr-libc avrdude binutils-avr extra-xdg-menus gcc-avr libftdi1
  libjna-java libjna-jni librxtx-java realpath
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

Thank you very much for your quick reply!

kaminetzky commented 5 years ago

It appears that pigpiod is running on boot, as this is shown when I call sudo pigpiod. I called sudo systemctl enable pigpiod yesterday.

2019-02-03 19:22:25 initInitialise: Can't lock /var/run/pigpio.pid
Can't initialise pigpio library

I can run homebridge manually, too.

NorthernMan54 commented 5 years ago

I think I’m a bit lost here, what is the actual problem / issue

If pigpiod starts after homebridge, it’s not a real issue as the next time homebridge looks for the temperature it will work.

On Feb 3, 2019, at 5:23 PM, Alejandro Kaminetzky notifications@github.com wrote:

It appears that pigpiod is running on boot, as this is shown when I call sudo pigpiod.

2019-02-03 19:22:25 initInitialise: Can't lock /var/run/pigpio.pid Can't initialise pigpio library I can run homebridge manually, too.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.

kaminetzky commented 5 years ago

I had no idea the plugin worked when pigpiod started after homebridge. Just did that and homebridge got the data the second time.

Thank you so much!

kaminetzky commented 5 years ago

My problem was that the temperature/humidity data in the Home app was showing zeros. When I waited for the second data poll, it worked flawlessly.