Local Tuya changing local key

Hi, I have had to reinstall a tuya switch in Smartlife app.
Obtained local key and went in ha, integrations, local tuya, selected the device, updated local key
The device switch can be changed from on to off but it does not change the device.
The device switch in ha will show it has turned off but immediately changes to on again.
If I manually change the switch on the device it’s state is shown ha,
I do not understand what is happening. HELP PLEASE

Every time you re-pair a tuya device in the smart life or tuya app, the local key is changed. So try to avoid that.
Check if your key is still correct.

Thanks, yes the key is correct. Ha updates the status of the device if switch the device using it’s button so there is some communication but ha won’t change the device state.

I hope you have figured it out already.
What type of device is this? A light?
I just had the same issue with switch glipping ON after a few seconds.
When you add it to local tuya, make sure you select the right “ID”, “ID” in my case was the light state (on or off)