Sian-Lee-SA / Home-Assistant-Switch-Manager

Switch manager is a centralised component to handle button pushes for your wireless switches. This includes anything passed through the event bus. The component relies on switch blueprints which is easily made to allow GUI configuration of your switches and their button pushes. This helps remove clutter from the automations.
Other
222 stars 84 forks source link

Handle enums in events #167

Closed hco closed 12 months ago

hco commented 1 year ago

This "fixes" #166. I don't have a lot of experience with python, so this might be complete bullshit. Couldn't resist debugging and trying to fix it.

Maybe this helps you to implement a proper solution, if mine sucks.

Sian-Lee-SA commented 1 year ago

Could you please post an example of the event from the developer tools page, I just want to grasp the data coming in.

hco commented 1 year ago

That would be the following:

event_type: zha_event
data:
  device_ieee: 94:de:b8:...
  unique_id: 94:de:b8:...
  device_id: 9bbd770e...
  endpoint_id: 1
  cluster_id: 8
  command: move_with_on_off
  args:
    - 0
    - 255
  params:
    move_mode: 0
    rate: 255
origin: LOCAL
time_fired: "2023-08-17T07:26:02.359873+00:00"
context:
  id: 01H816653QM8MC819ZCYTA262X
  parent_id: null
  user_id: null
Sian-Lee-SA commented 1 year ago

Will try to look into this soon but the best approach is the use the integer value of the enum as to match the output of the event bus

Sian-Lee-SA commented 12 months ago

Enums are now being checked against their values and not keys