dgreif / homebridge-hatch-baby-rest

A homebridge plugin for Hatch Baby Rest night light
MIT License
74 stars 19 forks source link

Unit no changing state, everything else seems ok #2

Closed meirmsn closed 4 years ago

meirmsn commented 4 years ago

@dgreif THANK YOU so much for making this homebridge plugin! I've been waiting since earlier this year for someone smarter than me to figure out how to do a plugin for the hatch baby rest

I was able to add the config, and it shows up in my home app. When I tap to turn on/off the button on the home app changes on/off, the logs on homebridge show like this:

[11/24/2019, 12:22:10 AM] [Hatch Baby Rest] Turning on [11/24/2019, 12:22:15 AM] [Hatch Baby Rest] Turning off [11/24/2019, 12:22:18 AM] [Hatch Baby Rest] Turning on [11/24/2019, 12:22:24 AM] [Hatch Baby Rest] Turning off [11/24/2019, 12:22:24 AM] [Hatch Baby Rest] Turning on [11/24/2019, 12:22:26 AM] [Hatch Baby Rest] Turning off

yet the hatch baby rest is not changing state (it keeps on if it was on, or keeps off if it was off)

Homebridge is running in a raspberry pi 3 b+, homebridge config includes volume, audioTrack, color, and my unit's MAC address, and I got the older hatch baby rest (not the newer one with wifi)

Any insights of what could be going wrong, or what else can I check?

Thank you so much again!

dan0-gh commented 4 years ago

I initially had the same issue; seemed to be permissions related. I'm running on Raspberry Pi 4 w/ Raspbian. You should additionally see these messages when starting homebridge: [03/12/2019, 20:44:43] [Kid's Night Light] Connecting... [03/12/2019, 20:44:43] [Kid's Night Light] Connected Try running with sudo homebridge -U ~/.homebridge/ and see if it works. If it does, the next step is to add your username policy to bluetooth.conf as per https://www.raspberrypi.org/forums/viewtopic.php?t=108581 (the pi policy at the link didn't work for me so I copied the the root policy and it worked) and then try then homebridge without sudo.

dgreif commented 4 years ago

@meirmsn sorry for being slow to respond to your issue. @AC3LAB5 thanks for the input! I would definitely guess it's a permissions issue. I ran into similar hurtles when I was building the plugin and unfortunately I didn't document what fixed it 🤦‍♂. I think the instructions in https://www.raspberrypi.org/forums/viewtopic.php?t=108581 look like a good first thing to try (just make sure you look at the user="pi" part and replace it with your main user name if it isn't pi. Let me know if that works for you and I will get it added to the Readme

dgreif commented 4 years ago

@meirmsn can you try running the following command and then give it a try?

sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev (pulled from https://www.npmjs.com/package/@abandonware/noble#ubuntudebianraspbian)

lukehoersten commented 4 years ago

I’m experiencing the same issue. Attempted all the fixes mentioned above with no success. Any way to collect more debug info?

dgreif commented 4 years ago

Ok, I finally got some time to circle back to this issue. I'm seeing it as well on my rpi3, and it comes down to bluetooth not being "poweredOn" as far as the plugin can tell. In my case, it was a permissions issue as described in https://github.com/abandonware/noble/issues/82. The solution was to run the command here: https://github.com/abandonware/noble#running-without-rootsudo-linux-specific. After that, I rebooted homebridge and now the plugin can successfully connect to my bluetooth Rest. Let me know if that works for either of you!

lukehoersten commented 4 years ago

@dgreif that worked. Thanks!