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

Hello everybody,

I have been playing around with

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.

E1524-E1810

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?

1 Like

Hi @bartplessers,

I have been working on these recently. I have the same Ikea controller and I wanted a smooth solution for this. I found this post where the same is done but with a Xiomi controller: Finally - a cheap WIRELESS switch that dims! Xiaomi Switch Gen1. I started adapting it from the solution found on this post, but I have changed some things. The main thing I changed was to create a python script to dim up/down smoothly.

I created a package for it:

automation:
  ###################
  ## Toggle the light
  ###################
  - id: ikea_controller_toggle
    alias: Ikea Controller - Toggle
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_action
        to: "toggle"
    condition:
    action:
      - service: light.toggle
        data:
          entity_id: light.YOURLIGHT

  ###########################################
  ## Dim up/down and warm up/down with clicks
  ###########################################
  - id: ikea_controller_dim_up
    alias: Ikea controller dim up
    trigger:
      platform: state
      entity_id: sensor.YOURCONTROLLER_action
      to: brightness_up_click
    action:
      data_template:
        entity_id: light.YOURLIGHT
        brightness: "{{ state_attr('light.YOURLIGHT', 'brightness') + 50 | int }}"
      service: light.turn_on

  - id: ikea_controller_dim_down
    alias: Ikea controller dim down
    trigger:
      platform: state
      entity_id: sensor.YOURCONTROLLER_action
      to: brightness_down_click
    action:
      data_template:
        entity_id: light.YOURLIGHT
        brightness: "{{ [state_attr('light.YOURLIGHT', 'brightness') - 50, 1] | max }}"
      service: light.turn_on

  - id: ikea_controller_warm_up
    alias: Ikea controller warm up
    trigger:
      platform: state
      entity_id: sensor.YOURCONTROLLER_action
      to: arrow_right_click
    action:
      data_template:
        entity_id: light.YOURLIGHT
        color_temp: "{{ state_attr('light.YOURLIGHT', 'color_temp') + 75 }}"
      service: light.turn_on

  - id: ikea_controller_warm_down
    alias: Ikea controller warm down
    trigger:
      platform: state
      entity_id: sensor.YOURCONTROLLER_action
      to: arrow_left_click
    action:
      data_template:
        entity_id: light.YOURLIGHT
        color_temp: "{{ state_attr('light.YOURLIGHT', 'color_temp') - 75 }}"
      service: light.turn_on

  ###############################################
  ## Dim up/down with long press
  ###############################################

  - id: ikea_controller_brighten_on
    alias: Ikea Controller - Brighten on
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_action
        to: brightness_up_hold
    condition:
      - condition: state
        entity_id: light.YOURLIGHT
        state: "on"
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.light_brightness
      - service: python_script.change_attribute_light_smoothly
        data:
          light_id: light.YOURLIGHT
          input_boolean: input_boolean.light_brightness
          delta: 20
  - id: ikea_controller_dim_on
    alias: Ikea Controller - Dim on
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_action
        to: brightness_down_hold
    condition:
      - condition: state
        entity_id: light.YOURLIGHT
        state: "on"
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.light_brightness
      - service: python_script.change_attribute_light_smoothly
        data:
          light_id: light.YOURLIGHT
          input_boolean: input_boolean.light_brightness
          delta: -20

  - id: ikea_controller_brighten_dim_off
    alias: Ikea Controller - Brighten/Dim off
    initial_state: "on"
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_action
        to: brightness_up_release
      - platform: state
        entity_id: sensor.YOURCONTROLLER_action
        to: brightness_down_release
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: input_boolean.light_brightness
          state: "on"
        - condition: state
          entity_id: light.YOURLIGHT
          state: "on"
    action:
      - service: input_boolean.turn_off
        entity_id: input_boolean.light_brightness

  ###############################################
  ## Warm up/down with long press
  ###############################################

  - id: ikea_controller_warm_on
    alias: Ikea Controller - Warm on
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_action
        to: arrow_right_hold
    condition:
      - condition: state
        entity_id: light.YOURLIGHT
        state: "on"
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.light_color_temp
      - service: python_script.change_attribute_light_smoothly
        data:
          input_boolean: input_boolean.light_color_temp
          light_id: light.YOURLIGHT
          light_attribute: color_temp
          delta: 40
  - id: ikea_controller_col_on
    alias: Ikea Controller - Cold on
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_action
        to: arrow_left_hold
    condition:
      - condition: state
        entity_id: light.YOURLIGHT
        state: "on"
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.light_color_temp
      - service: python_script.change_attribute_light_smoothly
        data:
          light_id: light.YOURLIGHT
          input_boolean: input_boolean.light_color_temp
          light_attribute: color_temp
          delta: -40

  - id: ikea_controller_warm_cold_off
    alias: Ikea Controller - Warm/Cold off
    initial_state: "on"
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_action
        to: arrow_left_release
      - platform: state
        entity_id: sensor.YOURCONTROLLER_action
        to: arrow_right_release
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: input_boolean.light_color_temp
          state: "on"
        - condition: state
          entity_id: light.YOURLIGHT
          state: "on"
    action:
      - service: input_boolean.turn_off
        entity_id: input_boolean.light_color_temp

# Inputs to control the dim up/down and warm up/down smoothly
input_boolean:
  light_brightness:
    name: Light brigthness
    initial: off
  light_color_temp:
    name: Light color temperature
    initial: off

You will need to change:

  • YOURLIGHT: Your light entity
  • YOURCONTROLLER: Your controller

You can add this file on packages folder and on the configuration.yaml:

homeassistant:
  packages: !include_dir_named packages
python_script:

Then, you will need to add the following script (change_attribute_light_smoothly.py) inside /config/python_scripts:

input_boolean = data.get("input_boolean")
light_id = data.get("light_id")
delta = data.get("delta")
attribute_id = data.get("light_attribute", "brightness")
delay = data.get("delay", 350)

attribute_mapping = {
    "brightness": {"min": 1, "max": 255},
    "color_temp": {"min": 153, "max": 500},
}

exit_service = False
while True:
    switch_input = hass.states.get(input_boolean).state
    if switch_input == "off":
        break
    light = hass.states.get(light_id)

    attr_value = light.attributes[attribute_id]
    attr_value = attr_value + delta
    if attr_value < attribute_mapping[attribute_id]["min"]:
        attr_value = attribute_mapping[attribute_id]["min"]
        exit_service = True
    elif attr_value > attribute_mapping[attribute_id]["max"]:
        attr_value = attribute_mapping[attribute_id]["max"]
        exit_service = True

    service_data = {"entity_id": light_id, attribute_id: attr_value}
    logger.warning(f"Service data: {service_data}")
    hass.services.call("light", "turn_on", service_data)
    if exit_service:
        break
    time.sleep(delay / 1000)

I hope this helps you with your needs.

EDIT:
I created a much smoother and better solution for this problem. Check the following post to now more about it.

5 Likes

@xaviml,
this is soooooooo great! Thank you for sharing this.
I will try this later today, but it seems straightforward.

many many thanx.
Keep you informed about my progress :slight_smile:

Kind regards,
Bart

PS.
Do you have any idea why following automations:

this does NOT work

- id: '0xd0cf5efffe307960_toggle_hass'
  alias: (R01) Remote IKEA Toggle button (HASS)
  trigger:
  - entity_id: sensor.0xd0cf5efffe307960_click
    platform: state
    to: toggle
  condition: []
  action:
  - data:
      entity_id: light.0xd0cf5efffe0bb71a_light
    service: light.toggle

But his this DOES work coorectly:

- id: '0xd0cf5efffe307960_toggle_mqtt'
  alias: (R01) Remote IKEA  Toggle button (MQTT)
  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

Thus for some reason, I have to use the json notation, wich is OK, but more complex and prune to errors…

I started using your solution with MQTT, but I changed it to “state” platform. You can check my first solution, it uses the “toggle” automation. If the automation you are showing me is related to the controller E1524/E1810 might be because you are using the wrong sensor. My sensor finished with “_action” no “_click”. You can check the right sensor entity on /developer-tools/state.

Good luck with it. Let me know if you have more questions!

omg. Never thought that that was the problem.
Indeed:

- id: '0xd0cf5efffe307960_toggle_hass'
  alias: (R01) Remote IKEA Toggle button (HASS)
  trigger:
  - entity_id: sensor.0xd0cf5efffe307960_action
    platform: state
    to: toggle
  condition: []
  action:
  - data:
      entity_id: all
    service: light.toggle

works like a charm.
Sorry for my ignorance!

Kind regards, your help is much appreciated!
Bart

1 Like

And further: I made the mistake to replayce “YOURLIGHT” by “0xd0cf5efffe0bb71a” wich didn’t work.
I had to change it to “0xd0cf5efffe0bb71a_light”

So the correct syntax for my (IKEA) bulb and remote is:

automation:
  ###################
  ## Toggle the light
  ###################
  - id: ikea_controller_toggle
    alias: Ikea Controller - Toggle
    trigger:
      - platform: state
        entity_id: sensor.0xd0cf5efffe307960_action
        to: "toggle"
    condition:
    action:
      - data:
          entity_id: light.0xd0cf5efffe0bb71a_light
        service: light.toggle

This seems to work

grtz
B

1 Like

And…YEZZZZZZZZZZZZZZZZZZZZ
It works now!

You’re definitely the best @xaviml!!!

I think these kind of samples should be posted on https://www.home-assistant.io/cookbook/ to. It helps a lot for newbies like me.

again: thank you a lot for helping me out of this.

B

1 Like

No worries! I had troubles finding something like this as well, so that is why I ended up making it by myself. If you take a further look to the python code and the yaml, you can change things like “delta” or “delay” in case you need something a little bit different. However, this are the settings that worked the best for me. I also did the same for IKEA E1743, which has the brightness_up and brightness_down functions as well. You just need to add the following code in a file and put it inside “packages”. It uses the same python script.

automation:
  - id: simple_controller_toggle
    alias: Simple Controller - Toggle
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_click
        to: "off"
      - platform: state
        entity_id: sensor.YOURCONTROLLER_click
        to: "on"
    condition:
    action:
      - service: light.toggle
        data:
          entity_id: light.YOURLIGHT
  - id: simple_controller_brighten_on
    alias: Simple Controller- Brighten on
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_click
        to: brightness_up
    condition:
      - condition: state
        entity_id: light.YOURLIGHT
        state: "on"
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.light_E1743_brightness
      - service: python_script.change_attribute_light_smoothly
        data:
          light_id: light.YOURLIGHT
          input_boolean: input_boolean.light_E1743_brightness
          delta: 20
  - id: simple_controller_dim_on
    alias: Simple Controller- Dim on
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_click
        to: brightness_down
    condition:
      - condition: state
        entity_id: light.YOURLIGHT
        state: "on"
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.light_E1743_brightness
      - service: python_script.change_attribute_light_smoothly
        data:
          light_id: light.YOURLIGHT
          input_boolean: input_boolean.light_E1743_brightness
          delta: -20

  - id: simple_controller_brighten_dim_off
    alias: Simple Controller- Brighten/Dim off
    initial_state: "on"
    trigger:
      - platform: state
        entity_id: sensor.YOURCONTROLLER_click
        to: brightness_stop
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: input_boolean.light_E1743_brightness
          state: "on"
        - condition: state
          entity_id: light.YOURLIGHT
          state: "on"
    action:
      - service: input_boolean.turn_off
        entity_id: input_boolean.light_E1743_brightness

input_boolean:
  light_E1743_brightness:
    name: Light E1743 brigthness
    initial: off
2 Likes

Hey guys,

I created an app for AppDaemon to give a better and flexible solution to this. If you have more than one controller you can add a new instance app and that’s it. I don’t support group of lights, just 1 sensor connected with 1 light. However, you can connect them by creating different apps with multiple lights and the same controller in all of them. You can see the post about it here.

Thanks for this yaml, got it working except for color warmth. I get this error when pressing it:

Error while executing automation automation.lounge_light_remote_warm_down. Unknown error for call_service at pos 1: 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 443, in action
    await script_obj.async_run(variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 190, in async_run
    await self._handle_action(action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 273, in _handle_action
    await self._actions[_determine_action(action)](action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 355, in _async_call_service
    context=context,
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 87, in async_call_from_config
    template.render_complex(config[CONF_SERVICE_DATA_TEMPLATE], variables)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 71, in render_complex
    return {key: render_complex(item, variables) for key, item in value.items()}
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 71, in <dictcomp>
    return {key: render_complex(item, variables) for key, item in value.items()}
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 73, in render_complex
    return value.async_render(variables)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 222, in async_render
    return compiled.render(kwargs).strip()
  File "/usr/local/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 1, in top-level template code
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

This is my yaml:

- id: Lounge_light_remote_warm_up
  alias: Lounge Light Warm Up
  trigger:
    platform: state
    entity_id: sensor.0x000d6ffffe179359_action
    to: arrow_right_click
  action:
    data_template:
      entity_id: light.0x000d6ffffe2a96db_light
      color_temp: "{{ state_attr('light.0x000d6ffffe2a96db_light', 'color_temp') + 75 }}"
    service: light.turn_on

- id: Lounge_light_remote_warm_down
  alias: Lounge Light Remote Warm Down
  trigger:
    platform: state
    entity_id: sensor.0x000d6ffffe179359_action
    to: arrow_left_click
  action:
    data_template:
      entity_id: light.0x000d6ffffe2a96db_light
      color_temp: "{{ state_attr('light.0x000d6ffffe2a96db_light', 'color_temp') - 75 }}"
    service: light.turn_on

Hi @Morphy

Which type of light are you using? Does it support color_temp? In other words, can you change the color temperature from the home assistant UI?

On a side note, I recommend you to check out this post. I put all this code together in a app for appdaemon and I put it on HACS, so you can download the latest code in there and have many more feature than these scripts.

Hola Xavi
It doesn’t actually, I thought it would being a colour bulb :confused: It’s an Ikea LED1624G9 which only supports on/off, brightness, color xy
I’ll have to look into appdaemon I’ve heard it mentioned.

In the meantime I changed the arrow buttons to colour cycle instead:

- id: FP_light_remote_colour_clockwise
  alias: Fireplace Light Remote Clockwise
  trigger:
    platform: state
    entity_id: sensor.fireplace_light_remote_action
    to: arrow_right_click
  action:
    service: light.turn_on
    data_template:
      entity_id: light.fireplace_light
      hs_color:
        - "{{ (15 + (state_attr('light.fireplace_light', 'hs_color')[0] or 0)) % 360 }}"
        - 100

- id: FP_light_remote_colour_anticlockwise
  alias: Fireplace Light Remote Anticlockwise
  trigger:
    platform: state
    entity_id: sensor.fireplace_light_remote_action
    to: arrow_left_click
  action:
    service: light.turn_on
    data_template:
      entity_id: light.fireplace_light
      hs_color:
        - "{{ (-15 + (state_attr('light.fireplace_light', 'hs_color')[0] or 0)) % 360 }}"
        - 100

I did have a colourcycle script which cycled through for a long press but it would sometimes stay on and it felt a bit hacky making the script keep running. It also made the poor SD card on my RPi3 go crazy and it didn’t cycle quick enough for my liking.

- id: FP_light_remote_colour_cycle_on
  alias: Fireplace Light Remote Colour Cycle On
  trigger:
    - platform: state
      entity_id: sensor.fireplace_light_remote_action
      to: arrow_right_hold
  condition:
    - condition: state
      entity_id: light.fireplace_light
      state: "on"
  action:
    - service: script.turn_on
      entity_id: script.light_colour_cycle3

- id: FP_light_remote_colourcycle_off
  alias: Fireplace Light Remote Colour Cycle Off
  trigger:
    - platform: state
      entity_id: sensor.fireplace_light_remote_action
      to: arrow_right_release
  condition:
    - condition: state
      entity_id: light.fireplace_light
      state: "on"
  action:
    - service: script.turn_off
      entity_id: script.light_colour_cycle3
    - service: script.turn_off
      entity_id: script.light_colour_cycle4

- id: FP_light_remote_colour_cycle_reverse_on
  alias: Fireplace Light Remote Colour Cycle Reverse On
  trigger:
    - platform: state
      entity_id: sensor.fireplace_light_remote_action
      to: arrow_left_hold
  condition:
    - condition: state
      entity_id: light.fireplace_light
      state: "on"
  action:
    - service: script.turn_on
      entity_id: script.light_colour_cycle5

- id: FP_light_remote_colourcycle_reverse_off
  alias: Fireplace Light Remote Colour Cycle Reverse Off
  trigger:
    - platform: state
      entity_id: sensor.fireplace_light_remote_action
      to: arrow_left_release
  condition:
    - condition: state
      entity_id: light.fireplace_light
      state: "on"
  action:
    - service: script.turn_off
      entity_id: script.light_colour_cycle5
    - service: script.turn_off
      entity_id: script.light_colour_cycle6

Script:

light_colour_cycle3:
  alias: Hue Light Colour Cycle3
  sequence:
    - service: light.turn_on
      entity_id: light.fireplace_light
      data_template:
        hs_color:
          - "{{ (15 + (state_attr('light.fireplace_light', 'hs_color')[0] or 0)) % 360 }}"
          - 100
        brightness_pct: 100
        transition: 1
    - delay: '00:00:1'
    - service: script.turn_on
      entity_id: script.light_colour_cycle4

light_colour_cycle4:
  alias: Hue Light Colour Cycle4
  sequence:
    - service: light.turn_on
      entity_id: light.fireplace_light
      data_template:
        hs_color:
          - "{{ (15 + (state_attr('light.fireplace_light', 'hs_color')[0] or 0)) % 360 }}"
          - 100
        brightness_pct: 100
        transition: 1
    - delay: '00:00:1'
    - service: script.turn_on
      entity_id: script.light_colour_cycle3

light_colour_cycle5:
  alias: Hue Light Colour Cycle5
  sequence:
    - service: light.turn_on
      entity_id: light.fireplace_light
      data_template:
        hs_color:
          - "{{ (-15 + (state_attr('light.fireplace_light', 'hs_color')[0] or 0)) % 360 }}"
          - 100
        brightness_pct: 100
        transition: 1
    - delay: '00:00:1'
    - service: script.turn_on
      entity_id: script.light_colour_cycle6

light_colour_cycle6:
  alias: Hue Light Colour Cycle6
  sequence:
    - service: light.turn_on
      entity_id: light.fireplace_light
      data_template:
        hs_color:
          - "{{ (-15 + (state_attr('light.fireplace_light', 'hs_color')[0] or 0)) % 360 }}"
          - 100
        brightness_pct: 100
        transition: 1
    - delay: '00:00:1'
    - service: script.turn_on
      entity_id: script.light_colour_cycle5

I’d like to get the hold arrow to move in and out of the saturation of the colour but I don’t really know what I’m doing with this expression:

hs_color:
          - "{{ (15 + (state_attr('light.fireplace_light', 'hs_color')[0] or 0)) % 360 }}"
          - 100

I have got some different uses for the buttons with my white only lights which I will post as well.
This was the best one I came up with though. Reset the light by long pressing the power button. Even though it mostly turned it off first it seemed to work after a few seconds.

- id: FP_light_remote_reset
  alias: Fireplace Light Remote - Reset
  trigger:
    - platform: state
      entity_id: sensor.fireplace_light_remote_action
      to: "toggle_hold"
  condition:
  action:
  - service: light.turn_on
    data:
      entity_id: light.fireplace_light
      rgb_color: [255,255,255]
      brightness: 255

I also added a condition to this so it would reset to cool white in daylight hours and warm white in night hours.

I would strongly recommend taking a look to the app from AppDaemon, with just 4 lines of code, you connect the sensor with the light. I recently gave support to xy color lights, so it cycles through a list of colors. You can check which colors it goes through in here. Unfortunately, I do not have a video with the smoothness of the color changing, but I can assure you it is quite smooth since I use the transition attribute. I tested it with the same light you have, the LED1624G9. The configuration would look like this for you:

fireplace_light:
  module: z2m_ikea_controller
  class: E1810Controller
  sensor: sensor.fireplace_light_remote_action
  light: light.fireplace_light

If you need any help with the setup, let me know.

1 Like

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