rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.91k stars 557 forks source link

Smatrul BSD33 smart socket switch off every 40 min #309

Closed KixMan28 closed 3 years ago

KixMan28 commented 3 years ago

I have installed recently localtuya to be able to integrate my Tuya devices in HA. I am using localtuya ver 3.2.0, and Home Assistant ver 2021.1.1. I have two Smatrul BSD33 smart sockets which are integrated in locatuya and for some unknown reason both of them automatically switch off 40 min after I switch them on. See report below:

January 12, 2021 Turned on by Csaba 12:56:41 AM - 24 minutes ago Turned off 12:54:11 AM - 26 minutes ago Turned on (restarted HA) 12:49:48 AM - 31 minutes ago Turned on (restarted HA) 12:37:42 AM - 43 minutes ago Turned on by Csaba 12:14:11 AM - 1 hour ago January 11, 2021 Turned off 10:30:08 PM - 3 hours ago Turned on by Csaba 9:50:08 PM - 4 hours ago Turned off 9:00:44 PM - 4 hours ago Became unavailable 9:00:44 PM - 4 hours ago Turned off 7:27:23 PM - 6 hours ago Became unavailable 7:27:08 PM - 6 hours ago Turned off 7:18:05 PM - 6 hours ago Turned on 6:32:59 PM - 7 hours ago Became unavailable 6:32:54 PM - 7 hours ago Turned on 6:07:17 PM - 7 hours ago Became unavailable 6:07:07 PM - 7 hours ago Turned on 6:02:28 PM - 7 hours ago Became unavailable 6:02:22 PM - 7 hours ago Turned on 5:40:11 PM - 8 hours ago Turned on by Csaba 5:37:03 PM - 8 hours ago

Why is happening this?

ultratoto14 commented 3 years ago

Did you check if you didn't configure a timer in the tuya app ?

KixMan28 commented 3 years ago

@ultratoto14: I have checked the tuya app and I have no timer, automation or scene configured for any device. In the localtuya integration I have set up the switch and 3 sensors (see picture attached). I didn't found anywhere during the setup any timer configuration, so I don't know, why they switch off after exactly 40 minutes. LocalTuya

Any other hint?

ultratoto14 commented 3 years ago

From your log, they seem to turn off themselves, do they have a good wifi connection ? Maybe you can enable the debug logs and post here to see what localtuya is receiving or issuing.

KixMan28 commented 3 years ago

@ultratoto14: Yes, there is good wifi coverage. I don't think wifi connection would switch off the device exactly at 40 min time mark. Where should I enable debug logs: in home assistant or tuyalocal?

ultratoto14 commented 3 years ago

Enable debugging

KixMan28 commented 3 years ago

OK, thank you. I am enabling the debug log right now in about 50 minutes we should have the debug log related to the switch off.

KixMan28 commented 3 years ago

@ultratoto14: here are the files. Socket 2 Socket 1 LocalTuya debug info.txt

The two smart plugs with the error are having the following IP addresses: 192.168.1.13 and 192.168.1.15

Thank you for your support

ultratoto14 commented 3 years ago

In your logs, we can see:

2021-01-12 16:03:29 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c1...cwq] Send payload: b'{"devId":"6c1bddf59170e9ed0fkcwq","uid":"6c1bddf59170e9ed0fkcwq","t":"1610463809","dps":{"1":true}}'

then ...

2021-01-12 16:43:29 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c1...cwq] Got status update
2021-01-12 16:43:29 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c1...cwq] Decrypted payload: {"dps":{"1":false},"t":1610466207}

Seems that we receive an external update, it's not send by HA, do not have any clue.

KixMan28 commented 3 years ago

Is this the external update?

2021-01-12 16:43:29 DEBUG (MainThread) [custom_components.localtuya.pytuya] [6c1...cwq] Dispatching message TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00\xb7"\x00\x00\x00\x01[0\xea\xc1\x04=\x81\xa4\x01\xd4\x1a\xa2S\x86\xe2~W\x7f\xf8=G\'\xf7\x14*\xf0\x02\xf8l!\xe4oZ\xf1\x0e\x06\x81\xfe/\xff\xe1\xa1_?\x9f@\xffy', crc=3828777227)

If yes, what does it mean? If not, still what does it mean?

ultratoto14 commented 3 years ago

It means that you do not have a corresponding Send payload meaning localtuya is receiving a status update that the device have been switched off. Just remove you device from HA and check that the behavior occurs of not.

KixMan28 commented 3 years ago

OK. I will try that also.

KixMan28 commented 3 years ago

I have removed the devices from both HA and the Tuya app. I paired again the devices with the app and I switched on. This was couple of hours ago. They are still ON since then. Now I need to get the new key ID from the devices, but I am still waiting for my new RPi to arrive. Once I set them I up in localtuya I let you know the result.

KixMan28 commented 3 years ago

After I've got the new keyID's and I re-added the two sockets to localtuya, everything works fine now.