dgreif / homebridge-hatch-baby-rest

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

Plug in not working #26

Closed Bmkenny closed 4 years ago

Bmkenny commented 4 years ago

Hi,

I installed the plug in for my hatch baby rest, and it successfully loaded into my apple home app, but it doesn't actually turn the nightlight on. This is for my bluetooth night light, and I also have a wifi rest+ and when I try to paste the code in terminal I receive the below error. Can someone please give me some guidance? Thanks!

bash: platforms:: command not found bash: platform:: command not found bash: email:: command not found bash: password:: command not found bash: ]: command not found

dgreif commented 4 years ago

Your config shouldn't be pasted into the terminal, but into your homebridge config.json. If you are having trouble getting your config set up, I suggest you try installing https://www.npmjs.com/package/homebridge-config-ui-x to assist you.

Bmkenny commented 4 years ago

Got it. Apologies as I’m not a coded nor software engineer so totally unfamiliar with coding languages, best practices, etc. If I am using Hoobs do I still need to install the homebridge config you suggested?

Either way, yes or no, how would I access the config.jason to paste the config for any new plug ins moving forward?

Also, just to clarify, the plug in successfully downloaded and loaded my Bluetooth rest into my HomeKit app but I just can’t control the light at all. Is this still attributed to the same issue you referenced? Thanks again!

dgreif commented 4 years ago

On hoobs, you do not need the config-ui-x plugin. You can edit your config via the HOOBS ui. Your Rest+ should show up and work without issues if you put your email/password in the platforms section. The bluetooth one takes a bit more work, but the directions are detailed in https://github.com/dgreif/homebridge-hatch-baby-rest#configuration-for-hatch-baby-rest-bluetooth-night-light. If you can see your bluetooth light in the Home app but it simply won't turn on the light, try running this command: sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev.

dgreif commented 4 years ago

Just re-read your second comment and it looks like it's showing up. It would be helpful if you could restart your HOOBS server and then try turning the light on/off, then grab your logs from HOOBS. There may be errors or details in the logs that would be useful

Bmkenny commented 4 years ago

I can't seem to find where to edit the config.json in hoobs, and can't get the wifi rest+ to add to my hoobs. I ran the command you suggested for the bluetooth rest and got the below results, but it still doesn't turn on when I turn it on from my home app. Should I try deleting it and readding it?

Reading package lists... Done Building dependency tree
Reading state information... Done The following additional packages will be installed: libbluetooth3 Suggested packages: bluez-cups bluez-obexd pulseaudio-module-bluetooth The following NEW packages will be installed: bluetooth libbluetooth-dev libudev-dev The following packages will be upgraded: bluez libbluetooth3 2 upgraded, 3 newly installed, 0 to remove and 47 not upgraded. Need to get 1206 kB of archives. After this operation, 888 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libudev-dev armhf 241-7~deb10u4+rpi1 [110 kB] Get:2 http://archive.raspberrypi.org/debian buster/main armhf bluez armhf 5.50-1.2~deb10u1+rpt2 [770 kB] Get:3 http://archive.raspberrypi.org/debian buster/main armhf bluetooth all 5.50-1.2~deb10u1+rpt2 [43.3 kB] Get:4 http://archive.raspberrypi.org/debian buster/main armhf libbluetooth3 armhf 5.50-1.2~deb10u1+rpt2 [93.5 kB] Get:5 http://archive.raspberrypi.org/debian buster/main armhf libbluetooth-dev armhf 5.50-1.2~deb10u1+rpt2 [190 kB] Fetched 1206 kB in 1s (870 kB/s)
Reading changelogs... Done (Reading database ... 46126 files and directories currently installed.) Preparing to unpack .../bluez_5.50-1.2~deb10u1+rpt2_armhf.deb ... Unpacking bluez (5.50-1.2~deb10u1+rpt2) over (5.50-1.2~deb10u1+rpt1) ... Selecting previously unselected package bluetooth. Preparing to unpack .../bluetooth_5.50-1.2~deb10u1+rpt2_all.deb ... Unpacking bluetooth (5.50-1.2~deb10u1+rpt2) ... Preparing to unpack .../libbluetooth3_5.50-1.2~deb10u1+rpt2_armhf.deb ... Unpacking libbluetooth3:armhf (5.50-1.2~deb10u1+rpt2) over (5.50-1.2~deb10u1+rpt1) ... Selecting previously unselected package libbluetooth-dev:armhf. Preparing to unpack .../libbluetooth-dev_5.50-1.2~deb10u1+rpt2_armhf.deb ... Unpacking libbluetooth-dev:armhf (5.50-1.2~deb10u1+rpt2) ... Selecting previously unselected package libudev-dev:armhf. Preparing to unpack .../libudev-dev_241-7~deb10u4+rpi1_armhf.deb ... Unpacking libudev-dev:armhf (241-7~deb10u4+rpi1) ... Setting up bluez (5.50-1.2~deb10u1+rpt2) ... Setting up libudev-dev:armhf (241-7~deb10u4+rpi1) ... Setting up libbluetooth3:armhf (5.50-1.2~deb10u1+rpt2) ... Setting up bluetooth (5.50-1.2~deb10u1+rpt2) ... Setting up libbluetooth-dev:armhf (5.50-1.2~deb10u1+rpt2) ... Processing triggers for systemd (241-7~deb10u4+rpi1) ... Processing triggers for man-db (2.8.5-2) ... Processing triggers for dbus (1.12.16-1) ... Processing triggers for libc-bin (2.28-10+rpi1) ...

dgreif commented 4 years ago

To get to the full config file in the HOOBS UI, go to the Configuration section (gear in lower left), and then Advanced. This shows you the entire config file and should have your accessory already listed for the Rest. You will need to add an item in the platforms section with your email and user name to get the Rest+ working - https://github.com/dgreif/homebridge-hatch-baby-rest#configuration-for-hatch-baby-rest-wifi-night-light

Regarding your Rest not working, it's still probably a bluetooth access issue of some sort. You will need to look at the logs from HOOBS to see if there are possibly errors - https://support.hoobs.org/docs/5e76448ae87d1e02b6c19d40

Bmkenny commented 4 years ago

Got it, thanks! So I tried copy and pasting the code that you specify in your instructions in the platforms section, and even made sure to separate it from the above plug in with a "," and I keep getting a json code error "invalid json." I'm not sure where to go from here with the wifi rest+. In regards to the bluetooth rest I tried to turn it on and off again and the logs for these actions are below: (they only show the action of trying to turn it on and off - nothing else)

8/23/2020, 9:39:58 PM [****] Turning on 8/23/2020, 9:40:10 PM [****] Turning off

Can you advise on any other thoughts that you might have so I can resolve both issues with the plug in not working?

Thanks in advance!

Bmkenny commented 4 years ago

Hi, just checking back in to see if you have any suggestions or ideas as to how I can get both of these rest machines to work. Thanks.

dgreif commented 4 years ago

@Bmkenny I'm sorry for the long delay! I hope you got past your issues, but if not, here are a few things to try:

For the Bluetooth Rest, you may need to run sudo setcap cap_net_raw+eip $(eval readlink -fwhich node). This gives NodeJS the ability to use bluetooth without elevated permissions. Once you run that, restart your homebridge server and see if you are able to control that light.

For the config issue, check out https://github.com/homebridge/homebridge/wiki/Homebridge-Config-JSON-Explained which explains how it work/looks. You can paste your whole config file contents into https://codebeautify.org/jsonvalidator which should help you narrow down which lines have issues. If that doesn't help, you can paste it in a new comment, but make sure you remove any usernames, passwords, etc.

Bmkenny commented 4 years ago

@dgreif thanks for the reply. I just tried running that command and got the below error message. Not sure what I'm doing wrong. Also, not sure why the line breaks at "readlink" and starts again at the beginning of the same line instead of going to the below line. Also, I was able to get an acceptable config.json in the config file, but the wifi rest + is still not showing up in my accessories. Any other ideas or thoughts as to what I'm doing wrong here? Thanks again!

-f which node)me/hoobs/.hoobs/etc $ sudo setcap cap_net_raw+eip $(eval readlink Failed to set capabilities on file/home/hoobs/.hoobs/etc/which' (No such file or directory) The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file`

dgreif commented 4 years ago

Sorry, formatting got weird on that and I didn't notice:

sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

For the rest+, is there anything in your logs? It should say something like [HatchBabyRest] Configuring 1 Hatch Baby Rest+ light

Bmkenny commented 4 years ago

no problem. Thanks for the correction. I ran that command and nothing seemed to happen, but now it seems that the bluetooth light is operational in the home app.

The logs show three things that I can see:

9/12/2020, 8:21:41 AM [***** Room] Waiting for bluetooth to power on

9/12/2020, 8:21:41 AM Load homebridge-hatch-baby-rest.HatchBabyRest 9/12/2020, 8:21:41 AM [homebridge-hatch-baby-rest.HatchBabyRest] No configuration found for platform HatchBabyRest

9/12/2020, 8:23:34 AM Load homebridge-hatch-baby-rest.HatchBabyRest 9/12/2020, 8:23:34 AM [homebridge-hatch-baby-rest.HatchBabyRest] No configuration found for platform HatchBabyRest

9/12/2020, 8:48:22 AM [ Room] Turned off 9/12/2020, 8:48:27 AM [ Room] Disconnected from ***** Room

Thoughts?

dgreif commented 4 years ago

The line that says Turned off is promising. I think it only logs that if it got connected to the light. I'd try turning it on/off a couple more times and watch the logs.

The No configuration found for platform HatchBabyRest log indicates that your config isn't correct still. Would you mind posting your config and I can point out what needs to be fixed?

Bmkenny commented 4 years ago

Yup, for the bluetooth light all seems to be working now.

For the rest + however, I figured out the issue, but now my Ring accessory doesn't function. I copied and pasted the validated config.json from the code beauty site you provided and it gave me the first section below, but when I paste that into the config.json file in hoobs and save changes it gives me the second pasted section below. Please advise. Thanks!

{ "platform": "HatchBabyRest", "email": "", "password": "",

        "platform": "Ring",
        "plugin_map": {
            "plugin_name": "homebridge-ring"
        },
        "refreshToken": "****,
        "hideCameraSirenSwitch": **,
        "hideInHomeDoorbellSwitch": **,
        "hideAlarmSirenSwitch": **,
        "hideUnsupportedServices": **
    }
]

}

}, { "platform": "Ring", "email": "****", "password": "****", "plugin_map": { "plugin_name": "homebridge-ring" }, "refreshToken": "****", "hideCameraSirenSwitch": **, "hideInHomeDoorbellSwitch": **, "hideAlarmSirenSwitch": **, "hideUnsupportedServices": ** } ] }

Bmkenny commented 4 years ago

It's also worth noting that when I replace the platform name in the second section with "HatchBabyRest" the rest + shows up in the home app and operates correctly, but the Ring accessory stops functioning.

dgreif commented 4 years ago

I think you are trying to put both platforms in a single platform config object. It should look more like this:

"platforms": [
    {
      "platform": "HatchBabyRest",
      "email": "",
      "password": ""
    },
    {
      "platform": "Ring",
      "plugin_map": {
        "plugin_name": "homebridge-ring"
      },
      "refreshToken": "****",
      "hideCameraSirenSwitch": "**",
      "hideInHomeDoorbellSwitch": "**",
      "hideAlarmSirenSwitch": "**",
      "hideUnsupportedServices": "**"
    }
  ]
dgreif commented 4 years ago

@Bmkenny did that help you get it straightened out?

Bmkenny commented 4 years ago

Yes, it seems to have resolved the issues. Although, it's curious since the first time I tried doing the exact same thing I received errors for json syntax being incorrect. Neither here nor there now though. Thanks for the help.

On Sun, Sep 13, 2020 at 8:14 AM Dusty Greif notifications@github.com wrote:

@Bmkenny https://github.com/Bmkenny did that help you get it straightened out?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dgreif/homebridge-hatch-baby-rest/issues/26#issuecomment-691684023, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQWSNQJ5TZH54XF422IAP2DSFTOW3ANCNFSM4QIE633Q .

mikemcbride commented 3 years ago

Just came here having the same problem (I have 3 of the bluetooth Hatch devices) and this was super helpful! For me, the missing stuff was those bluetooth packages and granting Node access to it. Thanks a bunch for this, it's really useful