azogue/eventsensor

Hue Tap Switch - Zigbee2MQTT

Closed this issue · 1 comments

Hi,

Rcently changed over to Z2M and was wondering how I can get it to work with the tap switch.

Here is what I have currently:
Screenshot 2022-12-28 at 1 36 15 pm

Here is what HA see's when I listen:

Screenshot 2022-12-28 at 1 08 23 pm

It's basically just:

event_type: state_changed
data:
  entity_id: sensor.living_ room tap_switch_action
  old state:
    entity_id: sensor. living_room_tap_switch_action
    state: press 1 attributes:

Hi @oneseventhree, this event sensor cannot link to the 'state_changed' event. It's an explicit limitation in

if config and config.get(CONF_EVENT) != EVENT_STATE_CHANGED:

When any HA entity changes state, including this sensor, a 'state_changed' event is emitted. So, apart from the magnitude problem (there are too many state-changed events), there is also a potential infinite loop problem, as the sensor would trigger after its state change AGAIN and again.

As I understand, with Z2M, you already have 'states' for the switches, right? so you don't need to listen to events, just reformat some entities to show attributes as states, isn't it?

Closing this one 👍