Problems using Trådfri with deCONZ

Tags: #<Tag:0x00007f780337ad70>

I just integrated a Conbee II and deCONZ into my setup. Currently I’ve only connected a single switch and a single bulb to it. It doesn’t work quite as I expected though. Seems like the switch behaves differently when connected directly to the bulb without deCONZ inbetween.

Power toggle: Works as expected, except it misses clicks now and then, annoying but no dealbreaker.
Dim up: Original function is increasing brightness, if off when single pressed, it turns on dimmed. Great for waking up the kids gently. After deCONZ it loses this function completely, still turns on when single pressed, but to last brightness.
Dim down: Orignally only decreased brightness, no single press function. After deCONZ it turns off light when single pressed.
Left color temperature button: 1 step warmer. After deCONZ, sometimes works, sometimes not. Stepping by single press never works, only long press to dim.
Right color temperature button: 1 step colder. Stops working after deCONZ. And this is the main problem

I have looked everywhere for a solution to this, I can’t use the remote to make the light colder at all, the right button has no function.
I have tried assigning the remote to the light in the web interface, and I have tried setting the switch as a group controller assigning each button separately as some guides have said. But it still doesn’t work.

Have anyone gotten this to work at all? Are the < > buttons using a “non-standard” ZigBee protocol that deCONZ can’t replicate?

Equipment:
image
image
image

From your description it sounds to me like you are setting up the button presses in the Phoscon software? It would be better to set things up in home assistant.

The functionality of the remote like button X pressed -> do Y, is not inbuilt into the remote, it’s the Tradfri hub that does this. When you connect the remote to the ConBee you are “only” able to catch what button has been pressed and then create the logic in home assistant.

Maybe this AppDaemon app may be useful for you

But I don’t use the Trådfri hub, and I never have. The purpouse of the buttons have to be integrated in either the bulb or the remote, and my bet is on the bulb. So I guess my issue is why the bulb stops responding to color temperature change commands just because the ConBee is in the loop.

Did you buy the remote and the bulb together in a package and it was working as expected without the hub? Could be that they were configured initally to be working together like this. I assume once you pair the remote and the bulb to DeCONZ, they lose this initial config.

However to make this all work you need to configure the buttons in HA and not in Phoscon, as Phoscon probably doesn’t support changing color temperature through a remote.

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 Z2M - IKEA controllers. Bring full functionality to IKEA light 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}
2 Likes

If he fears home assistant outages he could also simply create the “automations” (albeit super simple) within deconz. That way if he restarts home assistant (or if it is down) the remotes would still work.

Though yeah, in the end you want HA to do all this stuff for you like in my case.

Ok. Using the automation yaml for this is insanely verbose though…

I have tried setting it up in deCONZ as mentioned, everything but “colordimming” worked, it would only transition one way and stay there.

I’ll look at setting it up in HA.

I don’t now if the Ikea switch is already supported, but if it is you can easily do device automations in the GUI and it already knows which number translates to which button press.

To test if it works, go to the Sidebar -> Configuration -> Devices. Then search for you device, click on it, and if it is supported you should see something at the bottom like “Do something when…” and then “turn off button pressed”

Ok. So I did some quick checking before I went to bed yesterday. And setting it up in HA seems like the way to go. At least for the off/on button.
But do I really need to use scripts to change the color temperature or brightness? I did not find any way to use the automation editor to say “If I click the ‘up’ button, increase brightness by 10%”. I see there is a “continously pressed” state for the button, but I don’t see any easy way to say “increase brightness by 10% every second until depressed”.

Maybe I should look at Node-Red for this…

I’m currently working on getting the Tradfri Remote integrated into my AppDaemon app. Please let me know in case you are interested, I’m working with someone else at the moment to get the smooth dimming functionality and afterwards the color changing as well.

Not sure how familiar you are with python, but there is an AppDaemon app that works with the Phillips Dimmer switch.

It could potentially be adapted to work with the Trafri remote.

Looking at the code, I think it could simply be a matter of identifying the correct mapping of event codes.

edit: Oops, didn’t even see the post above from the author of that particular app :smiley:

1 Like

It is, I already have a version working with the Tradfri remote (not released yet), which provides the smooth dimming functionality but only for lights integrated through DeCONZ. I’m working to get other lights included as well and then I’ll tackle the color changing. I also have support for KNX switches and for the Ikea Tradfri Dimmer.

1 Like

I have seen that my thread was mentioned a couple of times. I would like to say that the app supports deCONZ devices as well as z2m and zha. You can check the supported devices in here.

This would be an example configuration to connect the E1810 controller with deCONZ to a light.

livingroom_controller:
  module: controllerx
  class: E1810Controller
  controller: ikea_controller
  integration: deconz
  light: light.bedroom

With this configuration, you will have all the functionality that the controller should have and if the light supports it, it will change the color with the arrows.

Let me know if you have any questions :slight_smile:

1 Like

I just got time to look at this again now, and after faffing about with HACS for about an hour I got everything up and running with ControllerX. Lovely.
Although the event triggers seems to be a little intermittent and unreliable. But currently I’m just writing that on the “3 floors with concrete dividers”-list. The Conbee is on the second floor in the staircase but the lights and the controller is on the third floor inside a room.
Could buying a repeater and installing it on the third floor be of any help? (The IKEA repeaters are cheap, are they better/worse than a switched socket?)

Hi @wattengard,

I am glad that ControllerX served you well :slight_smile: When I started with home automation, I decided going with Zigbee protocol, so one of the first things I did was to buy a bunch of smart switches from IKEA to expand the network where the signal did not reach. Now, I also have smart light bulbs and zigbee sonoffs which also help with the Zigbee network.

If I were you, I would try to move the light and the controller near the coordinator and see if that little intermittent still exists, if it doesn’t, it means you have a problem with the network signal.

Short answer: Yes, it might help.
Long answer:
In the zigbee protocol, you have coordinator, router and end devices. The IKEA smart plugs are router, which helps to expand the network, unless the end devices (like controllers or anything with battery). This means that any device that acts like router, it will do the same job as the IKEA smart plugs, so switched socket would work too.