can you check if this log was a local communication (LAN) or it was a response from the cloud? if it was local, can you share de request log? maybe we can compare with the actual python request… so we can find the difference.
I have this line from adroid app \shared_prefs\preferences_global_keyes file.
I don’t know how to check whats this response come from - cloud or lan
How can I extract the request log ?
Szczegóły loga (ERROR)
Logger: homeassistant.helpers.entity
Source: custom_components/localtuya/switch.py:147
First occurred: 11:39:01 (14 occurrences)
Last logged: 14:01:30
Update for switch.tuya_plug1 fails
Traceback (most recent call last):
File "/config/custom_components/localtuya/switch.py", line 139, in __get_status
status = self._device.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 349, in status
result = cipher.decrypt(result, False)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 87, in decrypt
raw = cipher.decrypt(enc)
File "/usr/local/lib/python3.8/site-packages/Crypto/Cipher/_mode_ecb.py", line 195, in decrypt
raise ValueError("Data must be aligned to block boundary in ECB mode")
ValueError: Data must be aligned to block boundary in ECB mode
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 272, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 465, in async_device_update
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/localtuya/switch.py", line 234, in update
self._status = self._device.status()
File "/config/custom_components/localtuya/switch.py", line 170, in status
self._cached_status = self.__get_status()
File "/config/custom_components/localtuya/switch.py", line 147, in __get_status
raise ConnectionError("Failed to update status .")
ConnectionError: Failed to update status .
nodered is working for me!!!
very, very, very important TIP: the devices will only send the energy consumption IF THERE IS CONSUMPTION! I was testing without appliances… in this case, it only sends “1” status…
I got my switches to work by using Node-Red they are in sync with the app, home assistant
and pressing the button on the switch. They are only seconds apart. Node-Red has to be running all the time for it to work.
Hi,
having never used node-red, after installing it is it difficult to configure it to detect the socket data?
I should follow guide 2. Node red configuration (2.2 Test node
Put settings into the tuya-local node in the simple testing flow from the previous post and test if you get the connection)
Hi,
I installed nodered and reported the code that I found in step 3, I entered the values of my sockets in switch1 and switch2, I reported id and ip in the tuya device set, I inserted the switches and sensors in configuration.yaml, but the values are not reported and the socket status is off even if it is on.
Do I have to enter values manually also in the mqtt device set?
By doing the test of post 2.2, instead, under “msg” the values of 18 and 19 were reported.
I’m not completely sure if it is his repo but his nickname is so unique…
@SmartM-ui, who is a friend of mine, was unable to do the same with his Teckin SP22.
I wonder if this issue is hardware related or the @rospogrigio 's release needs an update …
What I am sure of is that localtuya works … only under certain conditions …
I can confirm that with SP22 does not works this method, i could debug the problem:
The socket is connected successfully
The command to get status is sent successfully
The response of the plug cannot be handled by pytuya package and falls in a exception
There is a mismatch of payload response of the plug, pytuya package cannot handle the response and the general purposes log message is “response is unvalid”.
Any idea? another method is trying to flash Tasmota firm…
Hi @raimangsxr ,
have you tried node-red?
If so, could you tell me the procedure?
I have an error on function “df5da0e3.1e9ba8”: “TypeError: Cannot use ‘in’ operator to search for ‘1’ in undefined”
I also have the Teckin SP22
Thanks