Hello,
i just use simple configurations for starting home assistant. Now I´m trying to get my automations smarter for me.
I´ve trying to set up an automation with light scenes after sunset with transition. This is my yaml.file
alias: Licht Abends ein Transition
description: ‘’
trigger:
platform: sun
event: sunset
offset: "-15
condition: []
action:
service: scene.turn_on
data:
entity_id: scene.wohnzimmer_abends
transition: 600
service: scene.turn_on
data:
entity_id: scene.esszimmer_gedimmt
transition: 600
service: scene.turn_on
data:
entity_id: scene.esszimmer_gedimmt
transition: 600
This the error message: Message malformed: required key not provided @ data[‘action’]
Tried different thinks - but no solution. Whats the mistake?
EdwardTFN
(Edward Firmo)
October 15, 2022, 9:25am
2
It is an indentation issue… The row where you have action:
, remove all the white spaces.
EdwardTFN
(Edward Firmo)
October 15, 2022, 9:30am
4
Look, it would be much easier to help you if you format your code as a code:
Before we begin…
This forum is not a helpdesk
The people here don’t work for Home Assistant, that’s an open source project. We are volunteering our free time to help others. Not all topics may get an answer, never mind one that helps you solve your problem.
[image]
This also isn’t a general home automation forum, this is a forum for Home Assistant and things related to it. Any question about Home Assistant, and about using things with Home Assistant, is welcome here. We can’t help you with e…
alias: Licht Abends ein Transition
description: ''
trigger:
- platform: sun
event: sunset
offset: "-15
condition: []
action:
- service: scene.turn_on
data:
entity_id: scene.wohnzimmer_abends
transition: 600
- service: scene.turn_on
data:
entity_id: scene.esszimmer_gedimmt
transition: 600
- service: scene.turn_on
data:
entity_id: scene.esszimmer_gedimmt
transition: 600`Preformatted text`
Thank you, thats what I´m lokking for. Don´t now how to format the code copy&paste
browetd
(Browet Didier)
October 15, 2022, 9:35am
7
Your code should be (look at the documentation, the indentation used will help you to avoid this issue in the future):
alias: Licht Abends ein Transition
description: ‘’
trigger:
- platform: sun
event: sunset
offset: "-15"
condition: []
action:
- service: scene.turn_on
target:
entity_id: scene.wohnzimmer_abends
data:
transition: 600
- service: scene.turn_on
target:
entity_id: scene.esszimmer_gedimmt
data:
transition: 600
- service: scene.turn_on
target:
entity_id: scene.esszimmer_gedimmt
data:
transition: 600
Thank you, i tried this also in different ways. But always get the same error.
Tried to save your code as well - same error.
browetd
(Browet Didier)
October 15, 2022, 9:38am
9
Retry, I had a indentation problem as well…
browetd
(Browet Didier)
October 15, 2022, 9:40am
10
You were missing a double quote at the “offset” parameter
That´s it - man, thank you. I tried so many formations but the double quote…
Saved - thank you.
1 Like
pedolsky
(Pedolsky)
October 15, 2022, 9:44am
12
You can simplify the action part:
- service: scene.turn_on
data:
transition: 600
target:
entity_id:
- scene. wohnzimmer_abends
- scene. esszimmer_gedimmt
Thank you, much more easier. I see…a lot to learn
aceindy
(Aceindy)
October 15, 2022, 10:10am
14
What i don’t get is, why people, especially the newbies, keep on trying to add it manually
Devs are putting so much effort to avoid it…
And once the basic framework is working, you can try to edit it manually
1 Like
Hey, tried also this but don´t now how to select a scene there
There for I tried it manually.
pedolsky
(Pedolsky)
October 15, 2022, 10:23am
16
You’ve already used the service call scene.turn_on
. It’s also provided by the UI Editor.
Yes, but how to select a light.scene there? Only the 3 choices
As I told you - beginner mistake.
pedolsky
(Pedolsky)
October 15, 2022, 10:38am
18
From the dropdown choose „Dienst ausführen“ / „execute service“ (don’t know what it’s called in the English UI) ——> scene.turn_on
and then click/tap the green button as often as you like.
Hallo, aber da sind ja nur die einzelnen Lichtquellen aufgeführt, aber keine Szenen. Das ist ja die Ursache warum ich auf manuell umgestiegen bin.
Hello, but there are only the individual light sources listed, but no scenes. That is the reason why I switched to manual.
pedolsky
(Pedolsky)
October 15, 2022, 10:50am
20
No offense but please take into account that the forums language is English
Strange. In my editor all scenes appear if I choose scene.turn_on
. If you are using Hue you can select hue.activate_scene