Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Integration needs to be reloaded to get current state of mower #215

Closed
mashdk opened this issue May 19, 2024 · 24 comments
Closed

Integration needs to be reloaded to get current state of mower #215

mashdk opened this issue May 19, 2024 · 24 comments
Labels
bug Something isn't working question Further information is requested

Comments

@mashdk
Copy link

mashdk commented May 19, 2024

The integration work, and if I use the service, for example to send the mower to the docking station or to start mowing, it works.

But the shown current state is not updated, until I reload the integration.

@sander1988
Copy link
Owner

It should update right away after a state change of the mower. Normally it's around 1 second delay. I have seen some cases where it takes a bit longer (but still < 10s); but in these cases the state update event was delayed on the Bosch cloud side.

Do you have any errors in the logs? Otherwise there not much we can check.

@JensMKofoed
Copy link

JensMKofoed commented May 19, 2024

I've similar issues. I also lost updates.
background:
When spring final arrived Denmark (1 month ago), I setup my indego again but I had lost access to the unit. Therefore I removed the entity, updated Home Assistant to version 2024.4 and setup my unit again and everything worked fine. But last week I updated home-assistent core to 2024.5.3 and I got multi issues.
My scripts used to use the service "Bosch Indego Mower: command" to send the data: mow, returnToDock or pause to the indego but does not work any more. I had to change the script to use a vacuum service instead.
And I also does not get updates when the indego change states.

@JensMKofoed
Copy link

JensMKofoed commented May 19, 2024

I just removed my integration again. Updated core to version 2024.5.4 install/downloaded the Bosch Indego integration again (release: 5.6.1) rebooted the home-assistant and added my indego again.
Just got this in the error log:

`Logger: custom_components.indego
Kilde: custom_components/indego/init.py:631
integration: Bosch Indego Mower (dokumentation)
Første forekomst: 16.58.34 (1 forekomster)
Senest logget: 16.58.34

Mower state update failed, reason: 502, message='Bad Gateway', url=URL('https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/903603793/state?longpoll=true&timeout=300&last=258')`

`Logger: homeassistant
Kilde: helpers/frame.py:203
Første forekomst: 16.59.34 (1 forekomster)
Senest logget: 16.59.34

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/indego/init.py", line 665, in _create_refresh_state_task
self._refresh_state_task = self._hass.async_create_task(self.refresh_state())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 816, in async_create_task
self.verify_event_loop_thread("async_create_task")
File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread
frame.report(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report
_report_integration(what, integration_frame, level, error_if_integration)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration
raise RuntimeError(
RuntimeError: Detected that custom integration 'indego' calls async_create_task from a thread at custom_components/indego/init.py, line 665: self._refresh_state_task = self._hass.async_create_task(self.refresh_state()). Please report it to the author of the 'indego' custom integration.`

`Logger: py.warnings
Kilde: runner.py:190
Første forekomst: 16.59.34 (1 forekomster)
Senest logget: 16.59.34

/usr/local/lib/python3.12/asyncio/base_events.py:1989: RuntimeWarning: coroutine 'IndegoHub.refresh_state' was never awaited handle = None # Needed to break cycles when an exception occurs.`
kind regards
Jens

@JensMKofoed
Copy link

If I open the Bosch Indego app on my phone, I lost update in Home-assistant. But I could still start and pause the unit from home assistant. And the updated came back on again.

@mashdk
Copy link
Author

mashdk commented May 19, 2024

If I open the Bosch Indego app on my phone, I lost update in Home-assistant. But I could still start and pause the unit from home assistant. And the updated came back on again.

That might actually also be the same in my case. I use the Indego app a lot.
Will try to observe, of I get the same result.

Regarding the Bad Gateway issue, it could be because, Bosch had a general issue at that time.
I couldn't connect to my Indego using the Bosch app around the same time.

@mashdk mashdk closed this as completed May 19, 2024
@mashdk
Copy link
Author

mashdk commented May 19, 2024

Oups, hit the wrong button. Weren't supposed to close this issue.

@mashdk mashdk reopened this May 19, 2024
@JensMKofoed
Copy link

Just checked the logs. Got 4 different errors logs from indego. All returned error 500.
Status has not been updated since 17.25, and now after rainsstopped I want the unit to start cutting again. My automation has started my indego, but lags updating the status.

indego Start/Stop Mowing: Error executing script. Unexpected error for choose at pos 1: 500, message='', url=URL('https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/903603793/state')

Logger: homeassistant.components.script.indego_return_to_dock
Kilde: helpers/script.py:501
integration: Script (dokumentation, problemer)
Første forekomst: 17.25.01 (17 forekomster)
Senest logget: 18.45.02

Indego return to dock: Error executing script. Unexpected error for call_service at pos 1: 500, message='', url=URL('https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/903603793/state')
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/indego/vacuum.py", line 121, in async_return_to_base
await self._indego_hub.async_send_command_to_client("returnToDock")
File "/config/custom_components/indego/init.py", line 514, in async_send_command_to_client
await self._indego_client.put_command(command)
File "/usr/local/lib/python3.12/site-packages/pyIndego/indego_async_client.py", line 171, in put_command
return await self.put(f"alms/{self.serial}/state", {"state": command})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyIndego/indego_async_client.py", line 559, in put
return await self._request(
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyIndego/indego_async_client.py", line 508, in _request
response.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1070, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 500, message='', url=URL('https://api.indego-cloud.iot.bosch-si.com/api/v1/alms/903603793/state')

@PiotrasHASS
Copy link

I have same issue
Status is nor Updating even a minute after it change state
I have to reloaded to get current state

@mashdk
Copy link
Author

mashdk commented May 20, 2024

If I open the Bosch Indego app on my phone, I lost update in Home-assistant. But I could still start and pause the unit from home assistant. And the updated came back on again.

A few tests seem to confirm this:
The integration stops updating status, if the official Bosch Indego app connects to the mower.

@PiotrasHASS
Copy link

Even im not using bosch app I can start mover but the status is not Updating that mover is running
All the automation with this mover are useless

@sander1988
Copy link
Owner

Based on your input I get the feeling the state longpoll (the way to monitor the realtime state changes) only work for one client. Maybe they have changes this behavior at the cloud side.

Doesn't it starts working again when you kill/quit the official app and wait 5 minutes (a longpoll has a timeout of 300s)?

And are using the latest release of develop version of this integration?

@eime88
Copy link

eime88 commented May 20, 2024

I have the exact same problem. Since 3 weeks the state is not updated anymore. I'm on the latest Home Assistant Version and have no idea what caused the problem.

@mashdk
Copy link
Author

mashdk commented May 20, 2024

Based on your input I get the feeling the state longpoll (the way to monitor the realtime state changes) only work for one client. Maybe they have changes this behavior at the cloud side.

Doesn't it starts working again when you kill/quit the official app and wait 5 minutes (a longpoll has a timeout of 300s)?

And are using the latest release of develop version of this integration?

I am on version 5.5.0 according to HA.

To me, it can go for days without updating. So it seems, it simply stops updating, once the official app has connected to the mower.

Wonder if it's a Bosch side change or the new version of HA.

@kimzeuner
Copy link
Contributor

I had the same issue that the integration stopped updating states randomly. After a reload of the integration it was working fine for hours an then stopped again. After updating to developer version 5.6.2 it is working fine now for two days.

@kimzeuner
Copy link
Contributor

Today it happened again also with developer version 5.6.2
Attached several screenshots of the failures that i found in the logs
image
image
image
image
image

@sander1988
Copy link
Owner

sander1988 commented May 24, 2024

I have not been able to reproduce the issue yet. I'm currently testing on HA 2024.4.3 ; it might be related to a newer version.

Some people did post logs with 5XX (like 500 or 502) errors. These errors are not related to this integration. I have seen these in several cases, a few examples:

  • Local connection errors / mower offline.
  • Bosch Cloud errors.
  • Sending impossible commands to the mower (e.g. requesting docking while it's already docked).

@sander1988 sander1988 added the bug Something isn't working label May 24, 2024
@sander1988
Copy link
Owner

sander1988 commented May 25, 2024

I did some tests over the past few days. I can't reproduce the issue. I have tested with multiple apps and HA instances at the same time and also with the latest release (2024.5.4) of HA.

I have still some idea's about why it might not working in your case. But I will need some debug logs using the latest develop version in order to continue investigating. Also report the exact time when it stops updating ; so I know where to look in the logs.

Make sure you enable full logging of this component and it's library by adding this the your HA config:

logger:
  logs:
    custom_components.indego: debug
    pyIndego: debug

@sander1988 sander1988 added the question Further information is requested label May 25, 2024
@sander1988
Copy link
Owner

sander1988 commented May 28, 2024

I finally see a state update error in one of my setups similar to this issue ;-)

It seems that the Bosch API has to fail several times, then the wait feature kicks in (to prevent overloading the API) but it never returns from the wait. I will look into that.

sander1988 added a commit that referenced this issue May 28, 2024
@sander1988
Copy link
Owner

Fix is on the develop branch.

@JensMKofoed
Copy link

Hi @sander1988 I just tried update my version to 5.7.0, but I got failuer connecting: [CCD234] Request to 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms' failed with HTTP status code: 403
I tried to delete my integration and reinstalled and reconnect my unit again, same issue?

@JensMKofoed
Copy link

I changed the user agent to: Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1

@quinten94b
Copy link

Hi @sander1988 I just tried update my version to 5.7.0, but I got failuer connecting: [CCD234] Request to 'https://api.indego-cloud.iot.bosch-si.com/api/v1/alms' failed with HTTP status code: 403 I tried to delete my integration and reinstalled and reconnect my unit again, same issue?

Similar issue here. Unable to load integration on 5.7.0b.
Downgrade to 5.6.1 fixes the issue, but refreshing issue persists.

@eime88
Copy link

eime88 commented May 31, 2024

Why is this issue closed? There seems to be a problem with 5.7.0b

@sander1988
Copy link
Owner

Why is this issue closed? There seems to be a problem with 5.7.0b

The issue seen in de logs posted here is resolved. I was able to reproduce and test the fix afterwards.

If you still have a similar problem, then it's probably something else. In that case please create a new issue providing the new details. I have created an issue template to guide you providing the right information (you will see it when opening a new issue).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants