Smart socket do not work properly using Tuyan

Hi,
controlling my smart socket / plug has pretty much stopped working which is connected to HA using Tuya.

I can’t change the states in HA but in Tuya smart app it still work flawless. I made small video to demonstrate the issue.
https://imgur.com/a/TmB5DrT

  1. showing that in both apps the socket is off.
  2. Turning socket on in HA. it doesn’t stay ‘on’ but turns off about immediately in HA but in Tuya app it has still gone from ‘off’ to ‘on’
  3. Trying to turn it off from HA but can’t do it.

Reloading Tuya integration makes this work for 10-15 minutes but then it stop working again. Where could the issue be…? I have latest version of HA and Tuya integration.

You probably have an error in the logfile of HA related to Tuya and MQTT…
For the time being, the only way is to reload Tuya… For me, I reload every hour… A fix is coming…

Yup there are error releted to Tuya and MQTT…
image

Can you automate the reload somehow or are you doing it manually?

I have automated it… I created a shell_command launching every hour (using a simple automation) the following shell file:

#!/bin/bash
##

echo "Reloading Tuya Integration..."
echo " "

curl -X POST http://LAN_HA_IP:8123/api/config/config_entries/entry/INTEGRATION_ID/reload -H 'Authorization: Bearer YOUR_LONG_LIVED_ACCESS_TOKEN'

LAN_HA_IP: you Home Assistant LAN IP address
YOUR_LONG_LIVED_ACCESS_TOKEN can be generated within Home Assistant.
INTEGRATION_ID can be found in “/config/.storage/core.config_entries” by typing:

$ cd /config/.storage
$ grep core.config_entries -e “tuya” -B 8 - A 8

Look at “entry_id” in the ouput from the previous command (two lines above “tuya”)…

Let me know if you have additional questions or need clarifications/more detailled explanations