Using latest version of HA on Hassbian. Starting out trying some basic automation and its driving me insane!
Switches all work fine on manual activation and with Alexa (and with Alexa Groups too)
Automation problem 1:
- id: downstairs on
alias: Turn on the lights when the sun sets
initial_state: True
hide_entity: False
trigger:
platform: sun
event: sunset
offset: "-01:00:00"
action:
service: switch.turn_on
entity_id: switch.livingroom_led_light, switch.livingroom_lamp, switch.crystal_cabinet, switch.christmas_tree
This will run when triggered manually (at any time of the day, should it do this? Not had a sunset yet!), but switch.livingroom_led_light does not fire. It does not appear in the logbook where the other 3 do. Running the same automation with just this switch results in the same thing, no lights (switch is a Broadlink Pro RF command). The ‘off’ version of this automation results in the same.
Nothing happens when I run this. Running manually I get the automation trigger in the log but not the switch being fired. Nothing happens when it runs automatically, just appears in the log as triggered.
Automation problem 3
Using ‘after’ on ‘time’ platform like so:
trigger:
platform: time
after: "12:05:00"
Given me the following error and I don’t know why as other people seem to be able to use it no problem:
Really confused on these errors. entity ID’s have been triple checked, and its not the brand of plugs as I have some working and some not working from both sets I use (and all work outside of automations)
OK, here goes.
1: Manually triggering (no surprise - by it’s very definition) by passes the trigger and gets on with the action
Can you show us the broadlink definition of the switch?
2: The id and the alias both say you are turning on the lamp, but you are actually turning it off So if it’s already off it will stay off when triggered by automation or by manual trigger.
3: The docs state that you need to use at: not after:, to use after: you have to use it in conditions
To note - the livingroom_lamp switch is Generic Brand A and works in the automation - the craig_lamp is also from this set and does not.
2: Sorry, that was me playing around and testing if it was something to do with .on. Still fails to turn off or register it in the log either way round.
3: That makes sense. Where can I find the doc for ‘time’? I hunted for it but couldn’t find anything myself.
EDIT: Some further testing. I added the craig_lamp and julie_lamp to the partially working first automation. They still do not turn on or register in the log as having been called, where as the 3 working ones still do.
The working livingroom_lamp is the same brand as these 2, and the RF code seems to be the same length. They are formatted identically in the switches section, and there are no extra spaces etc hidden in there. I’m stumped as to why they are find when asked for but fail when automated.
The config fails without defining them as switches with the switch. prefix. switch.crystal_cabinet doesn’t exist in that format either but works, its just crystal_cabinet.
Yep sorry I was look at the friendly name :P, however a common error with the broadlink is that they need a couple of == at the end of the definition to complete the signal.
I suspected it might be that, I’ll give it a go next. Just about to test if doing it with a group gets any different results. Thanks, will update shortly!
== no good either. code still works manually. Name of switch changed, still nothing. I think something in HA is stopping the automation ‘seeing’ the entry for the switch.
Copied the christmas_tree switch RF codes in over the livingroom_led_lights and it refuses to turn the christmas tree on under that name, so its not the codes that are the problem here, something in HA is making it gloss over switches in certain positions in the switch list.
Going to try putting the livingroom_led_lights entry in the position the christmas_tree currently is.
EDIT: No change, still not working when the list was re-shuffled. I am out of ideas.
Notice how it’s called back_lights NOT livingroom_led_light
So…
automation:
- id: downstairs on
alias: Turn on the lights when the sun sets
initial_state: True
hide_entity: False
trigger:
platform: sun
event: sunset
offset: "-01:00:00"
action:
service: switch.turn_on
entity_id: switch.back_lights
Do they drink beer by the keg where you are from Keith? Think I owe you one!
Working perfect. I made the assumption (I would argue the logical one!) that it would call the name of the switch, not a modified friendly name. Sometimes I love and sometimes I loathe HA.