Failed to call service light/turn_on expected float for dictionary value @ data['brightness_pct']

I cant work out why I keep getting the
Failed to call service light/turn_on expected float for dictionary value @ data[‘brightness_pct’]

when using this button card config

show_name: false
show_icon: true
type: button
show_state: true
tap_action:
  action: call-service
  service: light.turn_on
  data:
    brightness_pct: |
      {% if (now().hour >= 23) or (now().hour <= 7) %}
        0.1
      {% else %}
        1
      {% endif %}
    color_temp: |
      {% if states('sun.sun') == 'below_horizon' %}
        rgb_color:
          - 255
          - 50
          - 0
      {% else %}
        370
      {% endif %}
  target:
    entity_id: light.wiz_rgbw_tunable_de5c9e
hold_action:
  action: call-service
  service: light.turn_off
  target:
    entity_id: light.wiz_rgbw_tunable_de5c9e
  data: {}

Can someone give me some insight on this?

Core dashboard cards don’t support templates (with few exceptions). Call a script from the tap action and put your service and templates in that.

Also you can’t specify an RGB colour as a colour temperature. They are different attributes and can not be used interchangeably.

Also brightness pct is from 0 to 100, not 0 to 1.

1 Like