I have looked at many youtube examples and written instructions on how to code an automation setup, but they always have way to much other details that muddy up the water.
I just need the most basic snipped of code to show me how to turn on a light (configured as a sonoff switch) that will activate at a given time. I am a experience programmer, but just need the basics here to get me started in the right direction.
Thank You.
P.S. After modifying the automation.yalm file, do I need to restart any services?
And this is what my automations.yalm consists of:
######################
- alias: Turn on Main Light
id: 'towulow'
trigger:
platform: time
at: '13:17:00'
action:
- service: light.turn_on
entity_id: switch.main_switch
#########################.
But it does not work.
I do notice here is that I have the time_zone set up to my correct region in the config.yalm file. And my Raspberry shows the correct time, but the the time shows a +9 hr difference on the main Hassio panel. But even when I change the time in the code to turn on the light to reflect this it still does not work
FYI, you donât need the time sensor just to get an automation to trigger at a specific time.
Your issue is youâre using the light.turn_on service with a switch. You either need to use the switch.turn_on service (preferable), or you could use the homeassistant.turn_on service. FYI, the latter can turn on any type of entity.
Switching from light.turn_on to switch.turn_on (since I was using a Sonoff switch) resulted in making this automation finally work.
But I had to add +9 hr to the time so it would coincide with what the time was showing up on the main Hasio page.
Florian:
I have the configuration.yalm file set to:
time_zone: America/Los_Angeles
But I know know why there is a time difference. I am using another raspberry pi to display the AppDaemon on a touch screen panel. And this time is set correctly. But now I just need now to change the correct time on the Hassio raspberry pi to also reflect the correct time.
Thanks all for your help. I am now literally out from the darkness with my switch.main_switch being able to turn on.