Hello @h4nc,
you raise a good point about tracking the Eve Aqua state in Home Assistant.
I have two strategies for that.
Strategy 1
Control the Eve Aqua from Home Assistant only. That means the state in Homekit is a “slave” of Home Assistant
Use only the state in Home Assistant.
Strategy 2
Here is how I prevent loops from happening.
You will need to write a slightly more complex automation in Homekit
- automation: if switch eve-ha turns on call scene sc-eve-on
will be rewritten to: - if switch eve-ha turns on then if “device Eve Aqua” is in use then (nothing) else call scene
sc-eve-on
The additional if statement will break the loop. If you switch on Eve Aqua in Homekit then eve-ha will turn on in Home Assistant. This will trigger the iOS automation. The iOS automation will only switch on Eve Aqua if it is not already “on”. If Eve Aqua is already “on” the automation ends and the loop is broken.
See the attached screen shot
Note 1:
I am forced to use ‘if device “eve aqua” is in use’ because iOS Shortcuts app does not give me the option to code ‘if device xxx is not in use’
Note 2:
the comparison “in use” could also be “Active”.
I have to test this automation, but I hope you will get the idea
Note 3:
It seems the Homekit automations trigger on state changes (and not the state of a Homekit device). To be safe I will add the “additional if statement” in the iOS shortcut automation anyway.
Note 4:
As a final “fail safe” (in case Home Assistant dies, automations stop half way) I have limited the “open time” of Eve Aqua to 10 seconds. This is an option in the Eve app. I am using Eve Aqua in my “Pigeon Reponse System” to scare away pigeons in my garden so 10 seconds is more than enough (that is a topic for an entirely different thread).