I am new to home assistant and just in the middle of adding my devices to home assistant.
I got some tuya door sensors. Unfortunately they did not integrated into home assistant with the tuya integraton, which was not a problem for me since I wanted to flash them with tasmota anyway.
Now I was able to add them via mqtt autodetection into home assistant, which worked. On the device tasmota page (through ip adress) they work great, in Tasmoadmin they work fine as well and I can see state changes (on/off), too, but when I try to visualize them in lovelace, they state is shown as “not available”. Also under entities their state is shown as “not available”.
I know that these battery powered devices go into deep sleep, but even when they are in rapid change of state (me changing them manually in person every 2 seconds), home assistant will not recognize these changes. When they get into deep sleep, tasmoadmin will show there last state but in red.
I tried to modify them in my configuration.yaml (manual add them) but it did not worked!. I attached the code.
Thanks @petro ! That almost worked.
two more questions:
1.) When the state changes, it only recognizes the “close” state, not “open”. Do I need to classify that, too and if so, how?
2.) If the device goes to deep sleep, it shows the state “unknown” but instead I would like to show me the last known state. What do I have to do?
I am not sure if I got that right, but I typed “cmd/tasmota/LWT off” into the consol of the tasmota device (Tuer1) and got these lines:
09:38:24 CMD: stat/tasmota/LWT off
09:38:24 SRC: WebConsole from 192.168.2.203
09:38:24 CMD: Group 0, Index 1, Command "LWT", Data "off"
I also tried to follow The Hook up´s video https://www.youtube.com/watch?v=31IyfM1gygo and config the retained message by setting the following lines inside of the tasmota device consol
switchretain on
switchtopic tuer1
remove the retained LWT messages from your mqtt broker.
I did not managed to do that. How do I do that?
Also remove these from your config:
I deleted the 3 lines from my config
Here is my code for now:
binary_sensor:
- platform: mqtt
name: Tuer1 status
device_class: door
state_topic: tele/tasmota/tuer1
json_attributes_topic: tele/tasmota/tuer1
value_template: '{{value_json[''RSSI'']}}'
unique_id: CA7E19_status
previously I had “state:topic: tele/tasmota/Hass_state” and “json_attributes_topic: tele/tasmota/hass_state” as shown above, which I thought might help if I switch it to “…/tuer1” (device name) because of the “switchtopic tuer1”-change I made bc of the video but that seems not helped.
Sorry for my inability to implement everything right away. Tried my best for the last 60 minutes.
I managed to do that but now it shows the state “closed” all the time, while in TasmoAdmin it still works great. Any ideas what to do next from here, @tom_l?
After beginning from scratch, I finally made it. I startet by autodetect the device with the mqtt addon and saw, that Home Assistant received two messages under the topic “state/tasmota/power”, then I de-implemented it as @tom_l said and added it in my configuration.yaml. By adding “device_class: door” it now works smooth.
Thanks again @tom_l
My code looks like this now:
binary_sensor:
- platform: mqtt
name: Tuer1 status
device_class: door
state_topic: stat/tuer1/POWER```
i have the same sensor, was able to flash it but I don’t get any notifications at all, even I flashed it with
tasmota 8.3.1 which is the older version as yours but no luck, looks like something wrong with tasmota template provided, anybody help, please…
Sensor status should be mapped to POWER. ON is “open” and OFF is “closed”. but I don’t see any MQTT messages for the sensor at all (stat/sensor_maindoor_F75E0A/RESULT) but i can see the led is flashing when i open the circuit, below console output
12:33:03 CMD: TuyaMCU
12:33:03 SRC: WebConsole from 192.168.87.7
12:33:03 CMD: Group 0, Index 1, Command “TUYAMCU”, Data “”
12:33:03 MQT: stat/tasmota_F75E0A/RESULT = {“TuyaMCU”:[{“fnId”:11,“dpId”:1},{“fnId”:51,“dpId”:21}]}
Did you tried mqtt explorer, as tom adviced? Back then when I tried to get a result, I realised I was looking for the wrong topic.
The template I used from balkadder is still working - so I would doubt that the template has any wrong information in it.