bittles / ha_ecovacs_bumper

Ecovacs component that works with bumper
GNU General Public License v3.0
4 stars 2 forks source link

Error on HA startup. #8

Closed Arn0uDz closed 1 year ago

Arn0uDz commented 1 year ago

I have bumper running without a certificate. The vacuum is connected and everything is online. Do you know what causes this error? Using HA 2023.1.4

Home Assistant gave an error using your example.yaml content so I changed the values to my real account but it is still not working.

my yaml:

ecovacs: username: myusername password: mypassword country: nl continent: eu verify_ssl: false

Logger: homeassistant.setup Source: custom_components/ecovacs/sucks_mqtt.py:35 Integration: ecovacs (documentation, issues) First occurred: 17:16:22 (1 occurrences) Last logged: 17:16:22

Error during setup of component ecovacs Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 253, in _async_setup_component result = await task File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/ecovacs/init.py", line 72, in setup vacbot = VacBot( File "/config/custom_components/ecovacs/sucks.py", line 284, in init self.iotmq = EcoVacsIOTMQ(user, domain, resource, secret, continent, vacuum, server_address, verify_ssl=verify_ssl) File "/config/custom_components/ecovacs/sucks_mqtt.py", line 35, in init self.verify_ssl = str_to_bool_or_cert(verify_ssl) NameError: name 'str_to_bool_or_cert' is not defined

bittles commented 1 year ago

I just pushed an update to fix that. I don't have an MQTT robot to test so let me know if any errors pop up now

Arn0uDz commented 1 year ago

Thanks for checking. I now get a different error. Don't know if you can do anything about the new error. It's a Deebot OZMO 900.

Logger: homeassistant.components.vacuum Source: custom_components/ecovacs/sucks_mqtt.py:92 Integration: Stofzuiger (documentation, issues) First occurred: 20:19:41 (1 occurrences) Last logged: 20:19:41

Error while setting up ecovacs platform for vacuum Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/ecovacs/vacuum.py", line 33, in setup_platform vacuums.append(EcovacsVacuum(device)) File "/config/custom_components/ecovacs/vacuum.py", line 59, in init self.device.connect_and_wait_until_ready() File "/config/custom_components/ecovacs/sucks.py", line 299, in connect_and_wait_until_ready self.iotmq.schedule(30, self.send_ping) File "/config/custom_components/ecovacs/sucks_mqtt.py", line 92, in schedule if not self.scheduler_thread.isAlive(): AttributeError: 'Thread' object has no attribute 'isAlive'

bittles commented 1 year ago

Fixed isAlive and another problem with python versions newer than 3.8. This was all based on bmartin5692's fork of sucks and wasn't ever updated for newer python environments. Let me know if it runs into anything else now

Arn0uDz commented 1 year ago

I now get 2 entries upon boot.

1st: Logger: homeassistant.components.vacuum Source: custom_components/ecovacs/sucks_mqtt.py:134 Integration: Stofzuiger (documentation, issues) First occurred: 21:20:52 (1 occurrences) Last logged: 21:20:52

Error while setting up ecovacs platform for vacuum Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/ecovacs/vacuum.py", line 33, in setup_platform vacuums.append(EcovacsVacuum(device)) File "/config/custom_components/ecovacs/vacuum.py", line 59, in init self.device.connect_and_wait_until_ready() File "/config/custom_components/ecovacs/sucks.py", line 303, in connect_and_wait_until_ready self.send_ping() File "/config/custom_components/ecovacs/sucks.py", line 440, in send_ping self.request_all_statuses() File "/config/custom_components/ecovacs/sucks.py", line 468, in request_all_statuses self.refresh_statuses() File "/config/custom_components/ecovacs/sucks.py", line 459, in refresh_statuses self.run(GetCleanState()) File "/config/custom_components/ecovacs/sucks.py", line 479, in run self.send_command(action) File "/config/custom_components/ecovacs/sucks.py", line 476, in send_command self.iotmq.send_command(action, self._vacuum_address()) #IOTMQ devices need the full action for additional parsing File "/config/custom_components/ecovacs/sucks_mqtt.py", line 122, in send_command c = self._wrap_command(action, recipient) File "/config/custom_components/ecovacs/sucks_mqtt.py", line 134, in _wrap_command 'realm': EcoVacsAPI.REALM, NameError: name 'EcoVacsAPI' is not defined

And the second error:

Deze fout is ontstaan door een aangepaste integratie.

Logger: root Source: custom_components/ecovacs/sucks_mqtt.py:134 Integration: Ecovacs Bumper (documentation, issues) First occurred: 21:21:22 (1 occurrences) Last logged: 21:21:22

Uncaught thread exception Traceback (most recent call last): File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/local/lib/python3.10/threading.py", line 953, in run self._target(*self._args, *self._kwargs) File "/usr/local/lib/python3.10/sched.py", line 151, in run action(argument, **kwargs) File "/config/custom_components/ecovacs/sucks_mqtt.py", line 87, in _run_scheduled_func timer_function() File "/config/custom_components/ecovacs/sucks.py", line 440, in send_ping self.request_all_statuses() File "/config/custom_components/ecovacs/sucks.py", line 468, in request_all_statuses self.refresh_statuses() File "/config/custom_components/ecovacs/sucks.py", line 459, in refresh_statuses self.run(GetCleanState()) File "/config/custom_components/ecovacs/sucks.py", line 479, in run self.send_command(action) File "/config/custom_components/ecovacs/sucks.py", line 476, in send_command self.iotmq.send_command(action, self._vacuum_address()) #IOTMQ devices need the full action for additional parsing File "/config/custom_components/ecovacs/sucks_mqtt.py", line 122, in send_command c = self._wrap_command(action, recipient) File "/config/custom_components/ecovacs/sucks_mqtt.py", line 134, in _wrap_command 'realm': EcoVacsAPI.REALM, NameError: name 'EcoVacsAPI' is not defined

bittles commented 1 year ago

Ok fixed that one. That one was my bad just didn't catch it without an MQTT bot. v1.4.5 has that fix for those errors

Arn0uDz commented 1 year ago

We will get there. Thanks for all your work.

Logger: homeassistant.setup Source: setup.py:210 First occurred: 22:04:36 (1 occurrences) Last logged: 22:04:36

Setup failed for custom integration ecovacs: Unable to import component: cannot import name 'EcoVacsAPI' from partially initialized module 'custom_components.ecovacs.sucks' (most likely due to a circular import) (/config/custom_components/ecovacs/sucks.py)

bittles commented 1 year ago

It's helpful to have someone using it with an MQTT bot to flesh out this stuff. Honestly just made this originally because there wasn't a way to use bumper with HASS before, and wanted to get my head wrapped around some more python, git, and docker functionality.

Pushed v1.5.0 which avoids the circular import. Split out the api call to it's own module with it's own constants, and had the mqtt module just refer to the constants instead of calling the api class (which in turn had it's own calls to the mqtt module class). Now the api doesn't call the mqtt class at all, and the mqtt class doesn't call the api class at all, instead getting called individually higher up the food chain. No clue if this was an issue with bmartin's sucks fork but that never got a proper tie in to HASS and kept everything together in one module which probably helped avoid that.

Post errors if you get them.

Arn0uDz commented 1 year ago

Well the OZMO 900 I'm using is a MQTT one but I don't know anything about code I'm afraid, so can't help you.

I was hoping this custom integration would join the bumper on the MQTT server so that I could issue commands to the vacuum.

New error code: Logger: homeassistant.components.vacuum Source: custom_components/ecovacs/sucks_mqtt.py:157 Integration: Stofzuiger (documentation, issues) First occurred: 08:52:23 (1 occurrences) Last logged: 08:52:23

Error while setting up ecovacs platform for vacuum Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/ecovacs/vacuum.py", line 33, in setup_platform vacuums.append(EcovacsVacuum(device)) File "/config/custom_components/ecovacs/vacuum.py", line 59, in init self.device.connect_and_wait_until_ready() File "/config/custom_components/ecovacs/sucks.py", line 96, in connect_and_wait_until_ready self.send_ping() File "/config/custom_components/ecovacs/sucks.py", line 233, in send_ping self.request_all_statuses() File "/config/custom_components/ecovacs/sucks.py", line 261, in request_all_statuses self.refresh_statuses() File "/config/custom_components/ecovacs/sucks.py", line 252, in refresh_statuses self.run(GetCleanState()) File "/config/custom_components/ecovacs/sucks.py", line 272, in run self.send_command(action) File "/config/custom_components/ecovacs/sucks.py", line 269, in send_command self.iotmq.send_command(action, self._vacuum_address()) #IOTMQ devices need the full action for additional parsing File "/config/custom_components/ecovacs/sucks_mqtt.py", line 128, in send_command self.call_iotdevmanager_api(c ,verify_ssl=self.verify_ssl ) File "/config/custom_components/ecovacs/sucks_mqtt.py", line 157, in call_iotdevmanager_api url = (API_PORTAL_URL_FORMAT + "/" + API_IOTDEVMANAGERAPI).format(continent=self.continent) NameError: name 'API_PORTAL_URL_FORMAT' is not defined

bittles commented 1 year ago

Ehh forgot to import the constant API_PORTAL_URL_FORMAT that I split out. Hazards of not being able to test it myself. Getting pretty close now though I think. V1.5.1 is pushed out with the fix.

Arn0uDz commented 1 year ago

The error messages are gone but it doesn't do what I expected it to do and that is join the MQTT server on the bumper page so I can control it.

I have gone and bought a different vacuum that can be rooted. Thanks for your efforts!

bittles commented 1 year ago

Did you have the DNS forwarding setup? One problem I had even after forwarding setup was my DNS using cached vales for ecouser servers which was fixed by clearing DNS cache.

Arn0uDz commented 1 year ago

Yeah I had the DNS forwarding and checked the log in my PiHole to see what it was doing. Forwarding was working.

bittles commented 1 year ago

Any chance you can turn on debug in bumper and send me the first few minutes of the log? If not no biggie, more curious than anything.

Arn0uDz commented 1 year ago

Already removed the Docker container and DNS changes.

Thanks for offering though.