Tuya Door Sensor cannot be added to integration as it's always Offline

Hi guys!
I have a very strange door sensor, it’s actually Hama 176553 and after it has detected a change in the status (open\close) it very quickly goes offline. That’s ok because I want HA automation to only react to the opening event but unfortunatelly this device is marked as unsupported in HA devices list.
I tried connecting localTuya, but the fact that it is not keeping an active connection (I can’t even see this device in the device list on my router) it’s hard even to detect its IP. I added a DHCP rule to give this device the same IP every time but even so LocalTuya can’t connect.

Despite all that TUya automations when device detects opening works very well. I can even see device’s logs in tuya cloud and the’re definetelly some internet connection happening and server is aware of the status updates. So is there any way fo me to build a HA automation based on this device status change?

:thinking:

  - platform: ping
    host: 192.168.68.123 # IP Door sensor
    name: "Door sensor"
    count: 1
    scan_interval: 10

Well, yeah, this kinda works but it can obly detect when the door sensor is online so there’s no way of telling whether it was opened or closed. Also there’s a chance of missing the sensor ping.
So I ended up with a simpler solution: up in the Tuya Dev Cloud I created a virtual socket plug and added it to Tuya app. Then just created two automation that every time the door opens this socket turns on and vice versa. Now I can build routines on top of the state of that virtual switch in HA

3 Likes

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 :expressionless:

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