kuestess / homebridge-platform-insteonlocal

Homebridge platform plugin for local Insteon control
Other
76 stars 26 forks source link

invert_sensor doesn't seem to have any effect #46

Closed networkjitter closed 5 years ago

networkjitter commented 5 years ago

I believe my Iolinc setup is fairly standard and works as expected in the Insteon app, however the status displayed in the Home app is backwards. (i.e. shows open when the garage is closed). My sensor is closed when the door is fully closed and open when open. This corresponds to the status of the Iolinc to be "on" when open (red status in the Insteon app) and "off" when closed (gray).

invert_sensor: set to true if your iolinc sensor is inverted, ie off when closed and on when open; default value is false

Whether I configure this parameter or not the behavior in the home app is the same. What am I missing here?

{ "name": "Garage Door", "deviceID": "4Dxxxx", "dimmable": "no", "deviceType": "iolinc", "gdo_delay": "15", "invert_sensor": "true" },

kuestess commented 5 years ago

@networkjitter Try removing the quotes around true for the invert_sensor key so it is interpreted as boolean.

networkjitter commented 5 years ago

I had tried that previously and just did again with no change in behavior. Functionality works just fine, just the reported state is opposite of actual state. Here is the log from an open and closing of the garage door (close then open initiated from the home app).

[12/11/2018, 5:40:13 PM] [Insteon Local Platform] Setting Garage Door relay to 1 [12/11/2018, 5:40:14 PM] [Insteon Local Platform] Setting Garage Door target state to 1 [12/11/2018, 5:40:29 PM] [Insteon Local Platform] Getting sensor state for Garage Door [12/11/2018, 5:40:29 PM] [Insteon Local Platform] Getting sensor state for Garage Door [12/11/2018, 5:40:29 PM] [Insteon Local Platform] Getting sensor state for Garage Door [12/11/2018, 5:40:44 PM] [Insteon Local Platform] Setting Garage Door relay to 0 [12/11/2018, 5:40:44 PM] [Insteon Local Platform] Setting Garage Door target state to 0 [12/11/2018, 5:40:59 PM] [Insteon Local Platform] Getting sensor state for Garage Door [12/11/2018, 5:41:13 PM] [Insteon Local Platform] Getting sensor state for Garage Door [12/11/2018, 5:41:13 PM] [Insteon Local Platform] Getting sensor state for Garage Door

img_1508

kuestess commented 5 years ago

@networkjitter Can you run the above in debug mode (homebridge -D) and paste the output? Thanks!

kuestess commented 5 years ago

@networkjitter I was returning the wrong status variable (it wasn't being inverted) in the callback. just published a fix - try that and see if it works.

networkjitter commented 5 years ago

After updating the plug-in, the behavior was the same with "invert_sensor": true however if I remove that parameter altogether, Homekit now reports the correct status. Is this the expected behavior?

open garage door

[12/12/2018, 6:32:15 PM] [Insteon Local Platform] Setting Garage Door relay to 0
[12/12/2018, 6:32:19 PM] [Insteon Local Platform] Setting Garage Door target state to 0
[12/12/2018, 6:32:19 PM] [Insteon Local Platform] Garage Door sensor is on
...
[12/12/2018, 6:32:34 PM] [Insteon Local Platform] Getting sensor state for Garage Door
[12/12/2018, 6:32:35 PM] [Insteon Local Platform] Garage Door sensor is off

close garage door

[12/12/2018, 6:33:09 PM] [Insteon Local Platform] Setting Garage Door relay to 1
[12/12/2018, 6:33:11 PM] [Insteon Local Platform] Setting Garage Door target state to 1
[12/12/2018, 6:33:23 PM] [Insteon Local Platform] Garage Door sensor is off
...
[12/12/2018, 6:33:26 PM] [Insteon Local Platform] Getting sensor state for Garage Door
[12/12/2018, 6:33:27 PM] [Insteon Local Platform] Garage Door sensor is on
kuestess commented 5 years ago

@networkjitter Glad it works, but that isn't the expected behavior :-). I just published a new version to npm with some additional debug messages - can you run the same sequence above in debug mode and paste the output? Thanks!

networkjitter commented 5 years ago

Apologies for the delay. After updating, still working as desired with "invert_sensor:false". Log output below.

open garage door

[1/3/2019, 6:43:00 PM] [Insteon Local Platform] Setting Garage Door relay to 0
[1/3/2019, 6:43:03 PM] [Insteon Local Platform] Setting Garage Door target state to 0
[1/3/2019, 6:43:03 PM] [Insteon Local Platform] Garage Door sensor is on
[1/3/2019, 6:43:03 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:43:03 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:43:03 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:43:04 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:43:20 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:43:23 PM] [Insteon Local Platform] Getting sensor state for Garage Door
[1/3/2019, 6:43:23 PM] [Insteon Local Platform] Getting sensor state for Garage Door
[1/3/2019, 6:43:23 PM] [Insteon Local Platform] Getting sensor state for Garage Door
[1/3/2019, 6:43:24 PM] [Insteon Local Platform] Invert sensor: false
[1/3/2019, 6:43:24 PM] [Insteon Local Platform] Garage Door sensor is off, currentState: 0
[1/3/2019, 6:43:25 PM] [Insteon Local Platform] Invert sensor: false
[1/3/2019, 6:43:25 PM] [Insteon Local Platform] Garage Door sensor is off, currentState: 0
[1/3/2019, 6:43:26 PM] [Insteon Local Platform] Invert sensor: false
[1/3/2019, 6:43:26 PM] [Insteon Local Platform] Garage Door sensor is off, currentState: 0

close garage door

[1/3/2019, 6:45:36 PM] [Insteon Local Platform] Setting Garage Door relay to 1
[1/3/2019, 6:45:38 PM] [Insteon Local Platform] Setting Garage Door target state to 1
[1/3/2019, 6:45:51 PM] [Insteon Local Platform] Garage Door sensor is off
[1/3/2019, 6:45:51 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:45:51 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:45:51 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:45:53 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:45:58 PM] [Insteon Local Platform] Getting sensor state for Garage Door
[1/3/2019, 6:45:59 PM] [Insteon Local Platform] Invert sensor: false
[1/3/2019, 6:45:59 PM] [Insteon Local Platform] Garage Door sensor is on, currentState: 1
[1/3/2019, 6:46:09 PM] [Insteon Local Platform] Got event for Garage Door (XXXXXX)
[1/3/2019, 6:46:11 PM] [Insteon Local Platform] Getting sensor state for Garage Door
[1/3/2019, 6:46:11 PM] [Insteon Local Platform] Getting sensor state for Garage Door
[1/3/2019, 6:46:12 PM] [Insteon Local Platform] Invert sensor: false
[1/3/2019, 6:46:12 PM] [Insteon Local Platform] Garage Door sensor is on, currentState: 1
[1/3/2019, 6:46:12 PM] [Insteon Local Platform] Invert sensor: false
[1/3/2019, 6:46:12 PM] [Insteon Local Platform] Garage Door sensor is on, currentState: 1

Cheers

kuestess commented 5 years ago

@networkjitter Hmmmm....let me look into this a bit more and make sure that invert is doing what I expect. Seemed to work for me with some degree of testing. One thing for sure is that the current code generates alot of Insteon traffic - will fix that too :-).

kuestess commented 5 years ago

@networkjitter Just pushed a fix that should address this. Had an if that wasn't always evaluating as expected (was really strange). Should be fixed now.

kuestess commented 5 years ago

Closing due to inactivity.