How to clear value from the device state #19810
grafalex82
started this conversation in
Devices
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am debugging messages my device to the coordinator and would like them to be stored in the device state. I added the following converter code:
`
const fromZigbee_LevelCtrl = {
cluster: 'genLevelCtrl',
type: ['commandMoveToLevel', 'commandMoveToLevelWithOnOff', 'commandMove', 'commandMoveWithOnOff',
'commandStop', 'commandStopWithOnOff', 'commandStep', 'commandStepWithOnOff'],
}
`
The goal here is just to catch all LevelCtrl messages and store them in the device state. This approach basically works, but one thing is working strange.
Imagine it receives a command with payload. The state gets the correct value
"level_ctrl":{"command":"commandMove","payload":{"movemode":1,"rate":80}}
Then it receives a command without payload, and the code above returns
{"level_ctrl":{"command":"commandStop","payload":{}}}
But in the device state the old payload still exists:
MQTT publish: topic 'zigbee2mqtt/my_test_switch' .... "level_ctrl":{"command":"commandStop","payload":{"movemode":1,"rate":80}}...
Is there a way to clear the payload field?
Beta Was this translation helpful? Give feedback.
All reactions