-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Feat/component poller suspend #5423
Feat/component poller suspend #5423
Conversation
Would it be possible to start the poller in suspended state at boot? The use case is, for example having to wait for a slave device to start up (as it's slower than the esp), before starting to poll it. |
I thought about that, and imo, the most elegant way to do that, would be to add an action: component.set_update_interval;
id: component_id
interval: xxxs This mr do allow to "dynamically update the interval" The only thing i did not understand is how to create an action with that template. That being, said, if i'm guided about how to implement those type of actions, i would probably do it as a separate pull request. I'd then solve this exact scenario this way:
|
Instead of another action to change the interval, you could add an |
So more something in the vein of component.resume:
id: fc_id
update_interval: 3s An extreme version would allow to merge those two actions via component.set_update_interval:
id: fc_id
update_interval: never
component.set_update_interval:
id: fc_id
update_interval: 5s
# possible helpers
component.set_update_interval:
id: fc_id
action: suspend
component.set_update_interval:
id: fc_id
action: resume If this would work, i'd be happy with a pointer to the correct class to declare the correct structure in python, I'm quite happy to update my mr but i'm struggling a bit to find how things work. |
Fast tentative, I'll debug it later today if it doesn't work, if the logic is sound, i'll redo my local tests, and update the documentation accordingly |
3eed0c8
to
d31d24e
Compare
Updated the example, seems it works correctly on my local devices. i've struggled a bit to understand the code generation logic, so i'm happy with any correction i might have to do |
f9637c9
to
014d134
Compare
7198031
to
9f78ad3
Compare
this is now possible by starting with update_interval: never, and doing a component.resume when the slow component booted up, and set the interval with the resume action |
9f78ad3
to
a0b9648
Compare
* Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377 * Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377 * Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377 * Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377 * Ensure filename is shown when YAML raises an error fixes #5423 fixes #5377
What does this implement/fix?
This pr aims at allowing suspend / resume of polling component update, this is mainly in place to help out with "slow component" when managing audio interractions.
PS: Took a bit of time to understand how to start the version of my pull request, tested and it does work as i expected
Tested on a D1 Mini & and C3 Pico
Types of changes
Related issue or feature (if applicable): fixes esphome/feature-requests#2301
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3205
Test Environment
Example entry for
config.yaml
:Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: