Please help: automation for IKEA TRADFRI remote control (E1524/E1810)

I have not used appdeamon before.
Could you @xaviml please help me with some guidelines for your app?

What I want is to use the ikea 5 button switch to dim my tasmotised light bulb using mqtt.
Now I run ikea through deconz

Hi @Jurgmaister, is your light connected to HA? This is the first thing you should do if you haven’t since the appdaemon app doesn’t do any mqtt calls.

Regarding AppDaemon, you just need to install the addon of AppDaemon 4.x from the community store (assuming you have home assistant (fka hassio) running). You can follow their instructions to make it up and running and then you can either install the app from HACS or download the controllerx folder and put it inside /config/appdaemon/apps/. Let me know if you have any questions.

Thanks for quick respons @xaviml.
My bulb is connected til HA using mqtt - it is working, both toggle and dimming.

So it is the appdeamon part I would appreciate some help with.
I guess I would need some help, also with the initial setup even though I have installed AppDaemon with Frencks add-on.

I guess I understand it correct that after installing Controllerx in hacs (or manual), I do the rest of the configuration in the apps.yaml?

Yes, that is right. Once you have AppDaemon and ControllerX installed, then you need to add your configuration in apps.yaml. The way AppDaemon works is that you can define automations with Python code (this is what ControllerX does) and then you can instanciate those automations (called apps) from a yaml configuration. In the case of ControllerX, each instance of an app binds a controller with an entity (e.g. light). You can follow the Configuration part from the README.md and copy that into your apps.yaml. If you tell me the entity of your light and the id of your device with deCONZ, I can give your the configuration that you need.

@xaviml thanks again!
I managed to get it working.
It was much easier than I was expecting.

For others who might be interested.
All I did was put this in apps.yaml;

[name the “scrip”] (feks “nightstand_light_masterbedroom”):
module: controllerx
class: E1810Controller
event_id: [from device you want to use, picked up by “deconz_event” in service tab]
light: [name of light entity]

Like this;

hovedsoverom:
module: controllerx
class: E1810Controller
event_id: bryter_hovedsoverom
light: light.nedis_hovedsoverom

1 Like

Thanks @Jurgmaister

I am working on a better documentation, but as you said it’s pretty straight forward, but that is thanks of how AppDaemon works, which is amazing!

1 Like

While the ControllerX is an awesome piece of software, using zigbee binding (https://www.zigbee2mqtt.io/information/binding.html) gives that without coordinator involvement.

I stumbled upon binding when one of the E1810 remotes would, without any good explanation, control Xiaomi wall switch in another room. Three did not have any side effect (it turned out they are bound to group 901), one would have (it was bound to group 0). Resetting it with four presses didn’t help.

Zigbee2mqttAssistant can help out with setting the bindings. You can do them manually as well, by sending messages to zigbee2mqtt/bridge/bind/*remote_name* topic.

1 Like

Hi all, I have question regarding to code posted by “xaviml”
I have manage to make it running but only for one light. I have a problem to control groups of lights with this code. I was using entity_id:group.kitchen - but dim/color function is not working.
If i use light.kitchen_1 then it is working.

Hi’ @ondrabanov

Did you manage to sort your issues ?

I’m using ControllerX with multiple group of lights, both via z2m and Hue Bridge integration - all working perfectly.

Remember that when controlling groups of lights, ControllerX reads supported_features for first entity in group and assumes that these features can be applied to remaining entities in group.

Ciao !

Ikea controller E1524 automation not working in “state” platform. What is wrong here.

This does WORK coorectly

automation:
  - id: 'bordlamp_ikea_bryter'
    alias: Bordlamp ikea bryter
    trigger:
    - entity_id: sensor.bordlampe_ikea_bryter_action
      platform: state
      to: toggle
    condition: []
    action:
    - data:
        entity_id: light.bordlampe
      service: light.toggle

But, this does NOT WORK

automation:
  - id: 'bordlamp_ikea_bryter'
    alias: Bordlamp ikea bryter
    trigger:
      - platform: state
        entity_id: sensor.bordlampe_ikea_bryter_action
        to: "off"
      - platform: state
        entity_id: sensor.bordlampe_ikea_bryter_action
        to: "on"
    condition:
    action:
      - service: light.toggle
        data:
          entity_id: light.bordlampe

Hi @smile,

The second configuration is not working because the E1524 controller does not fire a “on” and “off” state. You can check the states that it fires in zigbee2mqtt in here.

Hi @xaviml, Thanks for your code. It works well with TRADFRI remote control (E1524/E1810) by IKEA. But unfortunately right and left arrow is not working as my Philips Hue light doesn’t have color_temp attribute.
Below find attribute details from Developer Tools/States for Philips Hue lights.

min_mireds: 153
max_mireds: 500
effect_list: random, colorloop
brightness: 255
hs_color: 45, 21.961
rgb_color: 255, 240, 198
xy_color: 0.37, 0.372
effect: none
entity_id: light.dining_room
friendly_name: Dining Room
supported_features: 63

Please suggest the solution for changing temperature from “Day light” to “Warm White”.

Hi @RAUS,

There must be a bug in the Hue integration since according to supported_features (63), your light supports brightness, color_temp, effect, flash, color, and transition.

ControllerX it checks for the supported features to know which attribute to change when changing color (either xy_color or color_temp). If the light support both (as in your case), it automatically selects “xy_color” and not “color_temp”. This means that color_temp is not used in your setup with the default configuration. Of course, you can change such behaviour by changing the configuration, so could you please share your controller configuration and the AppDaemon logs to see what the problem is?

Also, what do you mean by the following sentence?

Please suggest the solution for changing temperature from “Day light” to “Warm White”

Cheers,
Xavi M.

Hi @RAUS (again),

I just wrote up an answer thinking you were using ControllerX. The automation you are pointing out is the automation I used for my E1810, however, I created an AppDaemon app that allows you to easily do this without adding any long automation in HA with YAML. The only configuration you will need once AppDaemon is set up is something like:

livingroom_controller:
  module: controllerx
  class: E1810Controller
  controller: sensor.livingroom_controller_action
  integration: z2m
  light: light.bedroom

If you need help to set it up, I will be glad to help.

As I said in the previous post, there is a problem with your light since the supported_features attributes states that it supports color_temp and color. Do you happen to see the color_temp attribute when the light is on?

Regards,
Xavi M.

Thanks @xaviml, I know about ControllerX. But using your automation code to make my hand dirty and want to do some customization. But using ControllerX is in my plan for other remote controls.

Regarding my issue, I found some interesting facts. HA is showing attribute color_temp when I turned on physical wall switch. But color_temp attribute get replaced with following three attributes, hs_color, rgb_color and xy_color when I changed scene using Philips Hue app.

But again color_temp attribute is appeared when I change temperature using HA.

So, your automation trigger works perfectly when attribute color_temp is available. But not working correctly (only right and left arrow, both click/hold) after if scene is set using Philips Hue app.

FYI, I have integrate my Philips Hue hub in HA.

Hope above info will help to understand the issue.

Hi @RAUS,

Sorry for the delay in answering this message. As I understood, this seems to be a problem of the Hue Integration, and how they handle the color_temp attribute. This attribute should be always available, or at least available if the light is on. The automation you are using is limited and only uses the color_temp attribute, if you switch to ControllerX, you will be able to also use the xy_color and loop through the color wheel.

Sorry for not being able to help further with the YAML automation, since it is something I do not use anymore.

Regards,
Xavi M.

Hi @xaviml

thanks for your app and script.

I was wondering if there is a way by which we could increase the brightness of a “light” without turning it on. Because the service light.turn_on obviously turns the light on first and then once you use your sensor i.e. ikea remotes and press left or right it then increases or decreases the brightness.

So I was after a solution in which when I press my ikea button e.g. to the right it would only increase the brightness and not turn the light on as I would want to click the ikea button to toggle my light on or off.

Hi @bachoo786 ,

Unfortunately, that is not possible. That is how it is designed in Home Assistant, you cannot change the brightness if the light is off, only when is turned on.

However, what is the use case you are after? I don’t seem to understand the idea to change the brightness when a light is not on. It would be the same as turning the light on to a specific brightness.

Regards,
Xavi M.

Hello,

I can’t use my Ikea remote control with Zigate gateway (neiher in ZHA nor in Z2M)

What is your zigbee gateway that works ?

Here is a thread that I created on my problem : Ikea remote added to zigbee2mqtt but cannot control?

Hello, could anyone help me find what is not working in this code and why it returns a

[homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'update_available' when rendering '{{ value_json.update_available}}' 
- id: ikea_controller_dim_up
  alias: Ikea controller dim up
  trigger:
    platform: state
    entity_id: sensor.ikea_tradfri_remote_1_action
    to: brightness_up_click
  action:
    data_template:
      entity_id:  
         "{% if is_state ('input_select.room_select' ,'Wszystkie światła') %} light.wszystkie_swiatla {% elif
             is_state ('input_select.room_select' , 'Salon') %} light.salon {% elif
             is_state ('input_select.room_select' , 'Kuchnia') %} light.kuchnia {% elif
             is_state ('input_select.room_select' , 'Łazienka') %} light.lazienka {% elif
             is_state ('input_select.room_select' , 'Sypialnia') %} light.sypialnia {% elif
             is_state ('input_select.room_select' , 'Biuro') %} light.biuro {% endif %}"
      brightness: 
          "{{ state_attr('
          {% if is_state ('input_select.room_select' ,'Wszystkie światła') %} light.wszystkie_swiatla 
          {% elif is_state ('input_select.room_select' , 'Salon') %} light.salon 
          {% elif is_state ('input_select.room_select' , 'Kuchnia') %} light.kuchnia 
          {% elif is_state ('input_select.room_select' , 'Łazienka') %} light.lazienka 
          {% elif is_state ('input_select.room_select' , 'Sypialnia') %} light.sypialnia 
          {% elif is_state ('input_select.room_select' , 'Biuro') %} light.biuro {% endif %}
          ','brightness') + 50 | int }}"
    service: light.turn_on

And how it works

trigger.entity_id

because in this case it does not work at all.

color_temp: "{{ state_attr(trigger.entity_id, 'color_temp') + 75 }}"

Regards,
SP