No, do not get an error message, I will add the code of my sonoff.
switch:
- platform: mqtt
name: "keukenkastje"
command_topic: "cmnd/keukenkastje/power"
state_topic: "stat/keukenkastje/POWER"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
Does this switch work if you trigger it manually?
Yes, I can manually switch the lamp on or off.
francisp
(Francis)
November 17, 2019, 2:14pm
24
And your switch ākeukenkastjeā is included in the group switches ?
Mutt
(Muttley)
November 17, 2019, 2:40pm
25
Guys, the name of the automation is invalid, it has a space in it.
People,
It works! I was unable to respond because I was new and had reached my response limit
This is the code:
automation 19:
- alias: 'Rule 2 - Away Mode'
trigger:
platform: state
entity_id: group.telefoon
to: 'not_home'
action:
service: switch.turn_off
entity_id: group.all_switches
But now I want the code that causes the lights to come on again when we get home, is only active between sunset and 11:30 PM. I tried everything but keep getting error messages.
Could you please your non-working code and the errors?
Try this:
automation 19:
- alias: 'Rule 2 - Away Mode'
trigger:
- platform: state
entity_id: group.telefoon
to: 'not_home'
condition:
- condition: sun
after: sunset
- condition: time
before: "23:30:00"
action:
- service: switch.turn_off
entity_id: group.all_switches
You do not believe it but I put āconditionā between you and suddenly no more error messages, very strange!
This is de code voor coming home:
automation 20:
- alias: 'Rule 2 - Away Mode'
trigger:
platform: state
entity_id: group.telefoon
to: 'home'
condition:
- condition: sun
after: sunset
- condition: time
before: "23:30:00"
action:
service: switch.turn_on
entity_id: switch.staandelamptv, switch.staandelampbank, switch.keukenkastje, switch.eettafellamp
I donāt know what you mean with āI put āconditionā between youā¦ā but Iām glad it works now
My thanks are very big, now on to the next problem haha, but Iāll make a new topic for that!
I believe he was speaking about his first code didnāt have any conditions just trigger and action