ad-automoli
ad-automoli copied to clipboard
`disable_switch_entity` only if automoli switched a light on
My use case:
- i have a light strip in the kitchen which is switched on based on illuminance and motion
- if it's on and I additionally switch on other lights, I would like to disable
automoli
In my understanding, disable_switch_entity
switches automoli
off completely. Is my use case covered by an existing functionality already?
Is there something that I could provide as additional input to that issue? I still see that I am missing that functionality and I am not sure how I could simulate that in pure HA YAML.
I am currently very busy due to the university. Be back in december for my open source projects... So, give me just a few more weeks 👍
Would you have a conceptual idea how this could work? Then I could try implementing it.
Something like tracking in a dictionary which lights have been switched on by automoli?
tl;dr: duplicate the self.disable_switch_entities set and self.is_disabled() function but check only in lights_off and not in lights_off and lights_on like self.is_disabled()
Hm my first idea would be an only_on
option/mode to control this behavior which you could enable when you switch on additional lights (maybe an automation or something...).
This option could then be checked similar to the "humidity above threshold" condition. The humidity conditions originate from showering - if humidity is high because someone has a shower, automoli will not switch off the light.
If so, you could try something quick and dirty like
self.only_on_entities: Set[str] = self.listr(self.args.pop("only_on_entities", set()))
around line 144 (similar to "disable_switch_entities")
and
if any([bool(await self.get_state(entity) == "on") for entity in self.only_on_entities]):
return
above the linked shower check around line 424.
A little more elegant would be to duplicate the is_disabled() function to is_only_on() and implement accordingly. checking could then be placed below the is_disabled check
If anything is unclear, feel free to ask :)
Something like tracking in a dictionary which lights have been switched on by automoli?
This already happens. AutoMoLi saves handles (strings) there if it switched on the lights (to keep track to switch it off later). see self.handles and the clear_handles() and refresh_timer() functions
should be fixed by your own #56