Closed llauren closed 8 years ago
Wouldn't it be better to implement this with a rule in your automation?
#Copied from example code on home-assistant.io with addition of time condition
automation:
trigger:
platform: sun
event: sunset
offset: "-00:45:00"
condition:
- platform: state
entity_id: group.all_devices
state: home
- platform: time
before: "20:00:00"
action:
service: homeassistant.turn_on
entity_id: group.living_room_lights
I don't think so. The rule you propose won't catch the situation where i come home after sunset
(but before before
). For that, i'll need to write the rule to trigger on the homecoming of group.all_devices
on the condition that time is between sunset
and before
. Furthermore, i'll need to write rules to check whether group.all_devices
leave home during that same interval. Four rules in all.
@llauren Ahh, misinterpreted what you where trying to accomplish. If you want to be more specifik I could happily try and write those rules out for you. Not much of a coder but that I can at least do.
My automation currently has those four rules and they're just not very pretty to watch, nor are they very maintainable. Abstracting away all the mess behind one automation rule would be my way to go, assuming my diff above actually does that.
I could copy-paste my automation rules here for making my rule-bugs shallower, but that doesn't make those configs any prettier...
This seems like it would be a perfect fit for the new "apps" functionality
Indeed! I took a look @acockburn 's AppDaemon (i suppose that's the apps you suggested) architecture, and while i've yet to write my first one, i was rather impressed!
Can this issue be closed?
Home Assistant release (
hass --version
):0.15.0
Python release (
python3 --version
):Python 3.4.3
Component/platform:
components/device_sun_light_trigger.py
Description of problem:
The presence based lights automated by
device_sun_light_trigger
should not turn on after it's sleepy time.Expected:
I suggest the attribute
before: 'HH:mm'
to be added to thedevice_sun_light_trigger
configuration and the following bits added to thedevice_sun_light_trigger.py
code. Alas, i am no developer, so i don't know how to actually contribute to the project correctly, nor if this code in fact is kosher.Additional info:
automation/time.py
component.