rospogrigio / localtuya

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

Carro Smart Fan - using LocalTuya #1732

Open psiess opened 2 weeks ago

psiess commented 2 weeks ago

The problem

Environment

2024.6.0 - Home Assistant Core version: 2024.6.2 - [X] Does the device work using the Home Assistant Tuya Cloud component ?

Steps to reproduce

  1. Open HA
  2. Select Localtuya
  3. select the fan
  4. try to change speed

DP dump

Provide Home Assistant traceback/logs

2024-06-14 09:21:09.836 ERROR (MainThread) [homeassistant.helpers.dispatcher] Exception in _handle_update when dispatching 'mobile_app_sensor_update-cb1606e808e9e475dfd0ee4cf612d1bdec49437189f9985558fdd87965f1cf67_battery_state': ({'unique_id': 'battery_state', 'state': 'charging', 'type': 'sensor', 'icon': 'mdi:battery-charging', 'attributes': {'battery_health': 'good', 'charger_type': 'ac', 'is_charging': 'true'}, 'webhook_id': 'cb1606e808e9e475dfd0ee4cf612d1bdec49437189f9985558fdd87965f1cf67'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 658, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'charging'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 661, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'charging'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mobile_app/entity.py", line 90, in _handle_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1000, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1126, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1061, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 665, in state
    raise ValueError(
ValueError: Sensor sensor.px30_evb_battery_state has device class 'battery', state class 'None' unit 'None' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'charging' (<class 'str'>)

2024-06-14 09:30:58.083 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:32:09.365 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:32:19.446 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:32:29.449 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:32:39.452 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:32:49.456 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:32:59.463 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:33:09.471 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:33:19.474 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:33:29.504 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:33:39.508 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:33:49.514 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:33:59.518 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:09.521 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:19.525 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:26.444 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_turn_on
2024-06-14 09:34:26.448 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 7 TuyaMessage(seqno=6413, cmd=7, retcode=0, payload=b'', crc=4149990339, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:26.605 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00#\xb6\x00\x00\x00\x01\x1b\xd9.P\xdd\xb7\x99\xa6\x88\x17\x87\xd7\xddW\xc9\xa0\x9f\x12\xd6D\x7f\x1e\xb6\xbc\xa6$\x15\x00\xec\xb0U\x17DC<\xb1\\\xde~\xcc\xd2\x9f\x99vmr\x88\x1e', crc=4294731573, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:26.606 DEBUG (SyncWorker_2) [custom_components.localtuya.fan] Fan current_speed ordered_list_item_to_percentage: 10 from ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
2024-06-14 09:34:26.606 DEBUG (SyncWorker_2) [custom_components.localtuya.fan] Fan current_percentage: 100
2024-06-14 09:34:26.606 DEBUG (SyncWorker_2) [custom_components.localtuya.fan] Fan current_direction : forward > forward
2024-06-14 09:34:26.613 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00#\xb7\x00\x00\x00\x01\xd6\xdeJL8\x97?oB\xb7\xbb\xe0>b8U\x9f\x12\xd6D\x7f\x1e\xb6\xbc\xa6$\x15\x00\xec\xb0U\x17DC<\xb1\\\xde~\xcc\xd2\x9f\x99vmr\x88\x1e', crc=1479105764, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:26.614 DEBUG (SyncWorker_38) [custom_components.localtuya.fan] Fan current_speed ordered_list_item_to_percentage: 10 from ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
2024-06-14 09:34:26.614 DEBUG (SyncWorker_38) [custom_components.localtuya.fan] Fan current_percentage: 100
2024-06-14 09:34:26.614 DEBUG (SyncWorker_38) [custom_components.localtuya.fan] Fan current_direction : forward > forward
2024-06-14 09:34:39.529 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:49.534 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:58.643 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 70
2024-06-14 09:34:58.650 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 7 TuyaMessage(seqno=6416, cmd=7, retcode=0, payload=b'', crc=74454375, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:58.650 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 70 > 7
2024-06-14 09:34:58.719 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00#\xb8\x00\x00\x00\x01\xad\x02\xf8\xe1\x0c>p\x16\x840\xcf\x05\xce\xd0\x96~o\xe8\xff\x8c\x90\x01V/\xc6\x80i\xef\x0bE\x9do\t\x10sovh\xa9\xf4\x80\x87\xb6V%*DO', crc=3698280234, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:34:58.720 DEBUG (SyncWorker_28) [custom_components.localtuya.fan] Fan current_speed ordered_list_item_to_percentage: 5 from ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
2024-06-14 09:34:58.720 DEBUG (SyncWorker_28) [custom_components.localtuya.fan] Fan current_percentage: 50
2024-06-14 09:34:58.720 DEBUG (SyncWorker_28) [custom_components.localtuya.fan] Fan current_direction : forward > forward
2024-06-14 09:35:09.539 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:19.545 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:30.508 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 30
2024-06-14 09:35:30.932 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:30.945 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 7 TuyaMessage(seqno=6420, cmd=7, retcode=0, payload=b'', crc=3301539825, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:30.946 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00#\xba\x00\x00\x00\x01\x1b\xd9.P\xdd\xb7\x99\xa6\x88\x17\x87\xd7\xddW\xc9\xa0\xd6\xd5Y-o\xdb\xd5\xfe\xb9x/\xc5"\xf1\x19\x1eDC<\xb1\\\xde~\xcc\xd2\x9f\x99vmr\x88\x1e', crc=3578129622, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:30.946 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 30 > 3
2024-06-14 09:35:30.947 DEBUG (SyncWorker_44) [custom_components.localtuya.fan] Fan current_speed ordered_list_item_to_percentage: 10 from ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
2024-06-14 09:35:30.947 DEBUG (SyncWorker_44) [custom_components.localtuya.fan] Fan current_percentage: 100
2024-06-14 09:35:30.947 DEBUG (SyncWorker_44) [custom_components.localtuya.fan] Fan current_direction : forward > forward
2024-06-14 09:35:36.089 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 30
2024-06-14 09:35:36.287 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 7 TuyaMessage(seqno=6421, cmd=7, retcode=0, payload=b'', crc=425698932, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:36.287 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 30 > 3
2024-06-14 09:35:39.254 WARNING (SyncWorker_29) [urllib3.connectionpool] Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='192.168.1.112', port=49153): Read timed out.")': /setup.xml
2024-06-14 09:35:44.562 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 70
2024-06-14 09:35:44.629 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 7 TuyaMessage(seqno=6422, cmd=7, retcode=0, payload=b'', crc=2761280186, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:44.629 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 70 > 7
2024-06-14 09:35:46.693 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_turn_off
2024-06-14 09:35:48.457 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 7 TuyaMessage(seqno=6423, cmd=7, retcode=0, payload=b'', crc=2030244671, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:48.660 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b"3.3\x00\x00\x00\x00\x00\x00#\xbb\x00\x00\x00\x01\xee\xa3\xce\xf3\xd7P\x85^<j'\xbb/\xab7DS\xe1\x7f\xb4],xI\xb6\x83\xdai\x80$%\xb4\t\x10sovh\xa9\xf4\x80\x87\xb6V%*DO", crc=388698639, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:48.661 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00#\xbc\x00\x00\x00\x01\xcb?\xe1\x98>\x00o\xb3\xd2\xcd#\xc0\xadl\x03\x16\xa5\xc3j|0?\xe9z>\xce\xe6r\xe2\xfd`i\x95l\xe1\x9a\xaa\xf8\xab\x04q\xb0\xdf{o\x0f\xd4\xc9', crc=4063788446, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:48.662 DEBUG (SyncWorker_53) [custom_components.localtuya.fan] Fan current_speed ordered_list_item_to_percentage: 1 from ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
2024-06-14 09:35:48.662 DEBUG (SyncWorker_53) [custom_components.localtuya.fan] Fan current_percentage: 10
2024-06-14 09:35:48.662 DEBUG (SyncWorker_53) [custom_components.localtuya.fan] Fan current_direction : forward > forward
2024-06-14 09:35:53.937 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_turn_on
2024-06-14 09:35:53.977 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 7 TuyaMessage(seqno=6424, cmd=7, retcode=0, payload=b'', crc=1584645642, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:54.141 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00#\xbd\x00\x00\x00\x01\x1b\xd9.P\xdd\xb7\x99\xa6\x88\x17\x87\xd7\xddW\xc9\xa0\x0b,Q\xecb2\x9b\xbc\xf8\x80\xa63\x8d\x17NODC<\xb1\\\xde~\xcc\xd2\x9f\x99vmr\x88\x1e', crc=198938519, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:54.142 DEBUG (SyncWorker_50) [custom_components.localtuya.fan] Fan current_speed ordered_list_item_to_percentage: 10 from ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
2024-06-14 09:35:54.142 DEBUG (SyncWorker_50) [custom_components.localtuya.fan] Fan current_percentage: 100
2024-06-14 09:35:54.142 DEBUG (SyncWorker_50) [custom_components.localtuya.fan] Fan current_direction : forward > forward
2024-06-14 09:35:55.461 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00#\xbe\x00\x00\x00\x01\xd6\xdeJL8\x97?oB\xb7\xbb\xe0>b8U\x0b,Q\xecb2\x9b\xbc\xf8\x80\xa63\x8d\x17NODC<\xb1\\\xde~\xcc\xd2\x9f\x99vmr\x88\x1e', crc=1371526340, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:55.462 DEBUG (SyncWorker_11) [custom_components.localtuya.fan] Fan current_speed ordered_list_item_to_percentage: 10 from ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
2024-06-14 09:35:55.462 DEBUG (SyncWorker_11) [custom_components.localtuya.fan] Fan current_percentage: 100
2024-06-14 09:35:55.462 DEBUG (SyncWorker_11) [custom_components.localtuya.fan] Fan current_direction : forward > forward
2024-06-14 09:35:56.923 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 30
2024-06-14 09:35:56.926 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 7 TuyaMessage(seqno=6425, cmd=7, retcode=0, payload=b'', crc=2212831119, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:35:56.927 DEBUG (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage: 30 > 3
2024-06-14 09:35:59.929 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00#\xbf\x00\x00\x00\x01\x1b\xd9.P\xdd\xb7\x99\xa6\x88\x17\x87\xd7\xddW\xc9\xa0\xdf3]\x1c\rj\xa1\x9c\xd19+\xdbU\xc2CgDC<\xb1\\\xde~\xcc\xd2\x9f\x99vmr\x88\x1e', crc=447994728, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:36:10.630 ERROR (MainThread) [homeassistant.helpers.dispatcher] Exception in _handle_update when dispatching 'mobile_app_sensor_update-cb1606e808e9e475dfd0ee4cf612d1bdec49437189f9985558fdd87965f1cf67_battery_state': ({'unique_id': 'battery_state', 'state': 'charging', 'type': 'sensor', 'icon': 'mdi:battery-charging', 'attributes': {'battery_health': 'good', 'charger_type': 'ac', 'is_charging': 'true'}, 'webhook_id': 'cb1606e808e9e475dfd0ee4cf612d1bdec49437189f9985558fdd87965f1cf67'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 658, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'charging'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 661, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'charging'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mobile_app/entity.py", line 90, in _handle_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1000, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1126, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1061, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 665, in state
    raise ValueError(
ValueError: Sensor sensor.px30_evb_battery_state has device class 'battery', state class 'None' unit 'None' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'charging' (<class 'str'>)

2024-06-14 09:36:10.937 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:36:17.914 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 8 TuyaMessage(seqno=0, cmd=8, retcode=0, payload=b'3.3\x00\x00\x00\x00\x00\x00#\xc0\x00\x00\x00\x011\xe2[\xbdf\x11xZ\x92\x184Q%\xdf8\x9a|\xb1C]\x0f\x87a\t\xf9y\x7f\xe2V\x02K\xeb\t\x10sovh\xa9\xf4\x80\x87\xb6V%*DO', crc=1987928564, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:36:17.914 DEBUG (SyncWorker_36) [custom_components.localtuya.fan] Fan current_speed ordered_list_item_to_percentage: 2 from ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
2024-06-14 09:36:17.914 DEBUG (SyncWorker_36) [custom_components.localtuya.fan] Fan current_percentage: 20
2024-06-14 09:36:17.914 DEBUG (SyncWorker_36) [custom_components.localtuya.fan] Fan current_direction : forward > forward
2024-06-14 09:36:20.940 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)
2024-06-14 09:36:30.944 DEBUG (MainThread) [custom_components.localtuya.core.pytuya] [ebf...yue - Livingroom Fan] Dispatching message CMD 9 TuyaMessage(seqno=0, cmd=9, retcode=0, payload=b'', crc=2958142211, crc_good=True, prefix=21930, iv=None)

Additional information

psiess commented 2 weeks ago

I can't figure out how to install TinyTuya in HA running under HassOS.