how this should be translated to Lua
For Groovy, it’s a different way of using the state
variable (persistent storage), like this:
state.onOff = "catchall"
In Edge, persistent storage is done with device:set_field
and device:get_field()
.
Eg.
device:set_field("onOff", "catchall")
as you can see there is no “get_field” in the code,
so I assume there is hidden magic behind that, will the magic work the same in Edge.
If you just want to make an Edge Driver for Zigbee Multi Switch, you don’t need this in the code.
it’s for multi-switch. and it looks like it set special flag inside the DTH.
just like
preferences:
- preferenceId: tempOffset
explicit: true
Ok, I double-checked with the engineering team and this used to be a workaround in the Legacy platform (Groovy) to define how the messages were sent.
In Edge drivers, you don’t need to apply this workaround, so you can omit this function.