I have noticed several error messages which appear in the System > Logs immediately on any Home Assistant restart.
Normally these don't seem to have a noticable effect for me; however sometimes devices become temporarily unavailable, and I have lately been getting thousands of the following message - so wanting to eliminate possible causes.
don@muscle:~$ python3 tuyadebug/test.py bfe74c868b1c942a54andf 192.168.1.105 83183d58514694b3
INFO:localtuya:localtuya version 1.0.0
INFO:localtuya:Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] on linux
INFO:localtuya:Using pytuya version '8.1.0'
INFO:localtuya:Detecting list of available DPS of device bfe74c868b1c942a54andf [192.168.1.105], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"bfe74c868b1c942a54andf","devId":"bfe74c868b1c942a54andf"}'
DEBUG:localtuya.pytuya:DATA RECEIVED!
DEBUG:localtuya.pytuya:decode payload=b'\xc2\xdc\xaa\x9e\x10v\xa5Q\xcc\x90\x19\xad18^\xa8\x0e\x16\xb4\x8d\xb7\x88{GE\x08\xe0o\x87\xc1\xbb\xa6'
DEBUG:localtuya.pytuya:Failed to connect to 192.168.1.105. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
INFO:localtuya:Detecting list of available DPS of device bfe74c868b1c942a54andf [192.168.1.105], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"bfe74c868b1c942a54andf","devId":"bfe74c868b1c942a54andf"}'
DEBUG:localtuya.pytuya:DATA RECEIVED!
DEBUG:localtuya.pytuya:decode payload=b'\xc2\xdc\xaa\x9e\x10v\xa5Q\xcc\x90\x19\xad18^\xa8\x0e\x16\xb4\x8d\xb7\x88{GE\x08\xe0o\x87\xc1\xbb\xa6'
DEBUG:localtuya.pytuya:Failed to connect to 192.168.1.105. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
INFO:localtuya:Detecting list of available DPS of device bfe74c868b1c942a54andf [192.168.1.105], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"bfe74c868b1c942a54andf","devId":"bfe74c868b1c942a54andf"}'
DEBUG:localtuya.pytuya:DATA RECEIVED!
DEBUG:localtuya.pytuya:decode payload=b'\xc2\xdc\xaa\x9e\x10v\xa5Q\xcc\x90\x19\xad18^\xa8\x0e\x16\xb4\x8d\xb7\x88{GE\x08\xe0o\x87\xc1\xbb\xa6'
DEBUG:localtuya.pytuya:Failed to connect to 192.168.1.105. Raising Exception.
WARNING:localtuya.pytuya:Failed to get status: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
INFO:localtuya:TIMEOUT: No response from device bfe74c868b1c942a54andf [192.168.1.105] after 2 attempts.
don@muscle:~$
I have 7 working devices. 5 are Arlec PC191HA smart power sockets with DP_id's:
dp_id
code
type
values
1
switch_1
Boolean
{}
9
countdown_1
Integer
Unit:s, min:0, max:86400, scale:0, step:1
17
add_ele
Integer
unit:kW·h, min:0, max:50000, scale:3, step:100
18
cur_current
Integer
unit:mA, min:0, max:30000, scale:0, step:1
19
cur_power
Integer
Unit:W, min:0, max:80000, scale:1, step:1
20
cur_voltage
Integer
Unit:V, min:0, max:5000, scale:1, step:1
38
relay_status
Enum
Range: power_off, power_on, last actual values: on, off, memory
Curiously, only 2 of the actual deices seem to expose DP_id 17 - but I think that is a different issue.
I have a Zemismart Tuya blind motor, model M515EGWT V2
dp_id
code
type
values
Status
1
control
Enum
open,stop,close
stop
2
percent_control
Integer
0-100, step 1
39
5
control_back_mode
Enum
forward,back
false
7
work_state
Enum
opening,closing
opening
12
fault
Bitmap
Label: motor_fault
0
16
border
Enum
up,down, up_delete,down_delete, remove_top_bottom
down
19
position_best
Integer
0-100, step 1
0
and a Powertech 4-way smart Wi-fi mains powerboard.
dp_id
code
type
values
1
switch_1
Boolean
2
switch_2
3
switch_3
4
switch_4
5
switch_5
9
countdown_1
Integer
unit:s, min:0, max:86400, scale:0, step:1
10
countdown_2
Integer
unit:s, min:0, max:86400, scale:0, step:1
11
countdown_3
Integer
unit:s, min:0, max:86400, scale:0, step:1
12
countdown_4
Integer
unit:s, min:0, max:86400, scale:0, step:1
13
countdown_5
Integer
unit:s, min:0, max:86400, scale:0, step:1
Provide Home Assistant taceback/logs
2022-09-01 11:44:40.316 ERROR (MainThread) [homeassistant.components.number] Error adding entities for domain number with platform localtuya
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 571, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 253, in capability_attributes
ATTR_STEP: self.step,
File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 339, in step
value_range = abs(self.max_value - self.min_value)
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
2022-09-01 11:44:40.354 ERROR (MainThread) [homeassistant.components.number] Error while setting up localtuya platform for number
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 571, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 253, in capability_attributes
ATTR_STEP: self.step,
File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 339, in step
value_range = abs(self.max_value - self.min_value)
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
2022-09-01 11:44:44.411 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform mobile_app
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/mobile_app/sensor.py", line 113, in native_value
and (timestamp := dt_util.parse_datetime(state)) is not None
File "/usr/src/homeassistant/homeassistant/util/dt.py", line 185, in parse_datetime
return ciso8601.parse_datetime(dt_str)
TypeError: argument 1 must be str, not datetime.datetime
2022-09-01 11:44:44.441 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up mobile_app platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/mobile_app/sensor.py", line 113, in native_value
and (timestamp := dt_util.parse_datetime(state)) is not None
File "/usr/src/homeassistant/homeassistant/util/dt.py", line 185, in parse_datetime
return ciso8601.parse_datetime(dt_str)
TypeError: argument 1 must be str, not datetime.datetime
The problem
I have noticed several error messages which appear in the System > Logs immediately on any Home Assistant restart.
Normally these don't seem to have a noticable effect for me; however sometimes devices become temporarily unavailable, and I have lately been getting thousands of the following message - so wanting to eliminate possible causes.
Environment
Steps to reproduce
Configuration
configuration.yaml
orconfig_flow
DP dump
Procedure from https://github.com/rospogrigio/localtuya/wiki/HOWTO-get-a-DPs-dump gives
Curiously, only 2 of the actual deices seem to expose DP_id 17 - but I think that is a different issue.
I have a Zemismart Tuya blind motor, model M515EGWT V2
and a Powertech 4-way smart Wi-fi mains powerboard.
Provide Home Assistant taceback/logs
Additional information