08-26-2023, 06:24 AM
(This post was last modified: 08-26-2023, 06:25 AM by engmohades.)
Actually, I am using the UID as I mentioned, but instead of it, I placed the XXXX symbol.
light:
- name: D16-1
unique_id: D16-1
schema: template
command_topic: "dimmer/41a2d806af7a99020d25f2ae12345/set"
state_topic: "dimmer/41a2d806af7a99020d25f2ae12345/state"
command_on_template: >
{%- if brightness is defined -%}
,{"dimmer1":{"value":{{(brightness / 255 * 100) | int - 1}}}
{%- else -%}
,'{"dimmer1":{"value":99}}'
{%- endif -%}
command_off_template: '{"dimmer1":{"value":0}}'
state_template: >
{%- if value_json.dimmer1.value == 0 -%}
off
{%- else -%}
on
{%- endif -%}
brightness_template: '{{(value_json.dimmer1.value / 99 * 255)| int}}'
- name: D16-2
unique_id: D16-2
schema: template
command_topic: "dimmer/41a2d806af7a99020d25f2ae12345/set"
state_topic: "dimmer/41a2d806af7a99020d25f2ae12345/state"
command_on_template: >
{%- if brightness is defined -%}
,{"dimmer2":{"value":{{(brightness / 255 * 100) | int - 1}}}
{%- else -%}
,'{"dimmer2":{"value":99}}'
{%- endif -%}
command_off_template: '{"dimmer2":{"value":0}}'
state_template: >
{%- if value_json.dimmer2.value == 0 -%}
off
{%- else -%}
on
{%- endif -%}
brightness_template: '{{(value_json.dimmer2.value / 99 * 255)| int}}'
light:
- name: D16-1
unique_id: D16-1
schema: template
command_topic: "dimmer/41a2d806af7a99020d25f2ae12345/set"
state_topic: "dimmer/41a2d806af7a99020d25f2ae12345/state"
command_on_template: >
{%- if brightness is defined -%}
,{"dimmer1":{"value":{{(brightness / 255 * 100) | int - 1}}}
{%- else -%}
,'{"dimmer1":{"value":99}}'
{%- endif -%}
command_off_template: '{"dimmer1":{"value":0}}'
state_template: >
{%- if value_json.dimmer1.value == 0 -%}
off
{%- else -%}
on
{%- endif -%}
brightness_template: '{{(value_json.dimmer1.value / 99 * 255)| int}}'
- name: D16-2
unique_id: D16-2
schema: template
command_topic: "dimmer/41a2d806af7a99020d25f2ae12345/set"
state_topic: "dimmer/41a2d806af7a99020d25f2ae12345/state"
command_on_template: >
{%- if brightness is defined -%}
,{"dimmer2":{"value":{{(brightness / 255 * 100) | int - 1}}}
{%- else -%}
,'{"dimmer2":{"value":99}}'
{%- endif -%}
command_off_template: '{"dimmer2":{"value":0}}'
state_template: >
{%- if value_json.dimmer2.value == 0 -%}
off
{%- else -%}
on
{%- endif -%}
brightness_template: '{{(value_json.dimmer2.value / 99 * 255)| int}}'