I have a wifi door sensor that is configured in tuya integration. But it’s not getting auto detected by local tuya integration and I am not able to integrate it manually via local tuya as well.
Please guide me, how can I integrate in local tuya integration.
I managed to integrate the sensor locally. The problem I noticed is that the sensor only establishes a wireless connection when there is a contact change. After about 10 seconds it can no longer be pinged. You have to press the add button at the moment when it is pingable. It is best to switch contacts back and forth briefly. Unfortunately, the sensor is then displayed as offline after a short time. And it doesn’t always seem enough that he creates a change in the homa Assistant.
I installed the localtuya plugin via the HACS and then got the data from the TUYA API key, ID. Then you also need the IP address of the sensor in your local network.
I’m new to Homa Assistant. If you can tell me how I can get the yaml data from the plugin, I’m sure I can help you further.
I have installed hacs and added local tuya. Also I have the api key, id and ip of the sensor. But I am not able to add the sensor to local tuya and the sensor goes offline very quickly within a second. So how have you added to local tuya. Please guide.
I managed to get localtuya to discover the door sensors. It works like this:
clear your browser cache
Keep opening and closing the window/door constantly for the rest of the process (i will tell you when to stop)
Reload the Home Assistant page and navigate to the localtuya Integration.
Click Configure and add device. If you are still opening and closing your window/door your sensor will be visible there and can be selected
If you are using the cloud api, all data like local key will be filled in. If not, fill them in (you can pause while filling in, but before clicking add, you have to continue opening and closing the window/door)
Click add and select “binary sensor” as device type.
You can stop now opening and closing the window.
You can select now if you have a door or window and give your sensor a name
Now you should be able to select an entity card type and thats it.
I open and close se tensor every 3 - 5 Seconds because only in this time the season connect to your clan and is available. The connection must be enabled when the sensor have wlan.
But connect a tuna contact sensor via local tuna ist not good. The sensor is offline every time because when the sensor have nothing to do he has no active plan so home assistant shows the sensor as offline.
Yes it triggers if I do it very slowly… by doing slowly it almost impossible to add it via local tuya. It seems my only option left is to add it via configuration.yaml but I gave no idea about the correct entries
I know this is an old post but it really helped me out.
Couldn’t get the contact Sensor to integrate until I tried simply opening and closing the switch when I clicked submit. Then it magically accepted the device and recognized the integration.
That said I’m completely lost so far as how to make it notify me.
I do see in the integration that the contact says “False” when open. And then quickly looses connection as the device shuts down to conserve power.
So not knowing yaml I have a challenge ahead. But thanks for the tip here.
I’m happy i could help you out.
Tuya contact sensors have the problem to go offline and change the state to unavailable after going offline.
I fixed it with some hotfix. For every tuya contact sensor I created a helper (Go to settings=>Integrations=>Helpers and add an input_boolean/switch). Now go to settings=>automations and create for every contact sensor one automation as follows:
Start with an empty automation
Trigger:
State:
To: false
Actions:
Call a service: Input_Boolean.turn_off
Intity: (your helper entity)
Now add another automation but with Trigger when “To” is set to “true” and Call a service “Input_boolean.turn_on”. Other Settings are set equal to the first automation.
Now you have an input_boolean that acts as the tuya sensor should act. Please note, that when the tuya sensor is opened or closed, it first connects to the wifi and then reports the status. It may take a few seconds to react and trigger the automations.
@Draganis appreciate your guidance, following your guide I managed to get the contact sensors working. Also the work-around using helper functions to persist the state of the sensor works like a charm, thanks a lot!