Z2M - Tradfri without action property? Latest updates

After I updated today HO AND Z2M to the latest configuration I dont get the _action entity anymore for my ikea tradfri 5 button sensor. Any idea? I only see battery…

The automation complains " Error in describing trigger: e is undefined"

If i’m checking my entity I can’t find any name**_action**

Here’s my automation:

alias: 0_living_light_button_plastic_automation
description: ikea button
triggers:
  - entity_id: sensor.0_living_light_button_plastic_action
    to:
      - toggle
      - toggle_hold
      - brightness_up_click
      - brightness_down_click
      - arrow_left_click
      - arrow_right_click
      - brightness_up_hold
      - brightness_down_hold
      - arrow_left_hold
      - arrow_right_hold
      - brightness_up_release
      - brightness_down_release
      - arrow_left_release
      - arrow_right_release
    trigger: state
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"toggle\" }}"
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            action: light.toggle
            data: {}
          - action: switch.toggle
            metadata: {}
            data: {}
            target:
              entity_id: switch.0_living_steckdose_lampe
            enabled: false
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"brightness_up_click\" }}"
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              brightness_step_pct: 20
              transition: 0.5
            action: light.turn_on
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"brightness_down_click\" }}"
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              brightness_step_pct: -20
              transition: 0.5
            action: light.turn_on
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"arrow_left_click\" }}"
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              color_temp: >-
                {% if state_attr(var_light_entities.entity_id[0], "color_temp")
                - 18 < 153 %}
                  {{ 153 }}
                {% else %}
                  {{ state_attr(var_light_entities.entity_id[0], "color_temp") - 18 }}
                {% endif %}
              transition: 0.5
            action: light.turn_on
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"arrow_right_click\" }}"
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              color_temp: >-
                {% if state_attr(var_light_entities.entity_id[0], "color_temp")
                + 18 > 500 %}
                  {{ 500 }}
                {% else %}
                  {{ state_attr(var_light_entities.entity_id[0], "color_temp") + 18 }}
                {% endif %}
              transition: 0.5
            action: light.turn_on
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"toggle_hold\" }}"
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              brightness: 254
              color_temp: 400
            action: light.turn_on
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.0_living_steckdose_lampe
            enabled: false
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"brightness_up_hold\" }}"
        sequence:
          - repeat:
              while: []
              sequence:
                - target:
                    entity_id:
                      - light.0_living_light_front
                      - light.0_living_light_right
                      - light.0_living_light_left
                      - light.0_living_lights_tv
                  data:
                    brightness_step_pct: 10
                    transition: 0.5
                  action: light.turn_on
                - delay:
                    milliseconds: 500
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"brightness_down_hold\" }}"
        sequence:
          - repeat:
              while: []
              sequence:
                - target:
                    entity_id:
                      - light.0_living_light_front
                      - light.0_living_light_right
                      - light.0_living_light_left
                      - light.0_living_lights_tv
                  data:
                    brightness_step_pct: -10
                    transition: 0.5
                  action: light.turn_on
                - delay:
                    milliseconds: 500
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"arrow_left_hold\" }}"
        sequence:
          - repeat:
              while: []
              sequence:
                - target:
                    entity_id:
                      - light.0_living_light_front
                      - light.0_living_light_right
                      - light.0_living_light_left
                      - light.0_living_lights_tv
                  data:
                    color_temp: >-
                      {% if state_attr(var_light_entities.entity_id[0],
                      "color_temp") - 18 < 153 %}
                        {{ 153 }}
                      {% else %}
                        {{ state_attr(var_light_entities.entity_id[0], "color_temp") - 18 }}
                      {% endif %}
                    transition: 0.5
                  action: light.turn_on
                - delay:
                    milliseconds: 500
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"arrow_right_hold\" }}"
        sequence:
          - repeat:
              while: []
              sequence:
                - target:
                    entity_id:
                      - light.0_living_light_front
                      - light.0_living_light_right
                      - light.0_living_light_left
                      - light.0_living_lights_tv
                  data:
                    color_temp: >-
                      {% if state_attr(var_light_entities.entity_id[0],
                      "color_temp") + 18 > 500 %}
                        {{ 500 }}
                      {% else %}
                        {{ state_attr(var_light_entities.entity_id[0], "color_temp") + 18 }}
                      {% endif %}
                    transition: 0.5
                  action: light.turn_on
                - delay:
                    milliseconds: 500
    default: []
mode: restart
variables:
  var_light_entities:
    entity_id:
      - light.0_living_light_front
      - light.0_living_light_right
      - light.0_living_light_left
      - light.0_living_lights_tv

It’s intentional; the release notes indicate it was eliminated in favor of using MQTT Device Trigger or a State Trigger with an event entity. The following helpful topic explains how to use an event entity.

If you’re not quite ready, or don’t have time, to modify your automations to work the new way, there are posts in that topic showing how to enable the “Home Assistant legacy action sensors” option (so your existing automations continue to work). Then you can convert your automations whenever it’s more convenient for you.


EDIT

Fixed the link.

2 Likes

Thanks a lot - shame on me, I even scanned the release notes but didnt spot it.

However, its mentioned that the event states can be found in the dev tools. In my case I dont see anything related to events/actions?

€dit: Ok, I guess I found the issue. None of the options was active - guess at least 1 should be ticked. Bit confusing:

I case someone else is struggling with the same issue, here’s the automation which does work now with the latest 2 version. Thanks for poiting me in the right direction :slight_smile:

alias: 0_living_light_button_plastic_automation
description: ikea button
triggers:
  - trigger: state
    entity_id: event.0_living_light_button_plastic_action
    to: null
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'toggle' }}"
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            action: light.toggle
            data: {}
          - action: switch.toggle
            metadata: {}
            data: {}
            target:
              entity_id: switch.0_living_steckdose_lampe
            enabled: false
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.to_state.attributes.event_type == 'brightness_up_click'
              }}
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              brightness_step_pct: 20
              transition: 0.5
            action: light.turn_on
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.to_state.attributes.event_type == 'brightness_down_click' }}
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              brightness_step_pct: -20
              transition: 0.5
            action: light.turn_on
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'arrow_left_click' }}"
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              color_temp: >-
                {% if state_attr(var_light_entities.entity_id[0], "color_temp")
                - 18 < 153 %}
                  {{ 153 }}
                {% else %}
                  {{ state_attr(var_light_entities.entity_id[0], "color_temp") - 18 }}
                {% endif %}
              transition: 0.5
            action: light.turn_on
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.to_state.attributes.event_type == 'arrow_right_click'
              }}
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              color_temp: >-
                {% if state_attr(var_light_entities.entity_id[0], "color_temp")
                + 18 > 500 %}
                  {{ 500 }}
                {% else %}
                  {{ state_attr(var_light_entities.entity_id[0], "color_temp") + 18 }}
                {% endif %}
              transition: 0.5
            action: light.turn_on
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'hold' }}"
        sequence:
          - target:
              entity_id:
                - light.0_living_light_front
                - light.0_living_light_right
                - light.0_living_light_left
                - light.0_living_lights_tv
            data:
              brightness: 254
              color_temp: 400
            action: light.turn_on
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.0_living_steckdose_lampe
            enabled: false
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.to_state.attributes.event_type == 'brightness_up_hold'
              }}
        sequence:
          - repeat:
              while: []
              sequence:
                - target:
                    entity_id:
                      - light.0_living_light_front
                      - light.0_living_light_right
                      - light.0_living_light_left
                      - light.0_living_lights_tv
                  data:
                    brightness_step_pct: 10
                    transition: 0.5
                  action: light.turn_on
                - delay:
                    milliseconds: 500
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.to_state.attributes.event_type ==
              'brightness_down_hold' }}
        sequence:
          - repeat:
              while: []
              sequence:
                - target:
                    entity_id:
                      - light.0_living_light_front
                      - light.0_living_light_right
                      - light.0_living_light_left
                      - light.0_living_lights_tv
                  data:
                    brightness_step_pct: -10
                    transition: 0.5
                  action: light.turn_on
                - delay:
                    milliseconds: 500
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'arrow_left_hold' }}"
        sequence:
          - repeat:
              while: []
              sequence:
                - target:
                    entity_id:
                      - light.0_living_light_front
                      - light.0_living_light_right
                      - light.0_living_light_left
                      - light.0_living_lights_tv
                  data:
                    color_temp: >-
                      {% if state_attr(var_light_entities.entity_id[0],
                      "color_temp") - 18 < 153 %}
                        {{ 153 }}
                      {% else %}
                        {{ state_attr(var_light_entities.entity_id[0], "color_temp") - 18 }}
                      {% endif %}
                    transition: 0.5
                  action: light.turn_on
                - delay:
                    milliseconds: 500
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.attributes.event_type == 'arrow_right_hold' }}"
        sequence:
          - repeat:
              while: []
              sequence:
                - target:
                    entity_id:
                      - light.0_living_light_front
                      - light.0_living_light_right
                      - light.0_living_light_left
                      - light.0_living_lights_tv
                  data:
                    color_temp: >-
                      {% if state_attr(var_light_entities.entity_id[0],
                      "color_temp") + 18 > 500 %}
                        {{ 500 }}
                      {% else %}
                        {{ state_attr(var_light_entities.entity_id[0], "color_temp") + 18 }}
                      {% endif %}
                    transition: 0.5
                  action: light.turn_on
                - delay:
                    milliseconds: 500
    default: []
mode: restart
variables:
  var_light_entities:
    entity_id:
      - light.0_living_light_front
      - light.0_living_light_right
      - light.0_living_light_left
      - light.0_living_lights_tv

It’s customary to assign the Solution tag to the reply that answered/solved the original question/problem.

In this case, I explained why your sensor.xxxx_action entities are gone (thereby affecting all automations that used them) and how to fix it, either by modifying the automations to use different triggers (along with a link to a topic with clear examples) or by simply enabling an option that would restore the missing sensors (thereby requiring no modifications).

You acted on this advice and then marked your own post as the Solution.

For more information about the use of the Solution tag refer to the following:

FAQ - Guideline 21 - Somebody’s answer solved it.