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

[Request] Changing polling interval behavior #112

Closed
Write opened this issue Mar 27, 2022 · 4 comments
Closed

[Request] Changing polling interval behavior #112

Write opened this issue Mar 27, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@Write
Copy link

Write commented Mar 27, 2022

Hi, my Roomba makes a huge coil whine as well as LEDs On, when connected to it (either app opened, or this plugin).

I would like to change the behavior to the polling system, maybe add multiples mode.
My idea is to have 3 modes : Interval, on HomeKit opening, and Hybrid.

  • In Interval mode (actual system) we could choose the interval between each polling.
  • On HomeKit Opening would only pool Roomba when HomeKit app is Open (or Homebridge, ofc). I guess it would cripple a lot of functionality, as well as automation based on sensors state, but I can't stand anymore the coil whine sound.
  • Hybrid would allow to pool immediately on HomeKit opening, but also add an option for less frequent pooling (For example, 5 minutes), this would allow sensors automation to still work, even if it would take 5 minutes, it's not really important.

Thanks a lot for reading.

Edit :

After watching the source code, such behavior is already implemented, though, timers should be able to be changed through the config.

I don't know exactly how HomeKit Sensors automation work. I'm guessing that we must actively watch Roomba's status if we want to do so.

Would be great to have the status constantly refreshed only while cleaning, and such timer cancelled if docked and charging.
If we instruct Roomba to go home, use WATCH_IDLE_TIMEOUT_MILLIS timeout instead.
That would allow sensors automation while not constantly pulling status (and waking up it's led + coil whine).

Thanks.

@Write
Copy link
Author

Write commented Mar 30, 2022

I made a patch to implement a new TIMEOUT timer, which keeps the plugin actively watching Roomba while the vacuum is busy. (Either if not charging or running or docking).

Once the Roomba is not 'busy' anymore, it'll decrease then decrease this new timer, instead of WATCH_IDLE_TIMEOUT_MILLIS.

WATCH_IDLE_TIMEOUT_MILLIS would still be used of course, for example when the Home app is opened.

This allows me to put a much shorter WATCH_IDLE_TIMEOUT_MILLIS while still watching actively the Roomba when it's running or not charging.

My code certainly doesn't respect best practice, and maybe out of the scope of this plugin.

Either way, there is the link of my fork accessory.ts.

And the commit's link

@karlvr
Copy link
Collaborator

karlvr commented Nov 19, 2022

@Write thank you for this description of your thinking. This sounds like a good addition. I will take a look at what you've done today—I've already looked at it in the context of #127, but this information will help me to understand what you're intending.

I wanted to avoid adding too many configuration options. I wonder if the only timing configuration people might need is how often to check status when Roomba is idle, to support automations etc.

@karlvr
Copy link
Collaborator

karlvr commented Nov 19, 2022

@Write I've decided to adapt what you've done along with refactoring the connect and watching parts of the plugin. I've referenced the relevant commits above. As above, I'm aiming not to have too many configuration options, but I have added the option for how long the long watch interval should be. Please take a look and let me know what you think; if I've captured everything that you intended; and if it works in your situation.

@karlvr karlvr assigned Write and unassigned karlvr Nov 19, 2022
@karlvr karlvr added the enhancement New feature or request label Nov 19, 2022
@karlvr
Copy link
Collaborator

karlvr commented Nov 22, 2022

The new behaviour is released in v1.4.0. Please re-open this issue if there are any problems or deficiencies.

@karlvr karlvr closed this as completed Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants