djMax / homebridge-radiora

Homebridge plugin for RadioRA2 from Lutron
3 stars 4 forks source link

Status of light switches is incorrect in Home app #4

Open bproulx05 opened 7 years ago

bproulx05 commented 7 years ago

Hi, your plugin is great. However, it seems it cannot retrieve and show the correct status of switches in the Home app if the status of the switches have not been set by the Home app or Siri.

For example, by default, after I start HomeBridge, all my registered light status are shown as 'Off', so matter if they are currently on or off. The real status of a light switch manually turned on or off directly from the switch will not be updated in Home app.

But when I change turn the switch on and off from Siri or Home app, then the status is reflected correctly in Home app.

***Reproduceable steps: 1-manually turn on a switch 2-(re)start Homebridge 3-Open Home app ->Status of all light switches will first show "Updating..." ->Then All switches are shown as turned off, including the switch that is really on from Step 1 4-In Home App, click on the switch from Step 1 and it will remain on (I'm assuming the plugin is not aware it's already ON thus sending correct command to turn it on so it remains ON. ->in Home app the status will now show it's ON 5-In Home App, click on that switch again ->The light will turn off and the status will show as Off in Home App

++ Before steps 4 and 5 I switch to anotherRoom in Home app and come back to the correct room to "force" an update of the status of the light switched in that room.

djMax commented 7 years ago

Thanks, I agree this is an issue. I haven't quite figured out how to tell Home about a status update that occurs outside of it. The plugin gets the status from the Lutron system just fine, I just don't know what to do once that happens. Hasn't been a problem for me really so I haven't dug into it, but if you find anything about how to do that I'm happy to fix it.

djMax commented 7 years ago

although actually you seem to be saying it gets the status wrong from the start? Haven't seen that.

bproulx05 commented 7 years ago

Yes. From the start the status is wrong in Home app.

Note that I have an AppleTV 4 set as the HomeKit hub, but I don't think it makes a difference.

Thanks for the reply, though. I'll try to do some research and share if I find anything that might be helpful, but I'm not an expert :-) On Fri, Jan 13, 2017 at 21:55 Max Metral notifications@github.com wrote:

although actually you seem to be saying it gets the status wrong from the start? Haven't seen that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/djMax/homebridge-radiora/issues/4#issuecomment-272596434, or mute the thread https://github.com/notifications/unsubscribe-auth/AX8wOUpGdWxzs215DNrKrexn_gtJmC1Wks5rSDkNgaJpZM4LjetW .

bproulx05 commented 7 years ago

Just a thought: In GetServices(), you use "addCharacteristic", should not it be GetCharacteristic instead? I looked at other samples plugins and I have not seen others user addCharacteristic.

I think that Brightness is already added in the LightBulb Service definition in HomeBridge (in the latest version I guess). HomeKitTypes

if (!this.isSwitch) {
      this.service.addCharacteristic(Characteristic.Brightness).on('get', callback => {
        this.get('brightness', callback);
      }).on('set', (value, callback) => {
        this.setBrightness(value, callback);
      });
    }