Description
Description
The implementation for the "Tuya magic spell" is currently implemented in EnchantedDevice
like this:
zha-device-handlers/zhaquirks/tuya/mcu/__init__.py
Lines 666 to 678 in eed839c
Starting to read attribute reads from
__init__
isn't ideal, as this theoretically happens every time as ZHA reloads, but those attribute reads seemingly do not actually make it to the network.We also can't really "re-cast" the magic spell (from a reconfiguration for example).
It would be best if this implementation could be improved. One possibility might be to call it from a bind()
function from some cluster (that's registered as a channel in ZHA, so the function actually gets called). This makes sure it's called "from a proper place" and also re-casts the device when doing a reconfiguration.
Maybe something like a BasicTuyaSpell
cluster that casts then spell would work?
Edit: See discussion: #1427
Apparently bind()
is not called on the Basic cluster (disabled here).
Some comments from #2227 include more information on this.
I'll try to look into this soon-ish.