knuckleheadsmiff / homebridge-garagedoor-ryobi

Homebridge plugin for Ryobi GDO (Garage Door Opener)
4 stars 4 forks source link

garagedoor_id no longer work in 0.2.7 #10

Closed gardiner4 closed 4 years ago

gardiner4 commented 4 years ago

I have 2 garage doors in my account. I was using the garagedoor_id to make use of 2 doors. After updating to 0.2.7 it no longer works.

[9/1/2020, 9:06:58 PM] [Garage 1] Error update 1 - retrieving ryobi GDO status [9/1/2020, 9:06:58 PM] [Garage 1] Error Message: TypeError: Cannot convert undefined or null to object [9/1/2020, 9:06:58 PM] [Dads Garage 2] Error update 1 - retrieving ryobi GDO status [9/1/2020, 9:06:58 PM] [Dads Garage 2] Error Message: TypeError: Cannot convert undefined or null to object

When I use garagedoor_name both instances seem to control the same door.

knuckleheadsmiff commented 4 years ago

Yikes. I’ve never used with multiple doors.

The big change was from a collaborator that cleaned up the code and to use cookies to keep for having to repeatedly login in. I suspect this is the root cause, the two instances somehow sharing cookies.

I’ll ask him too look into it else I’ll have to rollback that submission. You’re the first person to mention this and the Chang was made awhile ago.

Sorry!

gardiner4 commented 4 years ago

I rolled it back to 0.2.6 and it works great. If you need me to test anything let me know.

knuckleheadsmiff commented 4 years ago

Sorry again. I’m sure it’s related to the cookie changes. I’m really not set up for development anymore but I can easily rollback the changes. I’ll probably go ahead and do that.

This was my first NPM/Github project and other than one other small one I did that someone else took ownership of (hooking up a weather station provider to an existing HomeBridge project) I haven’t touched this stuff.

knuckleheadsmiff commented 4 years ago

I sent https://github.com/andyedinborough a note asking him to look into this. If he does not respond I'll back stuff out within the week. My guess either the fix is trivial (not sharing cookies between instances) or hard.

knuckleheadsmiff commented 4 years ago

Note to self: If we revert the change and backout the code using cookies I will need to fix this bug: #7 where the password was not being properly encoded.

https://github.com/knuckleheadsmiff/homebridge-garagedoor-ryobi/issues/7

gardiner4 commented 4 years ago

I have one other item. iOS handles each door as a separate entity, but Home Assistant gets confused and will only display one of the doors using the HomeKit controller. I even ran 2 instances of Homebridge to test. It was not until I modified the serial number to a unique number was Home Assistant able to separate the doors.

.setCharacteristic(Characteristic.SerialNumber, '001');

If you could change "001" to a variable like garagedoor_name or daragedoor_id it should fix the Home Assistant issue. I then use Home Assistant to Bridge the doors back to iOS Homekit.

knuckleheadsmiff commented 4 years ago

No problem I’ll look at that after dealing with your first problem. Should be easy thing.

knuckleheadsmiff commented 4 years ago

I also added a new "serial_number" field (see doc) that you can make unique in each instance. This to me seemed like the lowest risk fix...i do minimal work on this these days so I want to be a safe as possible. That said I did not test for multiple doors but you should be good to go with the latest release.

gardiner4 commented 4 years ago

I just updated and still have the issue. It is not really a multiple door issue, but actually a "garagedoor_id" issue. When I use one door but use "garagedoor_id" it gives the TypeError.

     "accessory": "RyobiGarageCommand",
        "name": "Garage 1",
        "email": "xxxxx@xxxxx",
        "password": "XXXX",
        "garagedoor_id": "1234567890"

[9/11/2020, 12:47:35 PM] Homebridge is running on port 51827. [9/11/2020, 12:47:50 PM] [Garage 1] Error update 1 - retrieving ryobi GDO status [9/11/2020, 12:47:50 PM] [Garage 1] Error Message: TypeError: Cannot convert undefined or null to object

In 0.2.6 this config works fine.

knuckleheadsmiff commented 4 years ago

OK, I see that merge #3 introduced in 2.7. I'm going to send back to him to fix. In the meantime if you can use the garagedoor_name instead it should work.

andyedinborough commented 4 years ago

It was executing the callback right away if garagedoor_id was specified, without first making the login request. I was able to reproduce the issue and #12 resolves it.

knuckleheadsmiff commented 4 years ago

Thanks again Andy. I just only tested with my default settings (no deviceid) and of course that is working for me.

https://github.com/gardiner4 I also added the serial_number per your request. For each of your instances you should put in a unique value.

gardiner4 commented 4 years ago

I can confirm device_id now works again. I also confirm that the serial number field allows Home Assistant to distinguish them as separate entities. I was able to shutdown one of my Home Bridge instances. Thank you. Great fix!

DustinHartzler commented 3 years ago

I used the device_id today and was able to add a second door to HomeKit. WAAY better than the Ryobi app interface :)