Generally, the setup behaves as expected. However, occasionally, the rule is triggered when I start an application on the FireTV and switches off receiver and TV just to instantly switch it on again. I assume that "/usr/bin/adb shell “dumpsys activity activities | grep ResumedActivity” returns null for a short period of time while the app is starting.
Is there a way to avoid this behavior? Perhaps by changing the rule in a way that it it ony triggeres if FireTVstate_returnValue==“off” for at least 1 minute? Or is there a perhaps a better way to check whether FireTV stick is in standby or not?
A timer is certainly a good idea. Thanky you very much for the suggestion. However, thus far I was only using GUI for the setup and script’s done with Blockly. As I understand, timers are not (yet) implemented in blockly, are they?
Any further input on how I would have to modify the script to include a timer would be highly appreciated.
I maybe have another generell question about rules. Can a rule be triggered again while it is still running or can only one instance of each rule exist at a time?
I am checking FireTVstate_returnValue every 3 seconds, as the rule also switches on power of TV/Receiver.
In OH3 it is one at a time, further triggers will be queued.
But don’t worry about that, when using timers properly a rule starts a timer with an independent existence, and then the rule will exit, ready to run again.
Next time, depending on conditions, it might cancel or reschedule the independent timer.
It’s a very common technique e.g. for door lights timers, and the current lack of it is a major Blockly handicap that is being worked on.
An alternative approach is to use a dummy Item with ‘expire’ feature scheduling. This is so basic that it is difficult to cancel or reschedule, but it can be done. A second rule can then trigger off the expring dummy Item to perform whatever action is needed.
EDIT - that reminded me to produce this
Meanwhile I have also discovered a way to modify/improve the bash script that runs with execbinding, so that it does not switch off randomly anymore. (The following script works for a FireTV 4K stick.)
I upgraded openhab and added the adb binding. It indeed seems to work flawlessly with the fireTV stack. Thanks again.
However, reaction time to trigger rules is rather poor.
I assume this is due to the refreshTime for status updates that is minimum 10 seconds. Do you by chance have an idea how I can accelerate reaction time when the state changes from “off” to "on?