How to debug why Zigbee button and automation not working?

Hello,

I am new to HA, I have 1 problem with Z2M button working.
I have 20 same Ikea Tradfri 5button , connected with Z2M button automaiton. 19 of them working good, but 1 button not working I do the same like 19 what working.

Strange problem is that when I press that button - device remote react and I see that I press button. (so probably remote is sucesfully connected to HA)
Strangest thing is that light think its ON but bulb not turn on. (if I press the light in application its normaly bulb turn on)
in automations it detect last triggered when I press but nothing happend to device.

I checked its connected to bulb normaly.

I have similar situation with automation for SunSet and Sunrise, automation triggered but light don’t turn on , but on Sunrise its normaly go off.

I want to learn and see how I can debug this to know for future using.

I am new to HA after 5 years of Smartthings and I sucesfully connected more then 60 devices in HA in just 3 days of learning :slight_smile: . I love speed of HA against Smartthings.

Post the automations you are having trouble with (as preformatted text)

Automation code for automation that don’t working

alias: Spavaća soba Vedran daljinski - automatizacija
description: ""
use_blueprint:
  path: starbuck93/zigbee2mqtt-2-0-ikea-five-button-remote.yaml
  input:
    remote: 194b3fd085ab9b5aabe3cc9d26cf55e7
    light:
      device_id: 56a1e21a94a8b8e893de348cf6be6b0d

Automation config (Not working)

mode: restart
max_exceeded: silent
variables:
  force_brightness: false
triggers:
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: toggle
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: brightness_down_hold
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: brightness_down_release
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: brightness_down_click
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: arrow_left_hold
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: arrow_left_release
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: arrow_left_click
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: toggle_hold
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: brightness_up_hold
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: brightness_up_release
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: brightness_up_click
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: arrow_right_click
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: arrow_right_hold
    trigger: device
  - domain: mqtt
    device_id: 194b3fd085ab9b5aabe3cc9d26cf55e7
    type: action
    subtype: arrow_right_release
    trigger: device
actions:
  - variables:
      command: '{{ trigger.payload }}'
      button_long_max_loop_repeats: 100
  - choose:
      - conditions:
          - '{{ command == ''toggle'' }}'
        sequence:
          - choose:
              - conditions: '{{ force_brightness }}'
                sequence:
                  - target:
                      device_id: 56a1e21a94a8b8e893de348cf6be6b0d
                    data:
                      transition: 1
                      brightness_pct: 50
                    action: light.toggle
            default:
              - target:
                  device_id: 56a1e21a94a8b8e893de348cf6be6b0d
                data:
                  transition: 0
                action: light.toggle
      - conditions:
          - '{{ command == ''brightness_up_click'' }}'
        sequence:
          - target:
              device_id: 56a1e21a94a8b8e893de348cf6be6b0d
            data:
              brightness_step_pct: 10
              transition: 1
            action: light.turn_on
      - conditions:
          - '{{ command == ''brightness_up_hold'' }}'
        sequence:
          - repeat:
              while: '{{ repeat.index < button_long_max_loop_repeats | int }}'
              sequence:
                - data:
                    brightness_step_pct: 10
                    transition: 1
                  target:
                    device_id: 56a1e21a94a8b8e893de348cf6be6b0d
                  action: light.turn_on
                - delay: '1'
      - conditions:
          - '{{ command == ''brightness_up_release'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''brightness_down_click'' }}'
        sequence:
          - target:
              device_id: 56a1e21a94a8b8e893de348cf6be6b0d
            data:
              brightness_step_pct: -10
              transition: 1
            action: light.turn_on
      - conditions:
          - '{{ command == ''brightness_down_hold'' }}'
        sequence:
          - repeat:
              while: '{{ repeat.index < button_long_max_loop_repeats | int }}'
              sequence:
                - data:
                    brightness_step_pct: -10
                    transition: 1
                  target:
                    device_id: 56a1e21a94a8b8e893de348cf6be6b0d
                  action: light.turn_on
                - delay: '1'
      - conditions:
          - '{{ command == ''brightness_down_release'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''arrow_left_click'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''arrow_left_hold'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''arrow_right_click'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''arrow_right_hold'' }}'
        sequence: []
id: '1741781438318'
alias: Spavaća soba Vedran daljinski - automatizacija
description: ''

Here is same 2 devices what normaly working I will paste of working automation too.

Automation 2 - What is Working

id: '1741781479292'
alias: Spavaća soba Tatjana daljinski - automatizacija
description: ''
use_blueprint:
  path: starbuck93/zigbee2mqtt-2-0-ikea-five-button-remote.yaml
  input:
    remote: 100264b5f652004453cc03f80a656176
    light:
      device_id: 5a2ffe82aeab184199095b03e5fd1e55

Automation 2 (Working) - Automatin config

mode: restart
max_exceeded: silent
variables:
  force_brightness: false
triggers:
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: toggle
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: brightness_down_hold
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: brightness_down_release
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: brightness_down_click
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: arrow_left_hold
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: arrow_left_release
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: arrow_left_click
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: toggle_hold
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: brightness_up_hold
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: brightness_up_release
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: brightness_up_click
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: arrow_right_click
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: arrow_right_hold
    trigger: device
  - domain: mqtt
    device_id: 100264b5f652004453cc03f80a656176
    type: action
    subtype: arrow_right_release
    trigger: device
actions:
  - variables:
      command: '{{ trigger.payload }}'
      button_long_max_loop_repeats: 100
  - choose:
      - conditions:
          - '{{ command == ''toggle'' }}'
        sequence:
          - choose:
              - conditions: '{{ force_brightness }}'
                sequence:
                  - target:
                      device_id: 5a2ffe82aeab184199095b03e5fd1e55
                    data:
                      transition: 1
                      brightness_pct: 50
                    action: light.toggle
            default:
              - target:
                  device_id: 5a2ffe82aeab184199095b03e5fd1e55
                data:
                  transition: 0
                action: light.toggle
      - conditions:
          - '{{ command == ''brightness_up_click'' }}'
        sequence:
          - target:
              device_id: 5a2ffe82aeab184199095b03e5fd1e55
            data:
              brightness_step_pct: 10
              transition: 1
            action: light.turn_on
      - conditions:
          - '{{ command == ''brightness_up_hold'' }}'
        sequence:
          - repeat:
              while: '{{ repeat.index < button_long_max_loop_repeats | int }}'
              sequence:
                - data:
                    brightness_step_pct: 10
                    transition: 1
                  target:
                    device_id: 5a2ffe82aeab184199095b03e5fd1e55
                  action: light.turn_on
                - delay: '1'
      - conditions:
          - '{{ command == ''brightness_up_release'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''brightness_down_click'' }}'
        sequence:
          - target:
              device_id: 5a2ffe82aeab184199095b03e5fd1e55
            data:
              brightness_step_pct: -10
              transition: 1
            action: light.turn_on
      - conditions:
          - '{{ command == ''brightness_down_hold'' }}'
        sequence:
          - repeat:
              while: '{{ repeat.index < button_long_max_loop_repeats | int }}'
              sequence:
                - data:
                    brightness_step_pct: -10
                    transition: 1
                  target:
                    device_id: 5a2ffe82aeab184199095b03e5fd1e55
                  action: light.turn_on
                - delay: '1'
      - conditions:
          - '{{ command == ''brightness_down_release'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''arrow_left_click'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''arrow_left_hold'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''arrow_right_click'' }}'
        sequence: []
      - conditions:
          - '{{ command == ''arrow_right_hold'' }}'
        sequence: []
id: '1741781479292'
alias: Spavaća soba Tatjana daljinski - automatizacija
description: ''

Trace timeline (working automation)

Trace timeline (not working automation)