In original IKEA Tradfri setup you have 2 choices:
- to pair bulb directly with remote.
- to pair remote to hub and then to pair bulb to remote via hub.
In pairs of single remote one or more bulbs it provides exactly the same functionality, though using hub enables to use also phone as remote or to integrate Tradfri ecosystem to home assistant. Such direct pairing ensures that all functionality (dimming, brightness) works out of the box.
Moving to deCONZ breaks this integration. In such scenario remote is just ZigBee controller and bulb is just generic ZigBee bulb. How they interact is definced by system to which thesse are linked. Since we are here for home assistant, I assume you want to achieve full functionality of remote controlling bulbs within this ecosystem and ZibBee (utilizing deCONZ in this case) is just medium you connect to devices - as @ Burningstone already mentioned.
So to operate remote you need to track deconz_event on home assistant event bus and respond accordingly by specific automation. E.g. if deconz_event reports something like:
{
"event_type": "deconz_event",
"data": {
"id": "mirek_desk_on_off_switch",
"unique_id": "00:0d:6f:ff:fe:e7:fe:ed",
"event": 2002
},
"origin": "LOCAL",
"time_fired": "2020-01-02T18:48:47.424189+00:00",
"context": {
"id": "b7573d3440c948868d67fc3226cd476a",
"parent_id": null,
"user_id": null
}
}
you know that on switch mirek_desk_on_off_switch button 1 (on) was pressed (event 2002)
When event says:
{
"event_type": "deconz_event",
"data": {
"id": "mirek_desk_on_off_switch",
"unique_id": "00:0d:6f:ff:fe:e7:fe:ed",
"event": 1002
},
"origin": "LOCAL",
"time_fired": "2020-01-02T18:48:45.688239+00:00",
"context": {
"id": "b643abc4e311467686343006c3531a93",
"parent_id": null,
"user_id": null
}
}
event 1002 identifies that button 2 (off) was pressed.
Knowing these events you can create automations to react accordingly, as described in already mentioned thread ControllerX. Bring full functionality to light and media player controllers or (the tutorial that I use): Here is a good method for dimming lights in Deconz.
Both describe how to use it for dimming, but I’d assume it is very similar for changing color (I do not have color or white specturm lights to test). Events to be used for color changing (or rather correcponding button umbers/events) can be found in deCONZ add-on documentation.
Here is sample automation code referring to mentioned switch. It consists of 5 automations:
- turn the light on on single press of 1
- turn the light off on single press of 2
- start dimmin up on press and hold of 1
- start dimming down on press and hold of 2
- stop dimming on release of button
- alias: 'Turn the lights on'
initial_state: 'on'
trigger:
platform: event
event_type: deconz_event
event_data:
id: mirek_on_off_switch
event: 1002
action:
service: light.turn_on
entity_id: light.mirek_office
- alias: 'Turn the lights off'
initial_state: 'on'
trigger:
platform: event
event_type: deconz_event
event_data:
id: mirek_on_off_switch
event: 2002
action:
- service: light.turn_off
data_template:
entity_id: light.mirek_office
- alias: 'Increase light brightness'
initial_state: 'on'
trigger:
platform: event
event_type: deconz_event
event_data:
id: mirek_on_off_switch
event: 1001
action:
- service: deconz.configure
data:
entity: light.mirek_office
field: "/action"
data: {"bri_inc":254, "transitiontime":35}
- alias: 'Decrease light brightness'
initial_state: 'on'
trigger:
platform: event
event_type: deconz_event
event_data:
id: mirek_on_off_switch
event: 2001
action:
- service: deconz.configure
data:
entity: light.mirek_office
field: "/action"
data: {"bri_inc":-254, "transitiontime":35}
- alias: 'Stop brightness change from dimmer'
initial_state: 'on'
trigger:
- platform: event
event_type: deconz_event
event_data:
id: mirek_on_off_switch
event: 1003
- platform: event
event_type: deconz_event
event_data:
id: mirek_on_off_switch
event: 2003
action:
- service: deconz.configure
data:
entity: light.mirek_office
field: "/action"
data: {"bri_inc":0}