Open Frans1960 opened 4 years ago
Please enable debug logs and attach them here. At a glance it looks like decryption failed, but that could be the case of another error, something seen in #185 as well. It's the same scenario in that issue basically. Multiple devices added (of same type) but one fails.
I also have a similar problem since the update. Add 2 sockets with energy monitor with protocol 3.1. Are put on properly and work. After about 2-3 minutes you lose the connection and have no function. Can no longer be switched and the energy monitor shows the last values. With a reload they work again for a few minutes and then the same error again. I don't have these problems with the two GS112 with protocol 3.3.
@Vaszago Would be great if you attached debug logs as well. Can't do anything without them.
Is that the right log
two more logs Debug Tuya 1.txt Debug Tuya 2.txt
Looks correct. Please note the id for the device that is malfunctioning, it will help me a lot.
20528441500291285df2. Work gs112 205284415002912a6705 Work gs112 [604...0e9]. Not working 604...48c. Not working
@Vaszago Can you try #177 for a while and see if it works better?
I installed the latest LocalTuya version, but the same result. I attached the LocalTuya config and Homeassistant Log file home-assistant.log LocalTuya.txt
I also deleted the device and used the config flow to add the device, which results also in an error message.
I'm also setting up another HA system and the the same behaviour and problems. I attached the config and log files. LocalTuya.txt home-assistant.log
The
Looks correct. Please note the id for the device that is malfunctioning, it will help me a lot.
the id for the device that is malfunctioning: device_id: 061.....487d local_key: b278.....b04
I'm back to V3.03 and everything works again
It seems that the device is still in HA, but where? I cant find it in the UI, even if I delete it in the LocalTuya UI. The IP address of the device is 10.0.10.202!
Log 2020-11-30 09:18:58 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry WasmachineDroger (YAML) for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 67, in async_setup_entry return await hass.data[DOMAIN].async_setup_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 155, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2020-11-30 09:18:58 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry WasmachineDroger (YAML) for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 67, in async_setup_entry return await hass.data[DOMAIN].async_setup_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 155, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2020-11-30 09:18:58 DEBUG (MainThread) [custom_components.localtuya.common] Connecting to 10.0.10.202 (061......87d) 2020-11-30 09:18:58 DEBUG (MainThread) [custom_components.localtuya.common] Waiting 0 seconds before connecting 2020-11-30 09:18:58 DEBUG (MainThread) [custom_components.localtuya.common] Connecting to 10.0.10.202
When I delete the device in the LocalTuya user interface I see a strange error in the HA Logging: 2020-12-01 13:55:59 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/tasmota/init.py", line 78, in async_device_removed device = device_registry.deleted_devices[event.data["device_id"]] KeyError: 'f6ec62164cb8544b0053e78a306f580b'
This is the logging when I try to add the device again by the LocalTuya user interface: 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Started heartbeat loop 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Sending command heartbeat (device type: type_0a) 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Send payload: b'{}' 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Waiting for sequence number -100 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Connection lost: [Errno 104] Connection reset by peer 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Closing connection 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Wait was aborted for seqno -100 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Sending command status (device type: type_0a) 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Send payload: b'{"gwId":"061...87d","devId":"061...87d"}' 2020-12-01 14:02:58 ERROR (MainThread) [custom_components.localtuya.pytuya] [061...87d] Failed to get status: 'NoneType' object has no attribute 'write' Traceback (most recent call last): File "/config/custom_components/localtuya/pytuya/init.py", line 499, in detect_available_dps data = await self.status() File "/config/custom_components/localtuya/pytuya/init.py", line 461, in status status = await self.exchange(STATUS) File "/config/custom_components/localtuya/pytuya/init.py", line 439, in exchange self.transport.write(payload) AttributeError: 'NoneType' object has no attribute 'write' 2020-12-01 14:02:58 DEBUG (MainThread) [custom_components.localtuya.pytuya] [061...87d] Closing connection 2020-12-01 14:02:58 ERROR (MainThread) [custom_components.localtuya.config_flow] Unexpected exception Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 260, in async_step_basic_info self.dps_strings = await validate_input(self.hass, user_input) File "/config/custom_components/localtuya/config_flow.py", line 173, in validate_input detected_dps = await interface.detect_available_dps() File "/config/custom_components/localtuya/pytuya/init.py", line 499, in detect_available_dps data = await self.status() File "/config/custom_components/localtuya/pytuya/init.py", line 461, in status status = await self.exchange(STATUS) File "/config/custom_components/localtuya/pytuya/init.py", line 439, in exchange self.transport.write(payload) AttributeError: 'NoneType' object has no attribute 'write'
I'm trying to add 3 plugs and the second one want add the switch (DP1)
After start HA with the LocalTuya in the config file and It generates all sensors of plug_2, but not the switch! I get this error: Logger: custom_components.localtuya.switch Source: custom_components/localtuya/pytuya/init.py:132 Integration: LocalTuya integration (documentation, issues) First occurred: 16:49:23 (3 occurrences) Last logged: 18:37:08 [061...87d] Entity switch.plug_2 is requesting unknown DPS index 1
LocalTya Config:
host: 10.0.10.201 device_id: 070....4a0 local_key: 54....1a6 friendly_name: Stoomboiler protocol_version: "3.3" entities:
platform: switch friendly_name: Plug id: 1 current: 18 # Optional current_consumption: 19 # Optional voltage: 20 # Optional
platform: sensor friendly_name: Dp 9 id: 9
scaling: 0.1 # Optional
device_class: current # Optional
unit_of_measurement: "A" # Optional
platform: sensor friendly_name: Current id: 18 scaling: 0.001 # Optional device_class: current # Optional unit_of_measurement: "A" # Optional
platform: sensor friendly_name: Consumption id: 19 scaling: 0.1 # Optional device_class: power # Optional unit_of_measurement: "W" # Optional
platform: sensor friendly_name: Voltage id: 20 scaling: 0.1 # Optional device_class: voltage # Optional unit_of_measurement: "V" # Optional
platform: sensor friendly_name: Dp 21 id: 21 scaling: 0.01 # Optional device_class: energy # Optional unit_of_measurement: "kWh" # Optional
platform: sensor friendly_name: Dp 22 id: 22
scaling: 0.1 # Optional
device_class: current # Optional
unit_of_measurement: "A" # Optional
platform: sensor friendly_name: Dp 23 id: 23
scaling: 0.1 # Optional
device_class: current # Optional
unit_of_measurement: "A" # Optional
platform: sensor friendly_name: Dp 24 id: 24
scaling: 0.1 # Optional
device_class: current # Optional
unit_of_measurement: "A" # Optional
platform: sensor friendly_name: Dp 25 id: 25
scaling: 0.1 # Optional
device_class: current # Optional
unit_of_measurement: "A" # Optional
host: 10.0.10.202 device_id: 06....487d local_key: b2...04 friendly_name: WasmachineDroger protocol_version: "3.3" entities:
platform: switch friendly_name: Plug id: 1
platform: sensor friendly_name: Current id: 18 scaling: 0.001 # Optional device_class: current # Optional unit_of_measurement: "A" # Optional
platform: sensor friendly_name: Consumption id: 19 scaling: 0.1 # Optional device_class: power # Optional unit_of_measurement: "W" # Optional
platform: sensor friendly_name: Voltage id: 20 scaling: 0.1 # Optional device_class: voltage # Optional unit_of_measurement: "V" # Optional
host: 10.0.10.203 device_id: 0615...4989 local_key: 03...0f4 friendly_name: Koelkast protocol_version: "3.3" entities:
platform: switch friendly_name: Plug id: 1
platform: sensor friendly_name: Current id: 18 scaling: 0.001 # Optional device_class: current # Optional unit_of_measurement: "A" # Optional
platform: sensor friendly_name: Consumption id: 19 scaling: 0.1 # Optional device_class: power # Optional unit_of_measurement: "W" # Optional
platform: sensor friendly_name: Voltage id: 20 scaling: 0.1 # Optional device_class: voltage # Optional unit_of_measurement: "V" # Optional
When I do it with the LocalTuya configurator it generates this error: Logboekdetails (ERROR) Logger: custom_components.localtuya.configflow Source: customcomponents/localtuya/pytuya/init.py:140 Integration: LocalTuya integration (documentation, issues) First occurred: 19:18:01 (1 occurrences) Last logged: 19:18:01
Unexpected exception Traceback (most recent call last): File "/config/custom_components/localtuya/pytuya/init.py", line 499, in detect_available_dps data = await self.status() File "/config/custom_components/localtuya/pytuya/init.py", line 461, in status status = await self.exchange(STATUS) File "/config/custom_components/localtuya/pytuya/init.py", line 446, in exchange payload = self._decode_payload(msg.payload) File "/config/custom_components/localtuya/pytuya/init.py", line 546, in _decode_payload payload = payload.decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0x84 in position 1: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/config/custom_components/localtuya/config_flow.py", line 254, in async_step_basic_info self.dps_strings = await validate_input(self.hass, user_input) File "/config/custom_components/localtuya/config_flow.py", line 172, in validate_input detected_dps = await interface.detect_available_dps() File "/config/custom_components/localtuya/pytuya/init.py", line 501, in detect_available_dps self.exception("Failed to get status: %s", e) File "/config/custom_components/localtuya/pytuya/init.py", line 140, in exception return self._logger.log(logging.EXCEPTION, msg, *args) AttributeError: module 'logging' has no attribute 'EXCEPTION'.