I use the following setup to control a light that takes REST-commands as input:
rest_command:
set_brightness:
url: 'http://192.168.1.12/dev/sps/io/Skap_led_v/{{ brightness }}'
method: POST
- platform: template
lights:
led_lights:
friendly_name: "Theater Lights"
turn_on:
service: rest_command.set_brightness
data_template:
brightness: 100
turn_off:
service: rest_command.set_brightness
data_template:
brightness: 0
set_level:
service: rest_command.set_brightness
data_template:
brightness: "{{ brightness }}"
It works, but controlling the light sends 0-255 (255 is 100% brightness), but the light needs 0-100 as input. I tried to do the following int he last part:
brightness: "{{ brightness / 255 *100}}
brightness: "{{ brightness // 2.55}}
and brightness_pct: "{{ brightness }}
But neither of those seem to do the trick. Any suggestions on how to do this?