Koenkk / Koenkk/zigbee2mqtt

Invalid Action "event_types" for LEXMAN ENKI remote control (HR-C99C-Z-C045)

Open
#33,030 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

problem
Dominant language
TypeScript
Stars
15.7k
Forks
2k
Avg merge
18h 55m
Merged PRs (30d)
35

Description

What happened?

The ADEO HR-C99C-Z-C045 should have 4 scene actions: scene_1, scene_2, scene_3, scene_4

However scene_1 and scene_2 do not exist and instead there is a simple scene event with an additional scene attribute, 1 or 2

Here is the MQTT discovery data for homeassistant/event/0x70ac08fffea4793e/action/config :

availability:
  - topic: zigbee2mqtt/bridge/state
    value_template: '{{ value_json.state }}'
  - topic: zigbee2mqtt/Télécommande ampli/availability
    value_template: '{{ value_json.state }}'
availability_mode: all
default_entity_id: event.télécommande_ampli_action
device:
  hw_version: 2
  identifiers:
    - zigbee2mqtt_0x70ac08fffea4793e
  manufacturer: ADEO
  model: RGB CTT LEXMAN ENKI remote control
  model_id: HR-C99C-Z-C045
  sw_version: 2.09.03
  via_device: zigbee2mqtt_bridge_0x00124b002f8aed1e
  name: Télécommande ampli
event_types:
  - 'on'
  - 'off'
  - scene
  - scene_3
  - scene_4
  - color_saturation_step_up
  - color_saturation_step_down
  - color_stop
  - color_hue_step_up
  - color_hue_step_down
  - color_temperature_step_up
  - color_temperature_step_down
  - brightness_step
  - brightness_stop
icon: mdi:gesture-double-tap
object_id: télécommande_ampli_action
origin:
  sw_version: 2.14.1
  support_url: https://www.zigbee2mqtt.io
  name: Zigbee2MQTT
state_topic: zigbee2mqtt/Télécommande ampli
unique_id: 0x70ac08fffea4793e_action_zigbee2mqtt
value_template: >-
  {% set patterns = [

  {"pattern":
  '^(?P<button>(?:button_)?[a-z0-9]+)_(?P<action>(?:press|hold)(?:_release)?)$',
  "groups": ["button", "action"]},

  {"pattern": '^(?P<action>recall|scene)_(?P<scene>[0-2][0-9]{0,2})$', "groups":
  ["action", "scene"]},

  {"pattern":
  '^(?P<actionPrefix>region_)(?P<region>[1-9]|10)_(?P<action>enter|leave|occupied|unoccupied)$',
  "groups": ["actionPrefix", "region", "action"]},

  {"pattern":
  '^(?P<action>dial_rotate)_(?P<direction>left|right)_(?P<speed>step|slow|fast)$',
  "groups": ["action", "direction", "speed"]},

  {"pattern": '^(?P<action>brightness_step)(?:_(?P<direction>up|down))?$',
  "groups": ["action", "direction"]}

  ] %}

  {% set action_value = value_json.action|default('') %}

  {% set ns = namespace(r=[('action', action_value)]) %}

  {% for p in patterns %}
    {% set m = action_value|regex_findall(p.pattern) %}
    {% if m[0] is undefined %}{% continue %}{% endif %}
    {% for key, value in zip(p.groups, m[0]) %}
      {% set ns.r = ns.r|rejectattr(0, 'eq', key)|list + [(key, value)] %}
    {% endfor %}
  {% endfor %}

  {% if (ns.r|selectattr(0, 'eq', 'actionPrefix')|first) is defined %}
    {% set ns.r = ns.r|rejectattr(0, 'eq', 'action')|list + [('action', ns.r|selectattr(0, 'eq', 'actionPrefix')|map(attribute=1)|first + ns.r|selectattr(0, 'eq', 'action')|map(attribute=1)|first)] %}
  {% endif %}

  {% set ns.r = ns.r + [('event_type', ns.r|selectattr(0, 'eq',
  'action')|map(attribute=1)|first)] %}

  {{dict.from_keys(ns.r|rejectattr(0, 'in', ('action',
  'actionPrefix'))|reject('eq', ('event_type', None))|reject('eq',
  ('event_type', '')))|to_json}}
name: Action

Here we clearly see that a single scene is advertised and then scene_3 and scene_4

What did you expect to happen?

retain the events as documented

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

2.14.1

Adapter firmware version

20240710

Adapter

ZStack3x0

Setup

HA Add-on

Device database.db entry

No response

Debug log

No response

Notes

At least another device has the same proplem with indexed events : https://github.com/Koenkk/zigbee2mqtt/issues/31862

And similarly the (legacy ?) text sensor exposes all events as expected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report provides MQTT discovery data for the action entity and compares it with the documented four scene actions; start by tracing how this discovery payload is generated for HR-C99C-Z-C045 in Zigbee2MQTT 2.14.1. Compare the event_types with the legacy text sensor behavior and verify that the published actions match the device documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.