Z2M - Tint Remote
a blueprint for the Tint Remote with Zigbee2Mqtt.
You can control with it three lightgroups with the colorwheel and brightnessbuttons (shortpress)
ToDo:
- color_temp buttons
- brightness change on longpress
On remote, only a single selected group is supported with z2m. Please check the log for action_group
attribute. My two tint remotes, send for action_group
value 16388, 16389 and 16390
changelog:
v0.1:
- initial release
v0.2:
- add default value for actions
- add scene button actions per device group (device group action overwrite global action)
- refactor structure
blueprint:
name: Z2M - Tint Remote - testing
description: Control lights with a Tint Remote v0.2
domain: automation
input:
remote:
name: Remote
description: Tint Remote to use
selector:
entity:
integration: mqtt
domain: sensor
light_group_1:
name: light group 1
default: {}
selector:
target:
entity:
domain: light
light_group_2:
name: light group 2
default: {}
selector:
target:
entity:
domain: light
light_group_3:
name: light group 3
default: {}
selector:
target:
entity:
domain: light
working_scene:
name: Working Scene
description: The scene to be triggered when the Working Light button is pressed - scene_3
default: []
selector:
action: {}
sunset_scene:
name: Sunset Scene
description: The scene to be triggered when the Sunset button is pressed - scene_1
default: []
selector:
action: {}
party_scene:
name: Party Scene
description: The scene to be triggered when the Party button is pressed - scene_2
default: []
selector:
action: {}
night_scene:
name: Night Scene
description: The scene to be triggered when the Night button is pressed - scene_6
default: []
selector:
action: {}
campfire_scene:
name: Campfire Scene
description: The scene to be triggered when the Campfire button is pressed - scene_4
default: []
selector:
action: {}
romantic_scene:
name: Romantic Scene
description: The scene to be triggered when the Romantic button is pressed - scene_5
default: []
selector:
action: {}
working_scene_1:
name: Working Scene - Only Group 1 selected
description: The scene to be triggered when the Working Light button is pressed - scene_3
default: []
selector:
action: {}
sunset_scene_1:
name: Sunset Scene - Only Group 1 selected
description: The scene to be triggered when the Sunset button is pressed - scene_1
default: []
selector:
action: {}
party_scene_1:
name: Party Scene - Only Group 1 selected
description: The scene to be triggered when the Party button is pressed - scene_2
default: []
selector:
action: {}
night_scene_1:
name: Night Scene - Only Group 1 selected
description: The scene to be triggered when the Night button is pressed - scene_6
default: []
selector:
action: {}
campfire_scene_1:
name: Campfire Scene - Only Group 1 selected
description: The scene to be triggered when the Campfire button is pressed - scene_4
default: []
selector:
action: {}
romantic_scene_1:
name: Romantic Scene - Only Group 1 selected
description: The scene to be triggered when the Romantic button is pressed - scene_5
default: []
selector:
action: {}
working_scene_2:
name: Working Scene - Only Group 2 selected
description: The scene to be triggered when the Working Light button is pressed - scene_3
default: []
selector:
action: {}
sunset_scene_2:
name: Sunset Scene - Only Group 2 selected
description: The scene to be triggered when the Sunset button is pressed - scene_2
default: []
selector:
action: {}
party_scene_2:
name: Party Scene - Only Group 2 selected
description: The scene to be triggered when the Party button is pressed - scene_2
default: []
selector:
action: {}
night_scene_2:
name: Night Scene - Only Group 2 selected
description: The scene to be triggered when the Night button is pressed - scene_6
default: []
selector:
action: {}
campfire_scene_2:
name: Campfire Scene - Only Group 2 selected
description: The scene to be triggered when the Campfire button is pressed - scene_4
default: []
selector:
action: {}
romantic_scene_2:
name: Romantic Scene - Only Group 2 selected
description: The scene to be triggered when the Romantic button is pressed - scene_5
default: []
selector:
action: {}
working_scene_3:
name: Working Scene - Only Group 3 selected
description: The scene to be triggered when the Working Light button is pressed - scene_3
default: []
selector:
action: {}
sunset_scene_3:
name: Sunset Scene - Only Group 3 selected
description: The scene to be triggered when the Sunset button is pressed - scene_3
default: []
selector:
action: {}
party_scene_3:
name: Party Scene - Only Group 3 selected
description: The scene to be triggered when the Party button is pressed - scene_2
default: []
selector:
action: {}
night_scene_3:
name: Night Scene - Only Group 3 selected
description: The scene to be triggered when the Night button is pressed - scene_6
default: []
selector:
action: {}
campfire_scene_3:
name: Campfire Scene - Only Group 3 selected
description: The scene to be triggered when the Campfire button is pressed - scene_4
default: []
selector:
action: {}
romantic_scene_3:
name: Romantic Scene - Only Group 3 selected
description: The scene to be triggered when the Romantic button is pressed - scene_5
default: []
selector:
action: {}
mode: queued
max: 5
max_exceeded: silent
trigger:
- platform: state
entity_id: !input 'remote'
condition:
- condition: and
conditions:
- condition: template
value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'
- condition: template
value_template: "{{ trigger.to_state.attributes.action in ('off', 'on', 'color_wheel',
'color_temp', 'brightness_down_click', 'brightness_up_click', 'brightness_down_hold',
'brightness_down_release', 'brightness_up_hold', 'brightness_up_release',
'scene_3', 'scene_1', 'scene_2', 'scene_6', 'scene_4', 'scene_5') }}"
action:
- variables:
group_id_1: 16388
group_id_2: 16389
group_id_3: 16390
input_working_scene_1: !input 'working_scene_1'
input_sunset_scene_1: !input 'sunset_scene_1'
input_party_scene_1: !input 'party_scene_1'
input_night_scene_1: !input 'night_scene_1'
input_campfire_scene_1: !input 'campfire_scene_1'
input_romantic_scene_1: !input 'romantic_scene_1'
input_working_scene_2: !input 'working_scene_2'
input_sunset_scene_2: !input 'sunset_scene_2'
input_party_scene_2: !input 'party_scene_2'
input_night_scene_2: !input 'night_scene_2'
input_campfire_scene_2: !input 'campfire_scene_2'
input_romantic_scene_2: !input 'romantic_scene_2'
input_working_scene_3: !input 'working_scene_3'
input_sunset_scene_3: !input 'sunset_scene_3'
input_party_scene_3: !input 'party_scene_3'
input_night_scene_3: !input 'night_scene_3'
input_campfire_scene_3: !input 'campfire_scene_3'
input_romantic_scene_3: !input 'romantic_scene_3'
- service: system_log.write
data:
level: info
message: 'Tint Button pressed: {{ trigger.to_state.state }} Group: {{ trigger.to_state.attributes.action_group }} Length {{ input_working_scene_1 | length }}'
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.to_state.attributes.action_group == group_id_1 }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "on", "off" ) }}'
sequence:
- service: light.turn_{{ trigger.to_state.state }}
data: {}
target: !input 'light_group_1'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "color_wheel" ) }}'
sequence:
- service: light.turn_on
data:
xy_color:
- '{{ trigger.to_state.attributes.action_color.x | float }}'
- '{{ trigger.to_state.attributes.action_color.y | float }}'
target: !input 'light_group_1'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "color_temp" ) }}'
sequence: []
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "brightness_down_click", "brightness_up_click") }}'
sequence:
- variables:
factor: '{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}'
- service: light.turn_on
data_template:
brightness_step_pct: '{{ factor | int }}'
target: !input 'light_group_1'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_1" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_sunset_scene_1 | length > 0 }}'
sequence: !input 'sunset_scene_1'
default: !input 'sunset_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_2" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_party_scene_1 | length > 0 }}'
sequence: !input 'party_scene_1'
default: !input 'party_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_3" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_working_scene_1 | length > 0 }}'
sequence: !input 'working_scene_1'
default: !input 'working_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_4" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_campfire_scene_1 | length > 0 }}'
sequence: !input 'campfire_scene_1'
default: !input 'campfire_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_5" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_romantic_scene_1 | length > 0 }}'
sequence: !input 'romantic_scene_1'
default: !input 'romantic_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_6" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_night_scene_1 | length > 0 }}'
sequence: !input 'night_scene_1'
default: !input 'night_scene'
default: []
- conditions:
- condition: template
value_template: '{{ trigger.to_state.attributes.action_group == group_id_2 }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "on", "off" ) }}'
sequence:
- service: light.turn_{{ trigger.to_state.state }}
data: {}
target: !input 'light_group_2'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "color_wheel" ) }}'
sequence:
- service: light.turn_on
data:
xy_color:
- '{{ trigger.to_state.attributes.action_color.x | float }}'
- '{{ trigger.to_state.attributes.action_color.y | float }}'
target: !input 'light_group_2'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "color_temp" ) }}'
sequence: []
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "brightness_down_click", "brightness_up_click") }}'
sequence:
- variables:
factor: '{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}'
- service: light.turn_on
data_template:
brightness_step_pct: '{{ factor | int }}'
target: !input 'light_group_2'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_1" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_sunset_scene_2 | length > 0 }}'
sequence: !input 'sunset_scene_2'
default: !input 'sunset_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_2" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_party_scene_2 | length > 0 }}'
sequence: !input 'party_scene_2'
default: !input 'party_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_3" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_working_scene_2 | length > 0 }}'
sequence: !input 'working_scene_2'
default: !input 'working_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_4" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_campfire_scene_2 | length > 0 }}'
sequence: !input 'campfire_scene_2'
default: !input 'campfire_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_5" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_romantic_scene_2 | length > 0 }}'
sequence: !input 'romantic_scene_2'
default: !input 'romantic_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_6" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_night_scene_2 | length > 0 }}'
sequence: !input 'night_scene_2'
default: !input 'night_scene'
default: []
- conditions:
- condition: template
value_template: '{{ trigger.to_state.attributes.action_group == group_id_3 }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "on", "off" ) }}'
sequence:
- service: light.turn_{{ trigger.to_state.state }}
data: {}
target: !input 'light_group_3'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "color_wheel" ) }}'
sequence:
- service: light.turn_on
data:
xy_color:
- '{{ trigger.to_state.attributes.action_color.x | float }}'
- '{{ trigger.to_state.attributes.action_color.y | float }}'
target: !input 'light_group_3'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "color_temp" ) }}'
sequence: []
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "brightness_down_click", "brightness_up_click") }}'
sequence:
- variables:
factor: '{% if trigger.to_state.state in ( "brightness_down_click") %} -12 {% else %} 12 {% endif %}'
- service: light.turn_on
data_template:
brightness_step_pct: '{{ factor | int }}'
target: !input 'light_group_3'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_1" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_sunset_scene_3 | length > 0 }}'
sequence: !input 'sunset_scene_3'
default: !input 'sunset_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_2" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_party_scene_3 | length > 0 }}'
sequence: !input 'party_scene_3'
default: !input 'party_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_3" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_working_scene_3 | length > 0 }}'
sequence: !input 'working_scene_3'
default: !input 'working_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_4" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_campfire_scene_3 | length > 0 }}'
sequence: !input 'campfire_scene_3'
default: !input 'campfire_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_5" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_romantic_scene_3 | length > 0 }}'
sequence: !input 'romantic_scene_3'
default: !input 'romantic_scene'
- conditions:
- condition: template
value_template: '{{ trigger.to_state.state in ( "scene_6" ) }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ input_night_scene_3 | length > 0 }}'
sequence: !input 'night_scene_3'
default: !input 'night_scene'
default: []
default: []