-
-
Notifications
You must be signed in to change notification settings - Fork 137
Description
Is your feature request related to a problem? Please describe.
I use HTTP-Shortcuts to control my vacuum cleaner running valetudo. I have shortcuts to change the absorbency and water usage. Shortcuts to start and pausing actions. I have a shortcut to display all valetudo notifications. Currently I cannot reflect the robots state in HTTP-Shortcut. Note, some actions (like a full clean up) take quite some time, so the state will change at some point, but a state change can happen now or in 1 hour. Or can be triggered by another user (which e.g. uses the Valetudo UI).
I would like that my shortcuts reflect the current state. E.g. the number of unread notifications should be shown in brackets in the actions title. The "start" action should be disabled when the robot is currently not idling....
Describe the solution you'd like
In addition to "global scripting" there should be a list of shortcuts which are (like multi shortcuts) executed one after the other. This list should be executed on a periodic basis (polling). The interval should be configurable. This would allow me to keep track of the current state and update my shortcuts accordingly.
Describe alternatives you've considered
I created an action to update (some parts) of the state and executed this shortcut in the "Run before Execution" phase. But this makes the actual shortcuts slower and the state is updated too late. Remember, that the state changes can be triggered externally (e.g. other users) and can take very long. Also the UX wasn't great as the UI was often blocked. I also tried to execute this "update" shortcut in global scripting.
Additional context
When implementing this a few things have to be considered:
- I think neither successful execution nor failures should be reported to the user. At most there should be toast about an error. Otherwise one might get spammed by full screen dialogs once the polling started.
- Maybe some parts of javascript should not be possible. E.g. user interaction.
- Or a circuit breaker is needed: Display the first error, display the second error, and maybe the third, but then decrease the polling interval.
- Polling should only be active when the app is a) open and b) the user is not editing shortcuts or changing settings.