senorshaun / homebridge-radiora2

Lutron RadioRA2 plugin for homebridge
MIT License
10 stars 5 forks source link

Window Covering Motion Status #30

Closed N8BrB closed 1 year ago

N8BrB commented 1 year ago

Appreciating the the new enhancement to control Sivoia shades with homebridge-radiora2 v1.6.1-beta.3. It has been working well. Everything in the Homebridge UI seems to be working correctly, but there seems to be some oddities in HomeKit:

  1. When restarting home bridge, the device in Homekit changes to a hanging "Closing..." status, until the device is controlled. Maybe this is related to the next part.
  2. When controlling the shade from the Lutron app or Lutron device, it appears the HomeKit in motion status of the shade is reversed. When clicking Open or incrementing up, it states "Closing..." in HomeKit and when clicking Close or incrementing down, it states "Opening..."

Any easy fix?

senorshaun commented 1 year ago

Yeah that is. I’ll update it and make it live when the next version goes out. Should be this weekend, waiting for someone to confirm the new temp sensors show up (they did for me)

senorshaun commented 1 year ago

Ok try out 1.6.1-beta.4 and see if that fixed the issues. 1 may not be fixed...

N8BrB commented 1 year ago

Loaded the update and 1 is no longer an issue. Starts with the correct current state. For 2, it's just not showing in motion status anymore but it is correctly showing current % state and open/closed state. So not perfect, but definitely accurate. I'll take it! In motion status is sort of a luxury vs functionality anyway. Thx for the adjustment.

senorshaun commented 1 year ago

Try .5 beta. I realize I had the movement commands hidden behind something else so they weren't getting tripped. Let me know

N8BrB commented 1 year ago

No change in the in motion status. There is an exception being thrown in the Homebridge logs:

node:91147) UnhandledPromiseRejectionWarning: ReferenceError: positionState is not defined at WindowCovering.<anonymous> (/usr/lib/node_modules/homebridge-radiora2/lib/accessories/windowcovering.js:129:35) at RadioRa2.emit (events.js:400:28) at _processOutputResponse (/usr/lib/node_modules/homebridge-radiora2/lib/radiora2.js:285:24) at incomingData (/usr/lib/node_modules/homebridge-radiora2/lib/radiora2.js:124:45) at Socket.<anonymous> (/usr/lib/node_modules/homebridge-radiora2/lib/radiora2.js:26:92) at Socket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:293:12) at readableAddChunk (internal/streams/readable.js:267:9) at Socket.Readable.push (internal/streams/readable.js:206:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) (node:91147) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 46)

senorshaun commented 1 year ago

I'm sorry for that, error on my part. .6 is out

N8BrB commented 1 year ago

No worries. Looks like the exception is still there after loading .6

(node:108003) UnhandledPromiseRejectionWarning: ReferenceError: positionState is not defined at WindowCovering.<anonymous> (/usr/lib/node_modules/homebridge-radiora2/lib/accessories/windowcovering.js:133:70) at RadioRa2.emit (events.js:400:28) at _processOutputResponse (/usr/lib/node_modules/homebridge-radiora2/lib/radiora2.js:285:24) at incomingData (/usr/lib/node_modules/homebridge-radiora2/lib/radiora2.js:124:45) at Socket.<anonymous> (/usr/lib/node_modules/homebridge-radiora2/lib/radiora2.js:26:92) at Socket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:293:12) at readableAddChunk (internal/streams/readable.js:267:9) at Socket.Readable.push (internal/streams/readable.js:206:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) (node:108003) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 57)

senorshaun commented 1 year ago

Hmm. Thats very odd. Try .7 and if you keep getting an error, enable debug logs (a checkbox in the plugin settings) and send me what you get right before the error

N8BrB commented 1 year ago

Thanks for the update! The error is gone. So this is interesting, Homebridge UI is working perfectly: Open/Closed State, % Open state, Opening/Closing Status. HomeKit will show Open/Closed State and % Open state, but no in motion status (Opening/Closing...). Any thoughts about why Homebridge would have the in motion status but Homekit wouldn't? If not, beta .7 seems like a decent compromise of functionality.

senorshaun commented 1 year ago

Does it just immediately go to the open/closed state when you click the button to change state? if so, its because of how I'm setting the currentPosition immediately, so homekit doesn't like something to have the same target position and current position while moving. So I changed it to wait a second after setting target position to see if the shade is moving. if it is moving, then just move and wait to set the current position until after it's stopped. .8 is pushed, give that a try?

Again sorry for all of this back and forth, I just don't have a way to test it (which is why it wasn't already included lol)

N8BrB commented 1 year ago

No worries at all, just appreciate you spending the time on this. Big thank you.

Yes, for .7, Homekit immediately would go to Open or Close depending on the direction. If you stopped the shade in motion, it would then update to the % Open. So all in all, worked, just doesn't show in motion status. Also, this is based on controlling the shade from a Lutron device (Pico etc...).

I loaded .8 and Homebridge UI still working perfectly, but Homekit is acting odd. When using the Open or Close button from a Lutron device (Pico etc...), Homekit changes the device status to "Closing..." and it hangs. This is for either Open or Close.

Following exception is occurring in the log:

[2/28/2023, 5:25:36 PM] [homebridge-radiora2] This plugin generated a warning from the characteristic 'Current Position': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.

N8BrB commented 1 year ago

From the debug log for .8, Lutron Pico Close button press:

[2/28/2023, 5:33:57 PM] [RadioRA2] ~DEVICE,57,4,3 [2/28/2023, 5:33:58 PM] [RadioRA2] ~DEVICE,57,4,4 [2/28/2023, 5:33:58 PM] [RadioRA2] ~OUTPUT,43,1,0.00 [2/28/2023, 5:33:58 PM] [RadioRA2] Accessory 'MB Front Window 1' closed [2/28/2023, 5:33:58 PM] [RadioRA2] ~OUTPUT,43,29,8 [2/28/2023, 5:33:58 PM] [RadioRA2] ~OUTPUT,43,30,1,0.00 [2/28/2023, 5:33:58 PM] [RadioRA2] ~OUTPUT,43,32,1,23798 [2/28/2023, 5:33:58 PM] [RadioRA2] Accessory 'MB Front Window 1' finished moving [2/28/2023, 5:34:22 PM] [RadioRA2] ~OUTPUT,43,32,2,0.00 [2/28/2023, 5:34:22 PM] [RadioRA2] Accessory 'MB Front Window 1' finished moving [2/28/2023, 5:34:22 PM] [homebridge-radiora2] This plugin generated a warning from the characteristic 'Current Position': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.

N8BrB commented 1 year ago

From the debug log for .8, Lutron Pico Open button press: [2/28/2023, 5:35:54 PM] [RadioRA2] ~DEVICE,57,2,3 [2/28/2023, 5:35:54 PM] [RadioRA2] ~DEVICE,57,2,4 [2/28/2023, 5:35:54 PM] [RadioRA2] ~OUTPUT,43,1,100.00 [2/28/2023, 5:35:54 PM] [RadioRA2] Accessory 'MB Front Window 1' opened [2/28/2023, 5:35:54 PM] [RadioRA2] Accessory 'MB Front Window 1' set to 100.00% [2/28/2023, 5:35:54 PM] [RadioRA2] ~OUTPUT,43,29,8 [2/28/2023, 5:35:54 PM] [RadioRA2] ~OUTPUT,43,30,1,100.00 [2/28/2023, 5:35:54 PM] [RadioRA2] ~OUTPUT,43,32,0,24016 [2/28/2023, 5:35:54 PM] [RadioRA2] Accessory 'MB Front Window 1' finished moving [2/28/2023, 5:36:18 PM] [RadioRA2] ~OUTPUT,43,32,2,100.00 [2/28/2023, 5:36:18 PM] [RadioRA2] Accessory 'MB Front Window 1' finished moving [2/28/2023, 5:36:18 PM] [homebridge-radiora2] This plugin generated a warning from the characteristic 'Current Position': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.

senorshaun commented 1 year ago

Well that fun. I guess I need to store the target position in memory. ok try .9

N8BrB commented 1 year ago

So the exception is gone in the logging, but Homekit is still acting the same. The status of the device hangs with the "Closing..." status (same as it did in .8). On Homebridge restart, the device in Homekit is also no longer stating the current state on startup, but shows "Closing...".

Here are the debug logs from .9, if it helps...

Lutron Pico Close button press:

[2/28/2023, 7:03:11 PM] [RadioRA2] ~DEVICE,57,4,3 [2/28/2023, 7:03:11 PM] [RadioRA2] ~DEVICE,57,4,4 [2/28/2023, 7:03:11 PM] [RadioRA2] ~OUTPUT,43,1,0.00 [2/28/2023, 7:03:11 PM] [RadioRA2] Accessory 'MB Front Window 1' closed [2/28/2023, 7:03:11 PM] [RadioRA2] ~OUTPUT,43,29,8 [2/28/2023, 7:03:11 PM] [RadioRA2] ~OUTPUT,43,30,1,0.00 [2/28/2023, 7:03:11 PM] [RadioRA2] ~OUTPUT,43,32,1,24016 [2/28/2023, 7:03:11 PM] [RadioRA2] Accessory 'MB Front Window 1' finished moving [2/28/2023, 7:03:35 PM] [RadioRA2] ~OUTPUT,43,32,2,0.00 [2/28/2023, 7:03:35 PM] [RadioRA2] Accessory 'MB Front Window 1' finished moving

Lutron Pico Open button press:

[2/28/2023, 7:05:04 PM] [RadioRA2] ~DEVICE,57,2,3 [2/28/2023, 7:05:04 PM] [RadioRA2] ~DEVICE,57,2,4 [2/28/2023, 7:05:04 PM] [RadioRA2] ~OUTPUT,43,1,100.00 [2/28/2023, 7:05:04 PM] [RadioRA2] Accessory 'MB Front Window 1' opened [2/28/2023, 7:05:04 PM] [RadioRA2] Accessory 'MB Front Window 1' set to 100.00% [2/28/2023, 7:05:04 PM] [RadioRA2] ~OUTPUT,43,29,8 [2/28/2023, 7:05:04 PM] [RadioRA2] ~OUTPUT,43,30,1,100.00 [2/28/2023, 7:05:04 PM] [RadioRA2] ~OUTPUT,43,32,0,24016 [2/28/2023, 7:05:04 PM] [RadioRA2] Accessory 'MB Front Window 1' finished moving [2/28/2023, 7:05:28 PM] [RadioRA2] ~OUTPUT,43,32,2,100.00 [2/28/2023, 7:05:28 PM] [RadioRA2] Accessory 'MB Front Window 1' finished moving

N8BrB commented 1 year ago

I just turned off debug and restarted Homebridge, the device now shows "Opening..." in Homekit and is hanging. Something is out of sync

senorshaun commented 1 year ago

maybe it will work with .10?

N8BrB commented 1 year ago

Thanks for taking another look. I think you almost have it. Here is the debug for the Lutron Pico Close button press:

[3/1/2023, 12:39:02 AM] [RadioRA2] ~DEVICE,57,4,3 [3/1/2023, 12:39:02 AM] [RadioRA2] ~DEVICE,57,4,4 [3/1/2023, 12:39:02 AM] [RadioRA2] ~OUTPUT,43,1,0.00 [3/1/2023, 12:39:02 AM] [RadioRA2] Accessory 'MB Front Window 1' closed [3/1/2023, 12:39:02 AM] [RadioRA2] ~OUTPUT,43,29,8 [3/1/2023, 12:39:02 AM] [RadioRA2] ~OUTPUT,43,30,1,0.00 [3/1/2023, 12:39:02 AM] [RadioRA2] ~OUTPUT,43,32,1,4414 [3/1/2023, 12:39:02 AM] [RadioRA2] Accessory 'MB Front Window 1' moving down [3/1/2023, 12:39:06 AM] [RadioRA2] ~OUTPUT,43,32,2,0.00 [3/1/2023, 12:39:06 AM] [RadioRA2] Accessory 'MB Front Window 1' finished moving

It's just getting a single "finished moving" now! Same as off:

[3/1/2023, 12:41:35 AM] [RadioRA2] ~DEVICE,57,2,3 [3/1/2023, 12:41:35 AM] [RadioRA2] ~DEVICE,57,2,4 [3/1/2023, 12:41:35 AM] [RadioRA2] ~OUTPUT,43,1,100.00 [3/1/2023, 12:41:35 AM] [RadioRA2] Accessory 'MB Front Window 1' opened [3/1/2023, 12:41:35 AM] [RadioRA2] Accessory 'MB Front Window 1' set to 100.00% [3/1/2023, 12:41:35 AM] [RadioRA2] ~OUTPUT,43,29,8 [3/1/2023, 12:41:35 AM] [RadioRA2] ~OUTPUT,43,30,1,100.00 [3/1/2023, 12:41:35 AM] [RadioRA2] ~OUTPUT,43,32,0,24016 [3/1/2023, 12:41:35 AM] [RadioRA2] Accessory 'MB Front Window 1' moving up [3/1/2023, 12:41:59 AM] [RadioRA2] ~OUTPUT,43,32,2,100.00 [3/1/2023, 12:41:59 AM] [RadioRA2] Accessory 'MB Front Window 1' finished moving

N8BrB commented 1 year ago

There's just one odd behavior, its on close command. Homekit will not switch from "Closing..." to "Closed". Homebridge UI will go from "Closing..." to "% Open". Neither will go to "Closed". In Homebridge UI, the Target will state 0%, but the % Open will have a value, but the slider will be at 0. Weird..

Open command will go from "Opening..." to "Open" in both Homekit and Homebridge. If adjusting position, both will switch between "Closing..." and "Opening..." to "% Open". So it works in all these situations, just not "Closed". Any thoughts?

N8BrB commented 1 year ago

IMG_0059 IMG_0060 IMG_0061

N8BrB commented 1 year ago

The % Open in Homebridge UI seems to vary on each close.

senorshaun commented 1 year ago

Hmm maybe. Try .11 when you get a chance

N8BrB commented 1 year ago

Nice work, nailed it! Everything seems working. I tested the following:

Both HomeKit and Homebridge UI accurately update the status from Open, Opening..., % Open, Closing..., Closed. There are also no exceptions being reporting in the Homebridge log. Excellent! Thanks for spending all the time on this to get it to where it's at!

senorshaun commented 1 year ago

Update to .15 when you get a chance and make sure it's still working as expected. I did some code clean up

senorshaun commented 1 year ago

fixed in v1.7.0 which is live

N8BrB commented 1 year ago

Just loaded .15 and the status in HomeKit and Homebridge seem to be accurate, but there seems to be an issue controlling the shade from HomeKit. It doesn’t seem to control it.

N8BrB commented 1 year ago

So just came back to it and tried it again, Homekit controlled the shade now. So I adjusted the shade with a pico remote, then tried again with Homekit and it didn't work. I'm getting some serious lag with the Pico remote too. This wasn't occurring before. Wondering if it is something with the telnet connection or Lutron Repeater. Let me try to restart some things

N8BrB commented 1 year ago

Before restarting, I decided to turn on debug for the plugin.... I'm getting a heavy repeating occurrence (every second) of the following:

[3/2/2023, 5:06:43 PM] [RadioRA2] Unexpected HVAC response '~HVAC,49,19,23.3,1.1,1.1' [3/2/2023, 5:06:43 PM] [RadioRA2] Unexpected HVAC response '~HVAC,49,2,72,75 ' [3/2/2023, 5:06:43 PM] [RadioRA2] [Honeywell Thermostat] Heating setpoint - 22.2 [3/2/2023, 5:06:43 PM] [RadioRA2] [Honeywell Thermostat] Cooling setpoint - 23.9 [3/2/2023, 5:06:43 PM] [RadioRA2] Unexpected HVAC response '~HVAC,49,18,74,2,2 ' [3/2/2023, 5:06:43 PM] [RadioRA2] Unexpected HVAC response '~HVAC,49,19,23.3,1.1,1.1' [3/2/2023, 5:06:44 PM] [RadioRA2] Unexpected HVAC response '~HVAC,49,2,72.0,75.6 ' [3/2/2023, 5:06:44 PM] [RadioRA2] [Honeywell Thermostat] Heating setpoint - 22.2 [3/2/2023, 5:06:44 PM] [RadioRA2] [Honeywell Thermostat] Cooling setpoint - 24.2 [3/2/2023, 5:06:44 PM] [RadioRA2] Unexpected HVAC response '~HVAC,49,18,74,2,2

N8BrB commented 1 year ago

updated to 1.7 and no longer getting the above error and the Pico remote lag is gone, but now getting an exception in debug for the window. The status in HomeKit is hanging on "Opening..." as a result:

[3/2/2023, 5:09:24 PM] [RadioRA2] [MB Front Window 1] Set to 100.00% [3/2/2023, 5:09:24 PM] [RadioRA2] [MB Front Window 1] Moving up [3/2/2023, 5:09:44 PM] [RadioRA2] [MB Front Window 1] Finished moving (node:130509) UnhandledPromiseRejectionWarning: TypeError: this.accessory.getService(...).sgetCharacteristic is not a function at WindowCovering. (/usr/lib/node_modules/homebridge-radiora2/lib/accessories/windowcovering.js:138:26) at RadioRa2.emit (events.js:400:28) at _processOutputResponse (/usr/lib/node_modules/homebridge-radiora2/lib/radiora2.js:286:24) at incomingData (/usr/lib/node_modules/homebridge-radiora2/lib/radiora2.js:125:45) at Socket. (/usr/lib/node_modules/homebridge-radiora2/lib/radiora2.js:27:92) at Socket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:293:12) at readableAddChunk (internal/streams/readable.js:267:9) at Socket.Readable.push (internal/streams/readable.js:206:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) (node:130509) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)

senorshaun commented 1 year ago

v1.7.1 Sorry about that

N8BrB commented 1 year ago

1.7.1 ironed it all out! All is good! Thx 🙂

senorshaun commented 1 year ago

Could you please update to 1.7.1-beta.1 and verify you are still working properly? I had to make a change to the fade control for dimmers and I want to make sure shade control is still working

N8BrB commented 1 year ago

Loaded 1.7.1-bet.1 and all seems to be ok.