Automation using template, lights, temperature and scene

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
    ###################################

</>

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.

Ok, I did, Any idea

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?

No clue. Can’t read code that isn’t formatted properly.

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 %}