Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[boschindego] Provide faster channel updates #13192

Merged
merged 4 commits into from
Jul 31, 2022

Conversation

jlaur
Copy link
Contributor

@jlaur jlaur commented Jul 29, 2022

This pull request implements a balanced way of using the API in order to provide faster updates and reduced load when fast updates are not needed. In addition, position tracking is now automatically requested when mower is active. This allows for updating the map with a frequency as high as six seconds between refreshes.

Some details:

  • The most expensive call, /operatingData (contacting the robot), was previously called every three minutes (with default configuration). This has now been changed to every six hours when idle and every two minutes when active or charging. For a mower running one hour every day and charging 30 minutes, this reduces the number of calls per day from 480 to 49 while at the same time providing faster updates. It also fixes an issue with the display being always on, since this call wakes up the device.
  • The most common call, /state, was previously called every three minutes (with default configuration). This has now been changed to every three minutes when idle, every two minutes when charging and every 30 seconds when active (in which case the result now includes updated map positions). For the same mower example, this increases the number of calls from 480 to 585 if the map channel is linked.
  • The last/next cutting times are still updated once per hour, but additional updates have been reduced and at the same time been made more accurate. For example, the last cutting time will now be updated before the mower even returns to the dock.
  • State update after triggering commands has been fixed to wait for new state and then start receiving updates with a frequency according to the need. Previously state would be refreshed before actually changed, so when starting a mowing session it could take up to three minutes to update state accordingly.

Related to:

@jlaur jlaur added the enhancement An enhancement or new feature for an existing add-on label Jul 29, 2022
@jlaur jlaur force-pushed the 13182-boschindego-api-balancing branch from 8356b20 to 9def385 Compare July 29, 2022 22:12
Add position tracking (on map)

Provide faster updates when active

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur jlaur force-pushed the 13182-boschindego-api-balancing branch from 9def385 to 00f2db7 Compare July 29, 2022 22:14
@jlaur jlaur marked this pull request as ready for review July 29, 2022 22:17
@jlaur jlaur requested a review from jofleck as a code owner July 29, 2022 22:18
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
@jlaur jlaur force-pushed the 13182-boschindego-api-balancing branch from 5033779 to 56e5bb4 Compare July 30, 2022 11:38
@jlaur jlaur requested a review from a team July 30, 2022 12:10
@jlaur
Copy link
Contributor Author

jlaur commented Jul 30, 2022

This PR is mostly an enhancement with faster updates and especially almost real-time map position tracking.

However, the first mentioned point about operating data requests can be considered a fix for a regression in #12938. At that time I was not aware that this request would wake up the device, effectively keeping it awake all the time (poll frequency three minutes, time for going to sleep 10 minutes).

Therefore it would be very nice to get ready in time for the first 3.4 milestone release to avoid potentially a lot of robots being contacted through the service way too many times. Potentially Bosch could take counter-measures and we could get into the same situation as the Gardena binding with HTTP error 429 ("Too Many Requests"). While working on this PR I have only experienced that a single time during some heavy testing with binding, app and Postman performing requests simultaneously. FYI @openhab/add-ons-maintainers

jlaur added 2 commits July 30, 2022 22:10
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank ypu

@lolodomo lolodomo merged commit 2de6dd0 into openhab:main Jul 31, 2022
@lolodomo lolodomo added this to the 3.4 milestone Jul 31, 2022
@jlaur jlaur deleted the 13182-boschindego-api-balancing branch August 15, 2022 21:08
leifbladt pushed a commit to leifbladt/openhab-addons that referenced this pull request Oct 15, 2022
* Optimize API calls for reduced load
* Add position tracking (on map)
* Provide faster updates when active
* Optimize state update after triggering commands
* Clean up duration variables
* Add initial test coverage for DeviceStatus

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
* Optimize API calls for reduced load
* Add position tracking (on map)
* Provide faster updates when active
* Optimize state update after triggering commands
* Clean up duration variables
* Add initial test coverage for DeviceStatus

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
andrasU pushed a commit to andrasU/openhab-addons that referenced this pull request Nov 12, 2022
* Optimize API calls for reduced load
* Add position tracking (on map)
* Provide faster updates when active
* Optimize state update after triggering commands
* Clean up duration variables
* Add initial test coverage for DeviceStatus

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
psmedley pushed a commit to psmedley/openhab-addons that referenced this pull request Feb 23, 2023
* Optimize API calls for reduced load
* Add position tracking (on map)
* Provide faster updates when active
* Optimize state update after triggering commands
* Clean up duration variables
* Add initial test coverage for DeviceStatus

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Feb 28, 2023
* Optimize API calls for reduced load
* Add position tracking (on map)
* Provide faster updates when active
* Optimize state update after triggering commands
* Clean up duration variables
* Add initial test coverage for DeviceStatus

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants