CodeFoodPixels / robovac

Add a Eufy RoboVac easily to Home Assistant
Other
129 stars 28 forks source link

Update robovac.py to include T2190 #19

Closed imhotep closed 1 year ago

imhotep commented 1 year ago

This works with my Vacuum L70. Before that I'd get the ModelNotSupported exception (for good reason).

Wasn't sure if I should have added a new letter under L under ROBOVAC_SERIES but it works as is and all of the features seem to work.

CodeFoodPixels commented 1 year ago

T2190 is already in the L series list, isn't it?

imhotep commented 1 year ago

Yup! I was using version 1.0 on HACS which does´t have it. I am just going to point it to main.

imhotep commented 1 year ago

@CodeFoodPixels the ability the set the IP of the vacuum has gone away. How do I set it? By default my entity is unavailable now. If it's autodetecting, it's failing for me.

CodeFoodPixels commented 1 year ago

It should be autodiscovering the IP address. Have you got any restrictions on the network?

imhotep commented 1 year ago

@CodeFoodPixels I don't have any restrictions. The IP seems correct but it's failing on a specific key:

2023-09-04 09:36:18.616 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi] Connecting to eb0cd280189d9f12caawyv (192.168.1.197:6668)
2023-09-04 09:36:20.618 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi] Retrying send due to error. Failed to send data to eb0cd280189d9f12caawyv (192.168.1.197:6668)
2023-09-04 09:36:20.618 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi] Connecting to eb0cd280189d9f12caawyv (192.168.1.197:6668)
2023-09-04 09:36:21.667 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi] Retrying send due to error. Connection to eb0cd280189d9f12caawyv (192.168.1.197:6668) failed: [Errno 113] Host is unreachable
2023-09-04 09:36:21.668 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi] Connecting to eb0cd280189d9f12caawyv (192.168.1.197:6668)
2023-09-04 09:36:21.771 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi] Sending to eb0cd280189d9f12caawyv (192.168.1.197:6668): Message(0xa, {'gwId': 'eb0cd280189d9f12caawyv', 'devId': 'eb0cd280189d9f12caawyv'}, 424403537, <Device eb0cd280189d9f12caawyv (192.168.1.197:6668)>)
2023-09-04 09:36:22.160 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi] Received message from eb0cd280189d9f12caawyv (192.168.1.197:6668): Message(0xa, {'dps': {'2': False, '5': 'Nosweep', '15': 'completed', '101': True, '102': 'Standard', '103': False, '104': 100, '105': 'MopMiddle', '106': 0, '107': False, '108': '[-372,3861,1530]', '109': 40, '110': 0, '111': 80, '112': 134236, '113': 134236, '114': 134236, '115': 'Sensor', '118': True, '119': 134236, '120': 2101, '122': 'Nosweep', '127': 4328, '129': True, '132': 43, '133': 0, '134': 1}}, 424403537, None)
2023-09-04 09:36:22.162 ERROR (MainThread) [homeassistant.components.vacuum] robovac: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 576, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 938, in async_device_update
    await self.async_update()
  File "/config/custom_components/robovac/vacuum.py", line 323, in async_update
    self.tuyastatus.get(TUYA_CODES["{}_CONSUMABLES".format(robovac_series)])
                        ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/enum.py", line 789, in __getitem__
    return cls._member_map_[name]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'L_CONSUMABLES'
2023-09-04 09:36:22.171 INFO (MainThread) [custom_components.robovac.tuyalocalapi] Received updated state eb0cd280189d9f12caawyv (192.168.1.197:6668): {'106': 0, '2': False, '5': 'Nosweep', '15': 'completed', '101': True, '102': 'Standard', '103': False, '104': 100, '105': 'MopMiddle', '107': False, '108': '[-372,3861,1530]', '109': 40, '110': 0, '111': 80, '112': 134236, '113': 134236, '114': 134236, '115': 'Sensor', '118': True, '119': 134236, '120': 2101, '122': 'Nosweep', '127': 4328, '129': True, '132': 43, '133': 0, '134': 1}
CodeFoodPixels commented 1 year ago

I think I fixed this earlier today, redownload from main and give it a try please.

imhotep commented 1 year ago

Now I am getting this:

home-assistant    | Traceback (most recent call last):
home-assistant    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 833, in get_platform
home-assistant    |     cache[full_name] = self._import_platform(platform_name)
home-assistant    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
home-assistant    |   File "/usr/src/homeassistant/homeassistant/loader.py", line 850, in _import_platform
home-assistant    |     return importlib.import_module(f"{self.pkg_path}.{platform_name}")
home-assistant    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
home-assistant    |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
home-assistant    |     return _bootstrap._gcd_import(name[level:], package, level)
home-assistant    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
home-assistant    |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
home-assistant    |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
home-assistant    |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
home-assistant    |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
home-assistant    |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
home-assistant    |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
home-assistant    |   File "/config/custom_components/robovac/vacuum.py", line 90, in <module>
home-assistant    |     class TUYA_CODES(StrEnum):
home-assistant    |   File "/usr/local/lib/python3.11/enum.py", line 565, in __new__
home-assistant    |     raise exc
home-assistant    |   File "/usr/local/lib/python3.11/enum.py", line 258, in __set_name__
home-assistant    |     enum_member = enum_class._new_member_(enum_class, *args)
home-assistant    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
home-assistant    |   File "/usr/local/lib/python3.11/enum.py", line 1273, in __new__
home-assistant    |     raise TypeError('%r is not a string' % (values[0], ))
home-assistant    | TypeError: ['142', '116'] is not a string
home-assistant    | 2023-09-04 09:59:20.420 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform robovac.vacuum: Platform not found (Exception importing custom_components.robovac.vacuum).
home-assistant    | 2023-09-04 09:59:20.742 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry anis.kadri@gmail.com for vacuum
home-assistant    | Traceback (most recent call last):
home-assistant    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 544, in async_unload
home-assistant    |     result = await component.async_unload_entry(hass, self)
home-assistant    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
home-assistant    |   File "/usr/src/homeassistant/homeassistant/components/vacuum/__init__.py", line 222, in async_unload_entry
home-assistant    |     return await component.async_unload_entry(entry)
home-assistant    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
home-assistant    |   File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry
home-assistant    |     raise ValueError("Config entry was never loaded!")
home-assistant    | ValueError: Config entry was never loaded!
CodeFoodPixels commented 1 year ago

Can you give main another try, I think it's resolved?

imhotep commented 1 year ago

@CodeFoodPixels looks like that did the trick! However the status of the vacuum is not reporting correctly. It's alternating beteeen error/cleaning/stop etc…nothing in the logs.

Screen Shot 2023-09-06 at 9 24 06 AM
imhotep commented 1 year ago

@CodeFoodPixels here's some more logs

2023-09-07 18:16:42.232 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: eb0cd280189d9f12caawyv (
192.168.1.197:6668) : 0 bytes read on a total of undefined expected bytes
2023-09-07 18:17:02.133 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to eb0cd280189d9f12caawyv (192.168.1.197:6668) failed: [Errno 32] Broken pipe

Not sure if they're related to the status update not reporting correctly

CodeFoodPixels commented 1 year ago

Can you have a look at #21, that's where I've been tracking this