Hi All.
I am trying to turn on my lampshade with different colors depending on the temperature.
But when I run the automation the lampshade don’t turn on.
Someone can say what is wrong?
</>
automation
alias: Cube event tap_twice on
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_158d00010167ce
action_type: tap_twice
condition:
condition: state
entity_id: light.lampshade
state: ‘off’
action:
service: scene.turn_on
data_template:
entity_id: >-
{% if states(‘sensor.pws_temp_c’) | int >= 0 %}
scene.teste
{% elif states(‘sensor.pws_temp_c’) | int >= 10 %}
scene.teste
{% elif states(‘sensor.pws_temp_c’) | int >= 17 %}
scene.teste
{% endif %}
####### scene #######################
name: teste
entities:
light.lampshade:
state: on
brightness: 30
rgb_color: [255,0,255]
transition: 3
###################################
</>
gumbo
May 21, 2018, 12:04am
2
You might want to post your code using the preformatted text option </>.
It makes it easier to look at spacing errors if nothing else.
OK, I used </> and updated my code structure.
petro
(Petro)
May 24, 2018, 11:38am
5
No one will reply because you didn’t highlight the code and use the button. It’s still not formatted correctly, just look at your first post, does it look correct?
EDIT: This is how you format code:
mycode:
lookslike:
this:
Does It mean that the script is right and the problem would be the identation?
petro
(Petro)
May 24, 2018, 5:04pm
7
No clue. Can’t read code that isn’t formatted properly.
petro
(Petro)
May 24, 2018, 5:05pm
8
Again, Highlight your code chunk and use the format button. Edit your original post and use the format button.
indent preformatted text by 4 spaces
alias: Cube event tap_twice on
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_158d00010167ce
action_type: tap_twice
condition:
condition: state
entity_id: light.lampshade
state: ‘off’
action:
service: scene.turn_on
data_template:
entity_id: >-
{% if states(‘sensor.pws_temp_c’) | int >= 0 %}
scene.teste
{% elif states(‘sensor.pws_temp_c’) | int >= 10 %}
scene.teste
{% elif states(‘sensor.pws_temp_c’) | int >= 17 %}
scene.teste
{% endif %}