Local tuya contact sensor

Just out of interest… If those devices go to sleep, what’s the delay when it triggers? It needs to first make wifi contact?

I have now ZigBee door contact, no delay at all…

Also that automation, to keep it online, that probably have effect on battery

How you managed to get the sensors working ? Kindly guide.

The delay is between 5 and 7 seconds when it is in sleep mode. I guess it is because of the wifi connection that needs to be established. If it is “awake” it has no delay (for example, when I open/close the door multiple times, the delay is only present on the first time).


Lately I get close to no response on HA from the Tuya cloud integration. In the image, you can see the same sensor integrated via the cloud integration above and local tuya below. This was a test for one sensor, but I have 8 of them. I guess I’ll have to switch to the local integration on all of them and set up the automations and input booleans as suggested above if I don’t want to buy new zigbee sensors. Hopefully, Tuya will fix this but apparently they don’t have a lot of interest in HA users

1 Like

I have replaced the tuya sensors with zigbee sensors lately where the reaction time matters. I have put those tuya wifi sensors to windows or my fridge where i just want to know the current state without time critical actions on it.
I found zigbee is much more reliable and also you have the battery state in home assistant.

1 Like

It ruled for me, thank you very much from Spain.

Thanks Draganis for your help, also your zigbee experience, I start to use only two wifi sensors, then I thinking/try zigbee devices, just I need gateway for that.

An update if anyone else comes across this. @Draganis 's fix doesn’t seem to be needed any more.
You do still need to keep the sensor awake whilst adding it, when you do there’s an option to Show As and if you select Door then you get a new entity that works as you’d expect. Of course there is still a small delay while the sensor connects to the wifi.
image

Thanks all!

Hi ALL,
I have just bought and got Tuya water leak sensors and I had some problems to configure them with localtuya in HA. I’m glad, that I have found this topic - now it’s easier :slight_smile:
I have added water leak sensors as SENSOR (not binary sensor) and everything works perfect.
I have also electric water valve which closing water when water leak sensor detects a water.
In HA you have to use attributes in automations like below

- id: '1703924301452'
  alias: Łazienka zalanie
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.czujnik_zalania_lazienka
    attribute: raw_state
    to: alarm
  condition: []
  action:
  - device_id: xxxx
    domain: cover
    entity_id: xxxx
    type: close
  - service: notify.notify
    data:
      message: Zalanie łazienka
  mode: single

Hi, for me this is not working as of today.
Added the sensor as binary + door sensor. Sensor entity always shows unavailable after some seconds

Tried out the Local Tuya integration just now with 2 Window sensors.
Eventually I was able to add them both to HA. I used the manual approach to add the devices to Local Tuya. In my router I could see the IP of the connected sensor, in the app I could find the device id and via the Tuya Cloud Api Explorer I was able to get the Local Key’s for both devices.
Once all filled in, the devices were added.

However, the status updates did not work great at all. Probably due to that these devices are only online briefly when to contact is broken or created.
The mobile app was able to get notification each time, but HA rarely. This obviously does not work since I want to know the correct status of the windows always.

So, I removed the Local Tuya integration and opted for the ‘normal’ Tuya integration which requires HA to connect to Tuya cloud with the user account in the app.
Installation was easy and fast and now the status of the devices is reliable.
Not ideal since I would prefer to have a cloud-less solution, but that obviously does not work with these devices. Something to keep in mind for the next devices I’ll buy.