Hi guys,
At a loss here as HA dev panel doesn’t give me any errors to work back from.
Made my first script in scripts.yaml, set to !include this file. Script:
- door_bell_daytime_weekday:
alias: Door bell daytime weekday
sequence:
- condition:
condition: and
conditions:
- condition: sun
after: sunset
after_offset: "-01:00:00"
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- service: switch.turn_on
entity_id: switch.scrolling_lights
- delay:
seconds: 5
- service: switch.turn_off
entity_id: switch.scrolling_lights
HA gives me a notification window that the script component/platform couldn’t be loaded and to check my config but I don’t know where to start!
j.assuncao
(Jorge Assunção)
January 13, 2018, 4:17pm
2
I think you can’t have conditions inside a script…
Indentation is wrong.
Remove the hyphen at the start.
You can have conditions in scripts FYI.
door_bell_daytime_weekday:
alias: Door bell daytime weekday
sequence: # Everything below here needs to be 2 spaces farther out
- condition:
condition: and
conditions:
- condition: sun
after: sunset
after_offset: "-01:00:00"
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- service: switch.turn_on
entity_id: switch.scrolling_lights
- delay:
seconds: 5
- service: switch.turn_off
entity_id: switch.scrolling_lights
(I would’ve added the spaces but I’m on my phone )
finity
January 13, 2018, 6:33pm
4
also check all of your indenting. it looks like there are several places where the indentation is off.
door_bell_daytime_weekday:
alias: Door bell daytime weekday
sequence:
- condition:
condition: and
conditions:
- condition: sun
after: sunset
after_offset: "-01:00:00"
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- service: switch.turn_on
entity_id: switch.scrolling_lights
- delay:
seconds: 5
- service: switch.turn_off
entity_id: switch.scrolling_lights
I think the above is correct. double check me on it tho.
Thanks guys, it was partly the indenting and partly the first condition: line was un-needed, it starts on the condition: and line just fine.
I figured it was indent related, I actually fixed it before coming back to the forum by deleting all my indents and re-doing them after I’d written all the code, it seems easier in my brain that way!
j.assuncao
(Jorge Assunção)
January 14, 2018, 10:03am
6
I didn’t know that. Sorry…