Does these actually still works ? , i’ve been struggling with the same issue , seems sometime when it seems in deep-sleep , it doesn’t get registered when the door is being opened , because the device is offline unavailable , and the device goes into deep-sleep again without register the change i.e door ( is-open ) , seems like it only records a state-change , when / if it wakes up to late it’s doesn’t register anything
If your still in luck , could you provide a description, of your solution , as i have tried with Ping , Automation , template-sensor which registered state , when a state change occurred.
PS I did look into iot.tuya to see if one could pull current state , as it seems tuya-smart app register correctly , also reflected in iot.tyua device-state request , but seems like there is no means of pull , i did copy the curl and get commands , but not sure i can use these , maybe in a command-line sensor , but then i guess it’s iot.tuya i have to request , and not the device , as it’s sleeping
Edit:
Seems like the Virtual-Plug works the same as a template-sensor,
i.e when the door opens, sensor state change to ( open ) …and visa versa
Problem is, the Door-Sensor goes to sleep, in seconds (after about 15 seconds), and Template-Sensor stay ( Open ) … However when someone close the door, while Device is vanished ( unavailable ) from The Router, there is no contact to HA as Device is unavailable
Seems like the signal (Push) ( Door Closed ) then goes to the App and iot.tuya , and register new state ( In App and ito.tuya) but if , when the device wakes up , the Push is not send to HA, and Device will still be Unavailable in HA , as the Device is not Pushing Current state , and the Push-Notification ( Door Closed ) is long gone
So i end up with a Closed Door, which in Template / Virtual Device is in state Open, and orig-device is in stat Unavailable
And if HA manage to get contact with the Device