Hi,
I have exposed a switch in HomeKit as “Switchable” and I noticed when I turn on the switch in Home App it sends 4-5 times ON commands to OH. Is it supposed to be like that?
I have rules supposed to be triggered by ON command, and the rule is running multiple times when I switch on the switch, hence I’d very much like to fix it.
I know I can trigger based on change from OFF to ON, however I want to differentiate command from update, and there is no trigger in DSL allows me to say “received ON command when current state is OFF”…
I can’t say whether this is how it’s supposed to work. But your options are:
- Use the Debounce rule template to wait for the commands to stop coming before accepting the command. However, this will introduce latency as it will have to be a certain amount of time after the last ON command before it forwards it on.
- Rework your rules so they operate on changes instead of commands
- Put a timeout in the rule to ignore (e.g. immediately exit) if it’s too soon after the last processed command. Save a timestamp in the cache and return if it’s been < a second (for example) since that timestamp. If it’s been longer, process the command and save
now
as the timestamp.