Hello everybody,
I have been playing around with
- Home Assistant
- zigbee2mqtt
- some IKEA devices
Now I want to configure hass for my home automation.
To start with, I want to make an automation that does exactly the same as my IKEA TRADFRI remote control (E1524/E1810) that is paired with a bulb.
So
- left click: change colortemp with decrement of 10%
- left click long: gradually decrease colortemp till button release
- right click: change colortemp with increment of 10%
- right click long: gradually increase colortemp till button release
- bottom click: change brightness with decrement of 10%
- bottom click long: gradually decrease brightness till button release
- top click: change brightness with increment of 10%
- top click long: gradually increase brightness till button release
- middle click: toggle light (on/off)
So far I only implemented only following actions:
# ==========================================================
# (R01) Remote IKEA
# ==========================================================
# ---------------------------------------------------------------------------------
- id: '0xd0cf5efffe307960_toggle'
alias: (R01) Remote IKEA MQTT Toggle button
trigger:
- platform: mqtt
topic: zigbee2mqtt/0xd0cf5efffe307960
condition:
- condition: template
value_template: '{{ "toggle" == trigger.payload_json.action}}'
action:
- data:
entity_id: light.0xd0cf5efffe0bb71a_light
service: light.toggle
# ---------------------------------------------------------------------------------
- id: '0xd0cf5efffe307960_mqtt_dim_up'
alias: (R01) Remote IKEA MQTT dim UP
trigger:
platform: mqtt
topic: zigbee2mqtt/0xd0cf5efffe307960
condition:
condition: template
value_template: >
{% if ( "brightness_up_click" == trigger.payload_json.action) %}
True
{% else %}
False
{% endif %}
action:
data_template:
entity_id: light.0xd0cf5efffe0bb71a_light
brightness: "{{ state_attr('light.0xd0cf5efffe0bb71a_light', 'brightness') + 50 | int }}"
transition: 1
service: light.turn_on
# ---------------------------------------------------------------------------------
- id: '0xd0cf5efffe307960_mqtt_dim_down'
alias: (R01) Remote IKEA MQTT dim DOWN
trigger:
platform: mqtt
topic: zigbee2mqtt/0xd0cf5efffe307960
condition:
condition: template
value_template: >
{% if ( "brightness_down_click" == trigger.payload_json.action) %}
True
{% else %}
False
{% endif %}
action:
data_template:
entity_id: light.0xd0cf5efffe0bb71a_light
brightness_pct: >
{% set brightness_pct = (state_attr('light.0xd0cf5efffe0bb71a_light', 'brightness') / 2.55) | int | round(0) %}
{% set new_brightness = brightness_pct - 10 %}
{% if new_brightness > 10 %}
{{ new_brightness }}
{% else %}
10
{% endif %}
transition: 1
service: light.turn_on
Can anybody help me with the rest?
How to implement the gradually and continuously increasing/decreasing brightness?