NorthernMan54 / homebridge-alexa

Expose your homebridge controlled devices to Amazon Alexa.
https://www.homebridge.ca
446 stars 77 forks source link

Blinds opening not working since 1.3.x updates (RangeController device) #434

Closed chriskmn closed 3 years ago

chriskmn commented 3 years ago

Hi together,

since I've updated homebridge from 1.2.5 to any 1.3.x version, Alexa plugin is giving the following error on the command "open blinds":

[Alexa] RangeController SetRangeValue CC:22:3D:E3:CE:30 { characteristics: [ { aid: 213, iid: 12, status: -70410 } ] } { characteristics: [ { aid: 213, iid: 12, value: 100 } ] } null

Command "close" is working fine:

[Alexa] RangeController SetRangeValue CC:22:3D:E3:CE:30 undefined { characteristics: [ { aid: 213, iid: 22, value: 0 } ] } null

I suppose that it is linked with the homebridge mapping "CurrentPosition" and "TargetPosition". I have to limit my roller actors to maxValue=99. On the homekit app this is working fine. But Alexa doesn't seem to take over the 99. Is seems to still using the 100 as the maximum value what in my opinion leads to the error message.

When I'm using the alexa app and do open the blinds manually to a value of 99% it is working. But putting the slider to 100 it is also failing - same as the voice command.

99%: [Alexa] RangeController SetRangeValue CC:22:3D:E3:CE:30 undefined { characteristics: [ { aid: 213, iid: 22, value: 99 } ] } null

100%: [Alexa] RangeController SetRangeValue CC:22:3D:E3:CE:30 { characteristics: [ { aid: 213, iid: 22, status: -70410 } ] } { characteristics: [ { aid: 213, iid: 22, value: 100 } ] } null

So is this a problem of the alexa-plugin or is it a problem of the homebridge module ?

Has anyone else the same problem ?


This is the according homebridge mapping from my FHEM instance:

clear CurrentPosition=position,minValue=0,maxValue=99,minStep=1 TargetPosition=dim::position,minValue=0,maxValue=99,minStep=1

and this is the logging of the "open" command from the homekit app:

[FHEM] Rolladen_BUE: executing set cmd for TargetPosition with value 99 [FHEM] executing: https://192.168.0.180:8085/fhem?cmd=set%20Rolladen_BUE%20dim%2099 fwcsrf=csrf_322883797878293&XHR=12021-03-17 13:34:29 [FHEM] caching: Rolladen_BUE-position: 99 [FHEM] caching: CurrentPosition: 99 (as number; from '99') [FHEM] caching: TargetPosition: 99 (as number; from '99')

as you can see homekit (-> homebridge instance) is handling the maxValue correct and limiting to 99%. Alexa doesn't.

Node.js Version | v14.16.0 NPM Version v7.6.3 homebridge-alexa v0.5.32 homebridge v1.3.4

chriskmn commented 3 years ago

And I have the same problem with another zwave device (a dimmer) that has to be limited to a maxValue of 99%

[FHEM] ZW_stehlampe_wz: executing set cmd for On with value true [FHEM] executing: https://192.168.0.180:8085/fhem?cmd=set%20ZW_stehlampe_wz%20on&fwcsrf=csrf_322883797878293&XHR=1 [Alexa] PowerLevelController SetPowerLevel CC:22:3D:E3:CE:30 { characteristics: [ { aid: 257, iid: 11, status: -70410 }, { aid: 257, iid: 10, status: 0 } ] } { characteristics: [ { aid: 257, iid: 11, value: 100 }, { aid: 257, iid: 10, value: 1 } ]} null 2021-03-17 13:45:26 caching: ZW_stehlampe_wz-state: on

the homebridgemapping is: clear Brightness=brightness,cmd=dim,minValue=0,maxValue=99,minStep=2 On=state,valueOff=off,cmdOn=on,cmdOff=off

So in my opinion it is definetly a problem with the limits handled between FHEM-plugin, Alexa-Plugin and Homebridge where Alexa Plugin seems to cause the problem (but it is related to homebridge 1.3x and not to 1.2.5) ?!

NorthernMan54 commented 3 years ago

The value of 100 is hard coded here

https://github.com/NorthernMan54/homebridge-alexa/blob/581844c507db035dbe62be62103f6f4bf1f7ec59/lib/parse/Characteristic.js#L195

If you can share an accessory dump, I may be able to tweak this logic and pick up the 99 ( if it's available in the accessory dump ). Details on collecting an accessory dump are in the README

chriskmn commented 3 years ago

Ok I‘ll try to get a dump and post it here

BUT it always worked fine with the homebridge versions up to 1.2.5. So something must have been changed that made the difference.....

NorthernMan54 commented 3 years ago

Version 1.3.0 or higher versions of homebridge are now validating inputs for valid values and is rejecting the 100, when before it would have passed it thru...

chriskmn commented 3 years ago

this is the dump:

dump.txt

NorthernMan54 commented 3 years ago

Tks @chriskmn looked at the dump and see this

        "type": "7C",
        "iid": 12,
        "value": 99,
        "perms": ["ev", "pr", "pw"],
        "description": "Target Position",
        "format": "uint8",
        "unit": "percentage",
        "minValue": 0,
        "maxValue": 99,
        "minStep": 1

"maxValue": 99

So the value is available, now can I get it into Alexa.....

NorthernMan54 commented 3 years ago

@chriskmn It was a simple change, can you update to the latest and let me know. I don't have blinds so I can't test

NorthernMan54 commented 3 years ago

You will need to ask Alexa to discover devices to have her pick up the change

chriskmn commented 3 years ago

Thanks for the very fast fix 👍 but unfortunately the problem still exists. I‘ve upgraded the plugin, restarted homebridge, deleted the device in Alexa and rediscovered but still the same behaviour. Value 100 sent and status -70410 :(

[Alexa] RangeController SetRangeValue CC:22:3D:E3:CE:30 { characteristics: [ { aid: 213, iid: 12, status: -70410 } ] } { characteristics: [ { aid: 213, iid: 12, value: 100 } ] } null

NorthernMan54 commented 3 years ago

Try the latest update, I think I got it this time

chriskmn commented 3 years ago

still the same. Update, restart, deleted in alexa and rediscover.

[Alexa] RangeController SetRangeValue CC:22:3D:E3:CE:30 { characteristics: [ { aid: 277, iid: 12, status: -70410 } ] } { characteristics: [ { aid: 277, iid: 12, value: 100 } ] } null

NorthernMan54 commented 3 years ago

@chriskmn can you ping me on the homebridge discord server in about 3 hours? Want to look at the server logs when you are testing.

chriskmn commented 3 years ago

If you tell me how I can do that :-)

NorthernMan54 commented 3 years ago

I’m on the homebridge-Alexa channel

https://github.com/homebridge/homebridge#community

chriskmn commented 3 years ago

Just to complete it: it is working now

[Alexa] RangeController SetRangeValue CC:22:3D:E3:CE:30 undefined { characteristics: [ { aid: 112, iid: 11, value: 99 } ] } null

Thanks a lot for your work, NorthernMan !