Open anar4732 opened 1 year ago
I do not know of any good way of doing this, either via the cloud or locally. You might be able to either have your router trigger something on a DHCP request or have a python script listening for said DHCP broadcasts, however that will miss events if the door opens and then closes too fast.
If you don't care about using Tuya's app then loading a non-cloud firmware onto the device would be a better option.
Do you have a link for the door sensors you have?
Some time ago I implemented a solution for fire sensors which work the same way - they only go online on alarm. I tried every 15s an async connect request with a timeout of 15s. I couldn't test it myself but users reported that it worked.
Nice idea! Thank you!
https://github.com/fhempy/fhempy/blob/v0.1.491/FHEM/bindings/python/fhempy/lib/tuya/tuya.py#L400
Here is the code, I used pytuya in that case.
Well here's an idea I just had. What if you took an extra smart plug, configured scene linkage/automation to turn it on when the door opens and turn it off when the door closes, and had tinytuya monitor the socket status? Would that work? I guess I'll find out tomorrow when my door sensors get here.
And I totally forgot to post an update with my results. It... kinda/sorta works. The biggest issue is the door sensor does not always report immediately, more than 1 open/close action causes it to queue up the events and report them all at once after about a minute. Also, if the door is open for less than 1 second the smart plug reports 2 off events instead of the expected on+off. Beyond that it actually works pretty well.
I want to do something instantly when the door opens. so the idea of checking the status every minute not works. Since the device disconnects from the network on sleep mode I think should do something with the cloud.