andreypopov / node-red-contrib-zigbee2mqtt

Zigbee2mqtt connectivity nodes for node-red
GNU General Public License v3.0
92 stars 24 forks source link

Commit to 2.3.1 breaks IKEA roller blinds. #89

Closed paulz-gh closed 2 years ago

paulz-gh commented 2 years ago

Hi it looks like the IKEA roller blinds no longer are recognized as WindowCovering. They only report 'position' and not the other attributes the new code looks for.

Paul

andreypopov commented 2 years ago

yeah, I am working, right now, with aqara curtain, WindowCovering works so bad in z2m( Can you post payload_raw here?

andreypopov commented 2 years ago

yeah...data format was changed in z2m, I will try to fix properties today

andreypopov commented 2 years ago

try + node-red-contrib-zigbee2mqtt@2.3.2

paulz-gh commented 2 years ago

Hi If I look at the 2.3.2 code there’s no support for device that just reports position. In z2m the IKEA blinds only show this:

"battery": 94,
"last_seen": 1656392464483,
"linkquality": 87,
"position": 0,
"update": {
    "state": "idle"
},
"update_available": false

}

Regards,

Paul

andreypopov commented 2 years ago

yes, I have two different curtain motors and they are reporting different data, one with running, other with motor_state.. so strange..

paulz-gh commented 2 years ago

Hi just added a debug node to the output of one of my blinds and this the last output from when I opened it, maybe this helps, this is on 2.2.5 of your module :

Jun 28 20:21:19 pi4 Node-RED[19556]: 28 Jun 20:21:19 - [info] [debug:BRrechts]
Jun 28 20:21:19 pi4 Node-RED[19556]: {
Jun 28 20:21:19 pi4 Node-RED[19556]:   topic: 'zigbee2mqtt/BRechts',
Jun 28 20:21:19 pi4 Node-RED[19556]:   changed: {
Jun 28 20:21:19 pi4 Node-RED[19556]:     old: { CurrentPosition: 99, TargetPosition: 99, PositionState: 2 },
Jun 28 20:21:19 pi4 Node-RED[19556]:     new: { CurrentPosition: 100, TargetPosition: 100, PositionState: 2 }
Jun 28 20:21:19 pi4 Node-RED[19556]:   },
Jun 28 20:21:19 pi4 Node-RED[19556]:   payload: { CurrentPosition: 100, TargetPosition: 100, PositionState: 2 },
Jun 28 20:21:19 pi4 Node-RED[19556]:   payload_raw: {
Jun 28 20:21:19 pi4 Node-RED[19556]:     battery: 94,
Jun 28 20:21:19 pi4 Node-RED[19556]:     last_seen: 1656440479942,
Jun 28 20:21:19 pi4 Node-RED[19556]:     linkquality: 76,
Jun 28 20:21:19 pi4 Node-RED[19556]:     position: 100,
Jun 28 20:21:19 pi4 Node-RED[19556]:     update: { state: 'idle' },
Jun 28 20:21:19 pi4 Node-RED[19556]:     update_available: false
Jun 28 20:21:19 pi4 Node-RED[19556]:   },
Jun 28 20:21:19 pi4 Node-RED[19556]:   homekit: {
Jun 28 20:21:19 pi4 Node-RED[19556]:     Door: { CurrentPosition: 100, TargetPosition: 100, PositionState: 2 },
Jun 28 20:21:19 pi4 Node-RED[19556]:     WindowCovering: { CurrentPosition: 100, TargetPosition: 100, PositionState: 2 },
Jun 28 20:21:19 pi4 Node-RED[19556]:     Window: { CurrentPosition: 100, TargetPosition: 100, PositionState: 2 },
Jun 28 20:21:19 pi4 Node-RED[19556]:     Battery: { BatteryLevel: 94, StatusLowBattery: 0 }
Jun 28 20:21:19 pi4 Node-RED[19556]:   },
Jun 28 20:21:19 pi4 Node-RED[19556]:   format: {},
Jun 28 20:21:19 pi4 Node-RED[19556]:   selector: 'zigbee2mqtt_BRechts',
Jun 28 20:21:19 pi4 Node-RED[19556]:   item: {
Jun 28 20:21:19 pi4 Node-RED[19556]:     date_code: '20190311',
Jun 28 20:21:19 pi4 Node-RED[19556]:     definition: {
Jun 28 20:21:19 pi4 Node-RED[19556]:       description: 'FYRTUR roller blind',
Jun 28 20:21:19 pi4 Node-RED[19556]:       exposes: [
Jun 28 20:21:19 pi4 Node-RED[19556]:         {
Jun 28 20:21:19 pi4 Node-RED[19556]:           features: [
Jun 28 20:21:19 pi4 Node-RED[19556]:             {
Jun 28 20:21:19 pi4 Node-RED[19556]:               access: 3,
Jun 28 20:21:19 pi4 Node-RED[19556]:               name: 'state',
Jun 28 20:21:19 pi4 Node-RED[19556]:               property: 'state',
Jun 28 20:21:19 pi4 Node-RED[19556]:               type: 'enum',
Jun 28 20:21:19 pi4 Node-RED[19556]:               values: [ 'OPEN', 'CLOSE', 'STOP' ]
Jun 28 20:21:19 pi4 Node-RED[19556]:             },
Jun 28 20:21:19 pi4 Node-RED[19556]:             {
Jun 28 20:21:19 pi4 Node-RED[19556]:               access: 7,
Jun 28 20:21:19 pi4 Node-RED[19556]:               description: 'Position of this cover',
Jun 28 20:21:19 pi4 Node-RED[19556]:               name: 'position',
Jun 28 20:21:19 pi4 Node-RED[19556]:               property: 'position',
Jun 28 20:21:19 pi4 Node-RED[19556]:               type: 'numeric',
Jun 28 20:21:19 pi4 Node-RED[19556]:               value_max: 100,
Jun 28 20:21:19 pi4 Node-RED[19556]:               value_min: 0
Jun 28 20:21:19 pi4 Node-RED[19556]:             }
Jun 28 20:21:19 pi4 Node-RED[19556]:           ],
Jun 28 20:21:19 pi4 Node-RED[19556]:           type: 'cover'
Jun 28 20:21:19 pi4 Node-RED[19556]:         },
Jun 28 20:21:19 pi4 Node-RED[19556]:         {
Jun 28 20:21:19 pi4 Node-RED[19556]:           access: 1,
Jun 28 20:21:19 pi4 Node-RED[19556]:           description: 'Remaining battery in %',
Jun 28 20:21:19 pi4 Node-RED[19556]:           name: 'battery',
Jun 28 20:21:19 pi4 Node-RED[19556]:           property: 'battery',
Jun 28 20:21:19 pi4 Node-RED[19556]:           type: 'numeric',
Jun 28 20:21:19 pi4 Node-RED[19556]:           unit: '%',
Jun 28 20:21:19 pi4 Node-RED[19556]:           value_max: 100,
Jun 28 20:21:19 pi4 Node-RED[19556]:           value_min: 0
Jun 28 20:21:19 pi4 Node-RED[19556]:         },
Jun 28 20:21:19 pi4 Node-RED[19556]:         {
Jun 28 20:21:19 pi4 Node-RED[19556]:           access: 1,
Jun 28 20:21:19 pi4 Node-RED[19556]:           description: 'Link quality (signal strength)',
Jun 28 20:21:19 pi4 Node-RED[19556]:           name: 'linkquality',
Jun 28 20:21:19 pi4 Node-RED[19556]:           property: 'linkquality',
Jun 28 20:21:19 pi4 Node-RED[19556]:           type: 'numeric',
Jun 28 20:21:19 pi4 Node-RED[19556]:           unit: 'lqi',
Jun 28 20:21:19 pi4 Node-RED[19556]:           value_max: 255,
Jun 28 20:21:19 pi4 Node-RED[19556]:           value_min: 0
Jun 28 20:21:19 pi4 Node-RED[19556]:         }
Jun 28 20:21:19 pi4 Node-RED[19556]:       ],
Jun 28 20:21:19 pi4 Node-RED[19556]:       model: 'E1757',
Jun 28 20:21:19 pi4 Node-RED[19556]:       options: [
Jun 28 20:21:19 pi4 Node-RED[19556]:         {
Jun 28 20:21:19 pi4 Node-RED[19556]:           access: 2,
Jun 28 20:21:19 pi4 Node-RED[19556]:           description: 'Inverts the cover position, false: open=100,close=0, true: open=0,close=100 (default false).',
Jun 28 20:21:19 pi4 Node-RED[19556]:           name: 'invert_cover',
Jun 28 20:21:19 pi4 Node-RED[19556]:           property: 'invert_cover',
Jun 28 20:21:19 pi4 Node-RED[19556]:           type: 'binary',
Jun 28 20:21:19 pi4 Node-RED[19556]:           value_off: false,
Jun 28 20:21:19 pi4 Node-RED[19556]:           value_on: true
Jun 28 20:21:19 pi4 Node-RED[19556]:         }
Jun 28 20:21:19 pi4 Node-RED[19556]:       ],
Jun 28 20:21:19 pi4 Node-RED[19556]:       supports_ota: true,
Jun 28 20:21:19 pi4 Node-RED[19556]:       vendor: 'IKEA'
Jun 28 20:21:19 pi4 Node-RED[19556]:     },
Jun 28 20:21:19 pi4 Node-RED[19556]:     endpoints: {
Jun 28 20:21:19 pi4 Node-RED[19556]:       '1': {
Jun 28 20:21:19 pi4 Node-RED[19556]:         bindings: [
Jun 28 20:21:19 pi4 Node-RED[19556]:           {
Jun 28 20:21:19 pi4 Node-RED[19556]:             cluster: 'genPowerCfg',
Jun 28 20:21:19 pi4 Node-RED[19556]:             target: {
Jun 28 20:21:19 pi4 Node-RED[19556]:               endpoint: 1,
Jun 28 20:21:19 pi4 Node-RED[19556]:               ieee_address: '0x00124b0021b77fa0',
Jun 28 20:21:19 pi4 Node-RED[19556]:               type: 'endpoint'
Jun 28 20:21:19 pi4 Node-RED[19556]:             }
Jun 28 20:21:19 pi4 Node-RED[19556]:           },
Jun 28 20:21:19 pi4 Node-RED[19556]:           {
Jun 28 20:21:19 pi4 Node-RED[19556]:             cluster: 'closuresWindowCovering',
Jun 28 20:21:19 pi4 Node-RED[19556]:             target: {
Jun 28 20:21:19 pi4 Node-RED[19556]:               endpoint: 1,
Jun 28 20:21:19 pi4 Node-RED[19556]:               ieee_address: '0x00124b0021b77fa0',
Jun 28 20:21:19 pi4 Node-RED[19556]:               type: 'endpoint'
Jun 28 20:21:19 pi4 Node-RED[19556]:             }
Jun 28 20:21:19 pi4 Node-RED[19556]:           }
Jun 28 20:21:19 pi4 Node-RED[19556]:         ],
Jun 28 20:21:19 pi4 Node-RED[19556]:         clusters: {
Jun 28 20:21:19 pi4 Node-RED[19556]:           input: [
Jun 28 20:21:19 pi4 Node-RED[19556]:             'genBasic',
Jun 28 20:21:19 pi4 Node-RED[19556]:             'genPowerCfg',
Jun 28 20:21:19 pi4 Node-RED[19556]:             'genIdentify',
Jun 28 20:21:19 pi4 Node-RED[19556]:             'genGroups',
Jun 28 20:21:19 pi4 Node-RED[19556]:             'genScenes',
Jun 28 20:21:19 pi4 Node-RED[19556]:             'genPollCtrl',
Jun 28 20:21:19 pi4 Node-RED[19556]:             'closuresWindowCovering',
Jun 28 20:21:19 pi4 Node-RED[19556]:             'touchlink'
Jun 28 20:21:19 pi4 Node-RED[19556]:           ],
Jun 28 20:21:19 pi4 Node-RED[19556]:           output: [ 'genOta', 'touchlink' ]
Jun 28 20:21:19 pi4 Node-RED[19556]:         },
Jun 28 20:21:19 pi4 Node-RED[19556]:         configured_reportings: [
Jun 28 20:21:19 pi4 Node-RED[19556]:           {
Jun 28 20:21:19 pi4 Node-RED[19556]:             attribute: 'batteryPercentageRemaining',
Jun 28 20:21:19 pi4 Node-RED[19556]:             cluster: 'genPowerCfg',
Jun 28 20:21:19 pi4 Node-RED[19556]:             maximum_report_interval: 62000,
Jun 28 20:21:19 pi4 Node-RED[19556]:             minimum_report_interval: 3600,
Jun 28 20:21:19 pi4 Node-RED[19556]:             reportable_change: 0
Jun 28 20:21:19 pi4 Node-RED[19556]:           },
Jun 28 20:21:19 pi4 Node-RED[19556]:           {
Jun 28 20:21:19 pi4 Node-RED[19556]:             attribute: 'currentPositionLiftPercentage',
Jun 28 20:21:19 pi4 Node-RED[19556]:             cluster: 'closuresWindowCovering',
Jun 28 20:21:19 pi4 Node-RED[19556]:             maximum_report_interval: 62000,
Jun 28 20:21:19 pi4 Node-RED[19556]:             minimum_report_interval: 1,
Jun 28 20:21:19 pi4 Node-RED[19556]:             reportable_change: 1
Jun 28 20:21:19 pi4 Node-RED[19556]:           }
Jun 28 20:21:19 pi4 Node-RED[19556]:         ],
Jun 28 20:21:19 pi4 Node-RED[19556]:         scenes: []
Jun 28 20:21:19 pi4 Node-RED[19556]:       }
Jun 28 20:21:19 pi4 Node-RED[19556]:     },
Jun 28 20:21:19 pi4 Node-RED[19556]:     friendly_name: 'BRechts',
Jun 28 20:21:19 pi4 Node-RED[19556]:     ieee_address: '0x680ae2fffe8f7a26',
Jun 28 20:21:19 pi4 Node-RED[19556]:     interview_completed: true,
Jun 28 20:21:19 pi4 Node-RED[19556]:     interviewing: false,
Jun 28 20:21:19 pi4 Node-RED[19556]:     manufacturer: 'IKEA of Sweden',
Jun 28 20:21:19 pi4 Node-RED[19556]:     model_id: 'FYRTUR block-out roller blind',
Jun 28 20:21:19 pi4 Node-RED[19556]:     network_address: 55415,
Jun 28 20:21:19 pi4 Node-RED[19556]:     power_source: 'Battery',
Jun 28 20:21:19 pi4 Node-RED[19556]:     software_build_id: '2.3.088',
Jun 28 20:21:20 pi4 Node-RED[19556]:     supported: true,
Jun 28 20:21:20 pi4 Node-RED[19556]:     type: 'EndDevice',
Jun 28 20:21:20 pi4 Node-RED[19556]:     current_values: {
Jun 28 20:21:20 pi4 Node-RED[19556]:       battery: 94,
Jun 28 20:21:20 pi4 Node-RED[19556]:       last_seen: 1656440479942,
Jun 28 20:21:20 pi4 Node-RED[19556]:       linkquality: 76,
Jun 28 20:21:20 pi4 Node-RED[19556]:       position: 100,
Jun 28 20:21:20 pi4 Node-RED[19556]:       update: { state: 'idle' },
Jun 28 20:21:20 pi4 Node-RED[19556]:       update_available: false
Jun 28 20:21:20 pi4 Node-RED[19556]:     },
Jun 28 20:21:20 pi4 Node-RED[19556]:     homekit: {
Jun 28 20:21:20 pi4 Node-RED[19556]:       Door: { CurrentPosition: 100, TargetPosition: 100, PositionState: 2 },
Jun 28 20:21:20 pi4 Node-RED[19556]:       WindowCovering: { CurrentPosition: 100, TargetPosition: 100, PositionState: 2 },
Jun 28 20:21:20 pi4 Node-RED[19556]:       Window: { CurrentPosition: 100, TargetPosition: 100, PositionState: 2 },
Jun 28 20:21:20 pi4 Node-RED[19556]:       Battery: { BatteryLevel: 94, StatusLowBattery: 0 }
Jun 28 20:21:20 pi4 Node-RED[19556]:     },
Jun 28 20:21:20 pi4 Node-RED[19556]:     format: {}
Jun 28 20:21:20 pi4 Node-RED[19556]:   },
Jun 28 20:21:20 pi4 Node-RED[19556]:   _msgid: '8cfb96a582d07f31'
Jun 28 20:21:20 pi4 Node-RED[19556]: }

While it was moving only the position seems to change:

Jun 28 20:21:15 pi4 Node-RED[19556]:     current_values: {
Jun 28 20:21:15 pi4 Node-RED[19556]:       battery: 94,
Jun 28 20:21:15 pi4 Node-RED[19556]:       last_seen: 1656440475793,
Jun 28 20:21:15 pi4 Node-RED[19556]:       linkquality: 72,
Jun 28 20:21:15 pi4 Node-RED[19556]:       position: 85,
Jun 28 20:21:15 pi4 Node-RED[19556]:       update: { state: 'idle' },
Jun 28 20:21:15 pi4 Node-RED[19556]:       update_available: false
Jun 28 20:21:15 pi4 Node-RED[19556]:     },
pjoomen commented 2 years ago

It seems this error was introduced in 2d0ad32, more specifically:

-        if ('position' in payload) {
+  } else if ('position' in payload && 'running' in payload) { //old??

introduces a change which is not compatible with the IKEA blinds, since they do not report running in the payload

andreypopov commented 2 years ago

1) position + motor_state (openning/closing/stopped) 2) position + running (we don't know openning or closing, just running) 3) position (the worse option, unknown status)

Please, test my fix, let me know

paulz-gh commented 2 years ago

Hi, Updated from 2.2.5 to 2.6.3 on Z2M 1.27 and NodeRed 2.2.2. The IKEA blinds seem to be working now.

Thanks, Paul

pjoomen commented 2 years ago

The IKEA blinds seem to be working now.

Also confirmed on Node-RED 3.0.2 and Zigbee2MQTT 1.27.0