Closed bjones14 closed 4 years ago
Thanks! In case it is relevant, what is your hub version?
@idpaterson I have a "hub v2, US customer Rev E" hub and the firmware version is 000.028.00012
Thanks for the change, with a small tweak this will go into the next update. Two comments on the code for this one:
?
in getHub()?.isBatteryInUse()
was probably intentional; removing it will cause an error if getHub()
does not return a value. Thanks for the change, with a small tweak this will go into the next update. Two comments on the code for this one:
1. The `?` in `getHub()?.isBatteryInUse()` was probably intentional; removing it will cause an error if `getHub()` does not return a value. 2. I can't find any references to a "HubUpdated" event past 2017, but it doesn't look like there is any harm in leaving the old code in case it is still relevant for v1 hubs or similar. Would you please update this to subscribe to and handle both events?
Understood! This is my first run-in with Groovy so I wasn't sure if it was a syntax quirk I was unaware of.
Good point, I will make the changes shortly here and update this PR
The hubPowerSource updates were not working for me, so I decided to investigate. I found that the latest version of the code had a small bug (with the assumed inadvertent question mark in the method call), as well as the incorrect event handler setup.
There was no "HubUpdated" event to subscribe to, which is why the hubPowerSource value change updates were never triggering. Instead, there was a hubInfo event to subscribe to, which contains a key named "batterygpiostat" which gives the hub power source information.
I have implemented and tested this with my hub. I am not familiar with how different hubs versions are supported (if they are), I just know this is what was required for my hub to function. A quick google search told me that other people were experiencing the same issue as well.