zwave-js-ui icon indicating copy to clipboard operation
zwave-js-ui copied to clipboard

MQTT: currentValue of slow switch_multilevel jumps to target value before reporting real values

Open zargony opened this issue 1 year ago • 2 comments

Checklist

  • [X] I am not using Home Assistant. Or: a developer has told me to come here.
  • [X] I have checked the troubleshooting section and my problem is not described there.
  • [X] I have read the changelog and my problem is not mentioned there.

Deploy method

Docker

Z-Wave JS UI version

9.14.4.40080a1

ZwaveJS version

12.12.1

Describe the bug

When setting targetValue of a device with switch_multilevel command class, currentValue is set to target value even before the device reports an updated real current value. I observe this behavior with (relatively slow) window blinds (Fibaro Roller Shutter 2 FGRM-222). I assume that zwave-js-ui might set currentValue to targetValue to provide faster responses. While this works e.g. with lights, it gives strange effects with slowly moving devices like window blinds.

E.g. if currentValue is 99 and setting targetValue to 70, you can observe currentValue:

  • currentValue: 99
  • set targetValue to 70
  • (with no visible delay) currentValue: 70
  • (~5s delay) currentValue: 84
  • (~5s delay) currentValue: 70

This causes strange effects when software tries to derive the direction of movement by looking at currentValue, e.g. when using MQTT values to feed Node-RED's HomeKit integration with a window blind position, it sees currentValue changing from 70 to 84 and shows an opening animation even though the blinds are closing.

zwave-js-ui log (unrelated lines about http requests, lastActive and power level reporting stripped):

2024-07-02 11:16:38.275 INFO MQTT: Message received on zwave/rollo_buero/switch_multilevel/endpoint_0/targetValue/set: '70'
2024-07-02 11:16:38.278 INFO Z-WAVE: Writing 70 to 4-38-0-targetValue
2024-07-02 11:16:38.386 INFO Z-WAVE: [Node 004] Value updated: 38-0-targetValue 99 => 70
2024-07-02 11:16:38.382 DEBUG MQTT: Publishing to zwave/rollo_buero/switch_multilevel/endpoint_0/targetValue: { time: 1684293578956, value: 70 } with options { qos: 1, retain: true }
2024-07-02 11:16:38.393 DEBUG MQTT: Publishing to zwave/rollo_buero/switch_multilevel/endpoint_0/currentValue: { time: 1719911798390, value: 70 } with options { qos: 1, retain: true }
2024-07-02 11:16:38.396 INFO Z-WAVE: [Node 004] Value updated: 38-0-currentValue 99 => 70
2024-07-02 11:16:43.513 DEBUG MQTT: Publishing to zwave/rollo_buero/switch_multilevel/endpoint_0/currentValue: { time: 1719911803510, value: 84 } with options { qos: 1, retain: true }
2024-07-02 11:16:43.516 INFO Z-WAVE: [Node 004] Value updated: 38-0-currentValue 70 => 84
2024-07-02 11:16:50.987 DEBUG MQTT: Publishing to zwave/rollo_buero/switch_multilevel/endpoint_0/currentValue: { time: 1719911810983, value: 70 } with options { qos: 1, retain: true }
2024-07-02 11:16:50.991 INFO Z-WAVE: [Node 004] Value updated: 38-0-currentValue 84 => 70

Actually, this log looks like the device is reporting 99=>70, so I'm unsure about the root cause. I initially suspected zwave-js-ui to do this (because why should a device report an estimated value while it knows the real current value).

To Reproduce

  • Using an mqtt client, locate and watch currentValue of a slowly moving device with switch_multilevel command class
  • Set a new targetValue via MQTT or web ui
  • Watch currentValue jump to the new target value immediately, then jumping back to the real current value while the device keeps reporting the current position until the target position is reached.

Expected behavior

I'd expect the currentValue to report the current value only, not the expected target value.

Additional context

I'm using Settings -> Gateway (probably unrelated to the issue, but explains the log):

  • Topic type: Named topics
  • Payload type: JSON Time-Value
  • Ignore Location: on

zargony avatar Jul 02 '24 11:07 zargony