Warm-up and cool-down delays in media players #118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for an additional delay when turning media players on/off.
I have some devices that cannot receive IR commands until some seconds after turning on. Same goes for turning off: it's not possible to send "turn-on" commands immediately after turning off.
Because of that it's impossible to make a script in HA that (1) turn on, (2) set source, (3) start playing, without adding explicit delays to the script.
Example definition:
In this example, after being turned on from an off state, subsequent commands will be delayed by 7 seconds. Turning off will block subsequent commands for 4 seconds.
Implementation details
A simple way to implement this would be to simply do an additional delay after turn on/off commands. However, this create some unnecessary blocks. Instead, after the on/off call, it simply calculates at what time new commands can be processed. Then, any waiting is done in the preceding calls.