I created a custom light using a template for rest integration and is going mainly fine, I just want to know if is possible to change the atributes for this template:
- platform: template
lights:
dicroica_4_escritorio:
unique_id: dicroica_4_escritorio
friendly_name: "Dicroica 4 - Escritório"
value_template: "{{ states('switch.dicroica_4_escritorio_sw') }}"
level_template: "{{ states('input_number.brilho_dicroica_4_escritorio') | int }}"
temperature_template: "{{ states('input_number.temperatura_cor_dicroica_4_escritorio') | int }}"
turn_off:
service: switch.turn_off
target:
entity_id: switch.dicroica_4_escritorio_sw
turn_on:
service: switch.turn_on
target:
entity_id: switch.dicroica_4_escritorio_sw
set_level:
- service: input_number.set_value
data:
value: "{{ brightness | int }}"
target:
entity_id: input_number.brilho_dicroica_4_escritorio
- service: switch.turn_on
data_template:
entity_id:
- switch.dicroica_4_escritorio_sw
set_temperature:
- service: input_number.set_value
data:
value: "{{ color_temp }}"
entity_id: input_number.temperatura_cor_dicroica_4_escritorio
- service: switch.turn_on
data_template:
entity_id:
- switch.dicroica_4_escritorio_sw
set_color:
- service: input_number.set_value
data:
value: "{{ r }}"
entity_id: input_number.hue_dicroica_4_escritorio
- service: input_number.set_value
data:
value: "{{ g }}"
entity_id: input_number.sat_dicroica_4_escritorio
switch:
- platform: rest
name: Dicroica 4 - Escritório SW
resource: 'http://192.168.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
method: put
body_on: '{ "state": { "power": { "powerState": "on" }, "brightness": {"brightness": {{ states("input_number.brilho_dicroica_4_escritorio") | int }} }, "color-temperature": {"colorTemperature": {{ states("input_number.temperatura_cor_dicroica_4_escritorio") | int }} } } }'
body_off: '{ "state": { "power": { "powerState": "off" } } }'
is_on_template: '{{ value_json.powerState }}'
headers:
Content-Type: application/json
verify_ssl: false
My light works with brightness between 0 and 100, color temp between -100 and 100 and rgb colors.
In attribute states I got this:
min_color_temp_kelvin: 2000
max_color_temp_kelvin: 6535
min_mireds: 153
max_mireds: 500
supported_color_modes:
- color_temp
- hs
friendly_name: Dicroica 4 - Escritório
supported_features: 0
As you can see is quite different from the expected.
So:
1- Is it possible to change the brightness scale (0 - 100)? If yes, how?
2- Is it possible to change the color mode (to rgb)? If yes, how? If no, how do you manage to use it (My lamp works with RGB and HA currently is giving me HS)?
3- Color Temperature I know is to much but maybe is possible also… So, if yes how?
Sorry for my english, it is not my main language and sometime is a little sketchy.
Thanks!!!