Help to display a valve 2 two decimal places

- alias: 'Test'
  trigger:
  - platform: mqtt
    topic: 'zigbee2mqtt/ikea_sound'
  condition:
  - condition: template
    value_template: "{{ 'action' in trigger.payload }}"
  action:
  - service: input_number.set_value
    data_template:
      entity_id: input_number.test
      value: '{{ trigger.payload_json.brightness | float / 255 }}'
  - service: media_player.volume_set
    data_template:
      entity_id: media_player.tv_sonos
      volume_level: "{{ states.input_number.test.state }}"

What is the correct code to display value: '{{ trigger.payload_json.brightness | float / 255 }}' to just 2 decimal places?

value: '{{ (trigger.payload_json.brightness | float / 255)|round(2) }}'

?

1 Like

thanks matey!! You are a star!

1 Like