hareeshmu
(Hareesh M U)
September 11, 2016, 3:31pm
1
In this automation, I have a notify and 2 lights which will turn on at a 18:55.
It was working since version .24
After update to .25 +, only notify and first light only working. 2nd light not working and the light switch status not changing in the UI.
Is there anything am I missing here?
Kindly suggest.
automation 4:
alias: ‘Light On’
trigger:
platform: time
after: “18:55:00”
action:
service: notify.mypushbullet
data:
message: ‘Turning ON Lights!’
title: ‘Home Assistant’
service: switch.turn_on
entity_id: switch.relay_2_1
service: switch.turn_on
entity_id: switch.relay_2_3
rpitera
(Robert Pitera)
September 11, 2016, 3:40pm
2
Please format your code so it preserves the indents. Select the code and then press the preformatted option button as indicated in this image:
PtP
(Mike)
September 11, 2016, 3:49pm
3
@hareeshmu
There are a few ways to go about this but I would do this because I am a noob, and yes please use the < / > in the tool bar.
Create a…
Script
timed_light_plus_notify:
sequence:
- service: notify.mypushbullet
data:
message: "Turning on Lights!"
- service: switch.turn_on
data:
entities:
- switch.relay_2_1
- switch.relay_2_3
Then I would create a…
Automation
- alias: Lights On
trigger:
platform: time
after: '18:55:00'
action:
service: script.turn_on
entity_id: script.timed_light_plus_notify
Like I said I am sure there are better, faster ways but this will work.
Regards,
1 Like
hareeshmu
(Hareesh M U)
September 11, 2016, 4:34pm
4
@PtP Thank you for your suggestion. I will try this out.
I was using mobile and didn’t find the toolbar as it was hidden by default. Sorry for the inconvenience if any.
automation 4:
- alias: 'Light On'
trigger:
platform: time
after: "18:55:00"
action:
- service: notify.mypushbullet
data:
message: 'Turning ON Gate Light!'
title: 'Home Assistant'
- service: switch.turn_on
entity_id: switch.relay_2_1
- service: switch.turn_on
entity_id: switch.relay_2_3
PtP
(Mike)
September 11, 2016, 4:41pm
5
No worries!
I have not tested your code but maybe indenting both of your entity_ids under the second and third - service by 2 spaces might help.
Or…
- service: switch.turn_on
entities:
- switch.relay_2_1
- switch.realy_2_3
hareeshmu
(Hareesh M U)
September 12, 2016, 3:12am
6
This method didn’t work.
ERROR:homeassistant.util.yaml:mapping values are not allowed here
- service: switch.turn_on
entities: #Error is in this line
- switch.relay_2_1
- switch.realy_2_3
PtP
(Mike)
September 12, 2016, 3:27am
7
timed_light_plus_notify:
sequence:
- service: notify.mypushbullet
data:
message: "Turning on Lights!"
- service: switch.turn_on
data:
entity_id:
switch.relay_2_1
- service: switch.turn_on
data:
entity_id:
switch.relay_2_3
Break them up into 2 or create a group.
hareeshmu
(Hareesh M U)
September 12, 2016, 4:21am
8
Thank you for the suggestion. However, I tried using script and break them in to two items. But didn’t succeed.
Its executing till the “light 1 On”. But the second light didn’t Turn On and UI didn’t update.
Here is the code i have used. Is it a bug or it will not support to a call the same service (service: switch.turn_on) with different entity_id 's.
script:
timed_light_plus_notify:
sequence:
- alias: Push Notification Lights On
service: notify.mypushbullet
data:
message: 'Turning ON Gate Light!'
title: 'Home Assistant'
- alias: light 1 On
service: switch.turn_on
data:
entity_id: switch.relay_2_1
- alias: light 2 On
service: switch.turn_on
data:
entity_id: switch.relay_2_3
automation 4:
- alias: 'Light On'
trigger:
platform: time
after: "09:14:00"
action:
service: script.turn_on
entity_id: script.timed_light_plus_notify
I will now try using the groups as you suggested.
devdelay
(devdelay)
September 12, 2016, 4:24am
9
- service: switch.turn_on
entity_id:
- switch.relay_2_1
- switch.realy_2_3
3 Likes
hareeshmu
(Hareesh M U)
September 12, 2016, 4:30am
10
@devdelay I tried this as well, didnt work.
hareeshmu
(Hareesh M U)
September 12, 2016, 4:34am
11
I ended up doing like this, its working now.
But its too much code duplication, is there any better way to achieve this?
automation 4:
- alias: 'Light1 On'
trigger:
platform: time
after: "10:00:00"
action:
- service: notify.mypushbullet
data:
message: 'Turning ON Gate Light!'
title: 'Home Assistant'
- service: switch.turn_on
entity_id: switch.relay_2_1
automation 5:
- alias: 'Light2 On'
trigger:
platform: time
after: "10:00:00"
action:
- service: notify.mypushbullet
data:
message: 'Turning ON Varantha Light!'
title: 'Home Assistant'
- service: switch.turn_on
entity_id: switch.relay_2_3
PtP
(Mike)
September 12, 2016, 4:38am
12
Appdaemon
If you know Python
I am pretty sure the yaml you posted before last was close. You don’t use aliases in a sequence.
Best of Luck!!
devdelay
(devdelay)
September 12, 2016, 4:48am
13
automation 4:
- alias: 'Light1 On'
trigger:
platform: time
after: "10:00:00"
action:
- service: notify.mypushbullet
data:
message: 'Turning ON Gate Light!'
title: 'Home Assistant'
- service: switch.turn_on
entity_id: switch.relay_2_1
- service: notify.mypushbullet
data:
message: 'Turning ON Varantha Light!'
title: 'Home Assistant'
- service: switch.turn_on
entity_id: switch.relay_2_3
2 Likes
hareeshmu
(Hareesh M U)
September 12, 2016, 4:48am
14
@PtP Thank you for your support, I don’t know much on Python, anyways I will try Appdaemon .
I had tried with out alias as you suggested, but no luck, hence tried using alias as well.
I saw the alias is the sample script https://home-assistant.io/components/script/
I’m very glad that we have such a great community here to help each other.
PtP
(Mike)
September 12, 2016, 4:53am
15
You’re welcome! @hareeshmu
Good luck!
hareeshmu
(Hareesh M U)
September 12, 2016, 5:02am
16
@devdelay This worked!! Thank you very much.
Is it worked because we have added another notify service in between the switch service?
Very strange and confused
automation 4:
- alias: 'Lights On'
trigger:
platform: time
after: "10:25:00"
action:
- service: notify.mypushbullet
data:
message: 'Turning ON Gate Light!'
title: 'Home Assistant'
- service: switch.turn_on
entity_id: switch.relay_2_1
- service: notify.mypushbullet
data:
message: 'Turning ON Varantha Light!'
title: 'Home Assistant'
- service: switch.turn_on
entity_id: switch.relay_2_3
Rich_Paul
(Rich Paul)
November 3, 2017, 10:46pm
18
Use a comma to turn more than one entity on:
entity_id: switch.relay_2_1, switch.relay_2_3
gerard33
(Gerard 🇳🇱)
November 21, 2017, 10:33pm
19
I can confirm that this works
- alias: Zet lampen tuin automatisch aan bij zonsondergang
trigger:
- platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: -4 # Solar elevation. This is the angle between the sun and the horizon. Negative values mean the sun is below the horizon.
action:
- service: light.turn_on
data:
entity_id: light.achtertuin, light.voortuin, light.voortuin_dubbel
brightness_pct: 60
color_name: white
and this doesn’t
- alias: Zet lampen tuin automatisch aan bij zonsondergang
trigger:
- platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: -4 # Solar elevation. This is the angle between the sun and the horizon. Negative values mean the sun is below the horizon.
action:
- service: light.turn_on
data:
entity_id: light.achtertuin
brightness_pct: 60
color_name: white
- service: light.turn_on
data:
entity_id: light.voortuin
brightness_pct: 70
color_name: white
- service: light.turn_on
data:
entity_id: light.voortuin_dubbel
brightness_pct: 70
color_name: white
Strange that the 2nd yaml code doesn’t work.
Mutt
(Muttley)
December 13, 2017, 12:40am
20
I’m with gerard33 here,
As I read it there should be no reason why his second code doesn’t work over the first.
In fact I would say the second (though longer) is more flexible as I want to set data, data_template, light.turn_on AND a light.turn_off from a given trigger
This implies you have to pick one and repeat triggers ???
Confused as hell
Mutt