This is very detailed and very well put together explanation. It makes a lot of sense. THANK YOU!!!
For the dimming, if the light is already on do I still use light.turn_on service if I want to dim it to a certain percent?
Yes you do. Unless it is a LIFX light. They have a special set_state service that allows you to set the options even with the off (so when it turns on it has the required brightness and colour). But as I said, only for LIFX lights.
Got it. I will play around with it. Thanks again.
Is there a way I can have a drop down of set times instead of manually entering times?
Instead of an input_date_time you could use an input_select for a drop down list.
input_select:
set_time:
name: Set Time
options:
- '0:00'
- '1:00'
- '2:00'
... all the way down to
- '22:00'
- '23:00'
Depending on the resolution required this could be a very long list of options. So unless you only have a few preferred times this is probably a bad idea.
Another way could be with two input_numbers (sliders), one for hours one for minutes. If you search the forums for ‘alarm clock’ you will find a few implementations of this. e.g. Creating a alarm clock
Note: you will have to adjust your automation trigger template for both these methods.
If I make this change I will need to reboot home assistant?
Yes.
There are a few reload services that you can use without restarting (you must have Advanced mode on iny our user profile to see this):
But for everything else you need to restart if you have made a change. e.g. input_numbers, binary_sensors, sensors, input_datetimes, etc…
Don’t forget to do a configuration check before reloading or restarting. If you find restarting a pain add your vote here:
I have this automation to turn on outside lights at sunset. Can I include another condition to turn off lights at sunrise. Can it be as one automation?
- id: 'Outdoor Lights Automation'
alias: Outdoor Lights Automation
trigger:
platform: sun
event: sunset
action:
- service: light.turn_on
entity_id: light.outside_all_around
- service: light.turn_on
entity_id: light.outside_wall
Would this work?
- id: 'Outdoor Lights Automation'
alias: Outdoor Lights Automation
trigger:
platform: sun
after: sunset
offset: "-00:30:00"
before: sunrise
action:
- service: light.turn_on
entity_id: light.outside_all_around
- service: light.turn_on
entity_id: light.outside_wall
No. Your sun platform trigger options are not correct.
Use two automations.
- id: outdoor_lights_on
alias: 'Outdoor Lights On'
trigger:
platform: sun
event: sunset
offset: '-00:30:00'
action:
- service: light.turn_on
entity_id: light.outside_all_around
- service: light.turn_on
entity_id: light.outside_wall
- id: outdoor_lights_off
alias: 'Outdoor Lights Off'
trigger:
platform: sun
event: sunrise
action:
- service: light.turn_off
entity_id: light.outside_all_around
- service: light.turn_off
entity_id: light.outside_wall
Anyway to combine those two automations into 1 automation?
Yes but I would not recommend it.
This way is simple and easy to understand when you come back to it in 3 months time.
Thanks!
How can I make this into a 12 hour AM/PM format for the start automation at. I know how to do it for the current time, but not for the input time. My template is coded to show 12 hour time, but the card still displays 24 hours
value_template: '{{ states(''sensor.time'') == (states.input_datetime.set_time.attributes.timestamp
| int | timestamp_custom(''%-I:%M %p'', False)) }}'
This value template doesn’t make any sense to me, this really works? Your template compares if the time from sensor.time is equal to the time of the converted timestamp from the input_datetime, so it should return either True or False and not a time.
Try this:
value_template: "{{ state_attr('input_datetime.set_time', 'timestamp') | timestamp_custom('%-I:%M %p', False) }}"
I implemented your value_template, but the time still shows in 24 hours.
Oh, I overread that you want to change the input_datetime. I don’t know and also don’t think that this is possible as you would need to change the config of the input_datetime and this has no option for 12AM/PM format.
Could it be done with a drop down menu input_select?
Maybe, but I don’t think so. Maybe you can create the options for the input_select how you want them and then use a value_template to somehow translate your selected value into a readable format for the automation.
So no matter what home assistant will need the time format for the input_datetime.set_time or input_select.set_time to be in 24 hour format?