Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Hue events #49

Closed
balloob opened this issue May 13, 2021 · 26 comments
Closed

Unhandled Hue events #49

balloob opened this issue May 13, 2021 · 26 comments

Comments

@balloob
Copy link
Collaborator

balloob commented May 13, 2021

Current supported Hue events:

If you have a missing event, please post them here so we can update our code. It will update a lot if you could also include the state property of your device so we know how an event could be applied to the state and update it.

If you want to help and make PRs, add methods like we have for light and group, but handle other event types like motion or more attributes.

@Mariusthvdb

This comment has been minimized.

@frenck
Copy link
Contributor

frenck commented May 13, 2021

@Mariusthvdb how is this even related to what is presented in the OP? 😕

@Mariusthvdb
Copy link

Mariusthvdb commented May 14, 2021

Sorry but I interpreted Paulus's last sentence ('more attributes') as a call for which attributes we would like see added. Given the fact attribute 'reachable' was not listed, that would be relevant. As for the group/zone handling, I am not sure how to add the event for Zone's, because current HA Hue integration doesn't discern between the 2.

@balloob
Copy link
Collaborator Author

balloob commented May 14, 2021

This issue is about events. This attributes is about the ones that are extracted from events.

@bramkragten
Copy link
Contributor

bramkragten commented May 14, 2021

@SeraphimSerapis
Copy link

SeraphimSerapis commented May 15, 2021

Here's a ZGP button press (originating from a Friend of Hue switch):

2021-05-15 13:26:37 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Subscribing to events
2021-05-15 13:26:37 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Don't know how to handle update event for /sensors/211 (ZGPSwitchSensor): {'button': {'last_event': 'initial_press'}, 'id': 'BUTTON_ID', 'id_v1': '/sensors/211', 'type': 'button'}
2021-05-15 13:26:38 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Received event: {'creationtime': '2021-05-15T11:26:37Z', 'data': [{'button': {'last_event': 'short_release'}, 'id': 'BUTTON_ID', 'id_v1': '/sensors/211', 'type': 'button'}], 'id': 'UPDATE_ID', 'type': 'update'}
2021-05-15 13:26:38 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Received event: {'creationtime': '2021-05-15T11:26:37Z', 'data': [{'id': 'LIGHT_1', 'id_v1': '/lights/36', 'on': {'on': True}, 'type': 'light'}], 'id': 'UPDATE_ID', 'type': 'update'}
2021-05-15 13:26:38 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Received event: {'creationtime': '2021-05-15T11:26:37Z', 'data': [{'id': 'LIGHT_2', 'id_v1': '/lights/37', 'on': {'on': True}, 'type': 'light'}], 'id': 'UPDATE_ID', 'type': 'update'}
2021-05-15 13:26:38 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Received event: {'creationtime': '2021-05-15T11:26:37Z', 'data': [{'id': 'GROUP_1', 'id_v1': '/groups/1', 'on': {'on': True}, 'type': 'grouped_light'}], 'id': 'UPDATE_ID', 'type': 'update'}
2021-05-15 13:26:38 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Subscribing to events
2021-05-15 13:26:38 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Don't know how to handle update event for /sensors/211 (ZGPSwitchSensor): {'button': {'last_event': 'short_release'}, 'id': 'BUTTON_ID', 'id_v1': '/sensors/211', 'type': 'button'}

Is this format useful to you? The button itself doesn't have an actual state since it's just appearing as events in Home Assistant.

I also found this in the log:

 '62727': {'name': 'Kitchen Switch', 'description': 'Kitchen Switch behavior', 'type': 'Link', 'classid': 10050, 'owner': 'OWNER_ID', 'recycle': False, 'links': ['/rules/118', '/rules/117', '/rules/116', '/rules/115', '/rules/114', '/rules/93', '/rules/92', '/rules/75', '/rules/74', '/rules/73', '/rules/72', '/rules/47', '/rules/46', '/rules/45', '/rules/44', '/rules/43', '/sensors/211', '/scenes/SCENE_ID', '/scenes/SCENE_ID', '/scenes/SCENE_ID-rCXKpa', '/scenes/SCENE_ID', '/groups/22', '/groups/20', '/lights/37', '/lights/36', '/groups/18', '/groups/14', '/lights/44', '/sensors/227', '/sensors/226']},

This is taken from 2021-05-15 13:16:10 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Unused result:

@balloob
Copy link
Collaborator Author

balloob commented May 16, 2021

PR to handle button events #52

@Gramatus
Copy link

In case it is useful, this is from a ZLLSwitchSensor (the standard Hue Dimmer Switch). Seems to be the exact same format as for the ZGP above:

Received event: {'creationtime': '2021-05-16T17:38:56Z', 'data': [{'button': {'last_event': 'initial_press'}, 'id': 'BUTTON_ID', 'id_v1': '/sensors/107', 'type': 'button'}], 'id': 'UPDATE_ID', 'type': 'update'}

@balloob
Copy link
Collaborator Author

balloob commented May 17, 2021

Support for both ZLL and ZGP Switch sensors are in aiohue 2.5.0. (HA PR home-assistant/core#50748)

@SeraphimSerapis
Copy link

Tested and it works great!

@SeraphimSerapis
Copy link

I did some more testing and noticed I miss a long press or hold event for my ZGP switch. At least the Hue app supports that event and this is what the log provides:

2021-05-28 12:51:17 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Received event: {'creationtime': '2021-05-28T10:51:16Z', 'data': [{'button': {'last_event': 'initial_press'}, 'id': 'button_id', 'id_v1': '/sensors/211', 'type': 'button'}], 'id': 'd8b0093e-01ae-4923-b42f-7a427168a746', 'type': 'update'}
2021-05-28 12:51:17 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Subscribing to events
2021-05-28 12:51:18 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Received event: {'creationtime': '2021-05-28T10:51:17Z', 'data': [{'dimming': {'brightness': 0.0}, 'id': 'f3978df5-8900-4714-a0ec-66f99ad2ebde', 'id_v1': '/lights/44', 'type': 'light'}], 'id': 'ec4100f3-c21c-4564-9aa2-da260e039368', 'type': 'update'}
2021-05-28 12:51:18 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Subscribing to events
2021-05-28 12:51:19 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Received event: {'creationtime': '2021-05-28T10:51:18Z', 'data': [{'id': '91b7af4c-14c7-433f-bb26-9dd68e955029', 'id_v1': '/sensors/79', 'motion': {'motion': True}, 'type': 'motion'}], 'id': 'ed3f59b5-518b-4ebe-86c3-c3b7f7eff02f', 'type': 'update'}
2021-05-28 12:51:19 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Subscribing to events
2021-05-28 12:51:20 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Received event: {'creationtime': '2021-05-28T10:51:19Z', 'data': [{'button': {'last_event': 'short_release'}, 'id': 'button_id', 'id_v1': '/sensors/211', 'type': 'button'}], 'id': '84cde7ba-068e-4567-8f85-532a547ce2f9', 'type': 'update'}
2021-05-28 12:51:20 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Subscribing to events

Please let me know if you need more data or logs. Happy Friday!

@bramkragten
Copy link
Contributor

bramkragten commented May 28, 2021

So it does not provide us any info about long-press or hold, that would all be software-based. (calculating time between initial_press and short_release)

@balloob
Copy link
Collaborator Author

balloob commented May 31, 2021

I guess we can do that. Do we know a definition of a long press in ms?

@SeraphimSerapis
Copy link

I've done some fairly unscientific testing via deCONZ with a Hue dimmer and this is how they handle the events:

Event 37 fired 10:39 AM:
{
    "event_type": "deconz_event",
    "data": {
        "id": "bathroom_dimmer",
        "unique_id": "UNIQUE_ID",
        "event": 4003,
        "device_id": "DEVICE_ID"
    },
    "origin": "LOCAL",
    "time_fired": "2021-05-31T08:39:45.403831+00:00",
    "context": {
        "id": "4a7fc1a7f8e27b65da9bfcdb909d8e28",
        "parent_id": null,
        "user_id": null
    }
}
Event 36 fired 10:39 AM:
{
    "event_type": "deconz_event",
    "data": {
        "id": "bathroom_dimmer",
        "unique_id": "UNIQUE_ID",
        "event": 4001,
        "device_id": "DEVICE_ID"
    },
    "origin": "LOCAL",
    "time_fired": "2021-05-31T08:39:45.196343+00:00",
    "context": {
        "id": "6b525ffdd37e49aef6bf02c88f93df7c",
        "parent_id": null,
        "user_id": null
    }
}
Event 35 fired 10:39 AM:
{
    "event_type": "deconz_event",
    "data": {
        "id": "bathroom_dimmer",
        "unique_id": "UNIQUE_ID",
        "event": 4000,
        "device_id": "DEVICE_ID"
    },
    "origin": "LOCAL",
    "time_fired": "2021-05-31T08:39:44.282748+00:00",
    "context": {
        "id": "7c64920f9f508414f0a231b783103e77",
        "parent_id": null,
        "user_id": null
    }
}

There's roughly 1000ms between the click and release -- I tried a couple of times but wasn't able to achieve anything < 1000ms.

@Mariusthvdb
Copy link

Mariusthvdb commented May 31, 2021

Is this what you are looking for: the 'hold release' events?
Schermafbeelding 2021-05-31 om 11 08 48
Schermafbeelding 2021-05-31 om 11 09 02

CONF_LONG_RELEASE = "remote_button_long_release" / {CONF_EVENT: X003}

mm, guess not, because thats already in core. sorry.

@SeraphimSerapis
Copy link

Those, but for a ZGP switch, which currently doesn't produce that long_press or _hold event.

@bramkragten
Copy link
Contributor

@SeraphimSerapis did we have these events before? When we didn't have push?

@SeraphimSerapis
Copy link

SeraphimSerapis commented May 31, 2021

@bramkragten I just tested and it seems like the current hue integration doesn't feature that event:

These are the event codes that are available -- matching what the push-based version is able to do:

16: "left_upper_press",
20: "left_upper_release",
17: "left_lower_press",
21: "left_lower_release",
18: "right_lower_press",
22: "right_lower_release",
19: "right_upper_press",
23: "right_upper_release",
100: "double_upper_press",
101: "double_upper_release",
98: "double_lower_press",
99: "double_lower_release"

It seems like deCONZ and the Hue app do some software-based work on those buttons to emulate a hold event. deCONZ uses the codes as specified in the docs.

@Mariusthvdb
Copy link

Mariusthvdb commented Jun 9, 2021

would a light level change of the motion_sensor constitute an event? seems these attributes still are not pushed immediately. (only upon motion sensing)

@bramkragten
Copy link
Contributor

They don't cause an event, so we can't handle it.

@Mariusthvdb
Copy link

Mariusthvdb commented Jun 10, 2021

ok, thanks. and now we are no longer polling the HUB, light_level changes are no longer updated anymore at all?

@frenck
Copy link
Contributor

frenck commented Jun 10, 2021

polling still happens.

@Mariusthvdb
Copy link

thats good to know, which interval please? must be over a minute, because locally the light_levels are not changing within that timeframe. (unless motion is recorded that is)

@frenck
Copy link
Contributor

frenck commented Jun 10, 2021

Dunno, but this issue is about collecting unhandled events, I suggest using the Home Assistant forums or chat for general support.

@damienpenman
Copy link

I've got a few events occurring for Hue Motion sensors that dont seem to be getting handled, ZLLLightLevelSensor and ZLLTemperatureSensor. Examples below - hope its of use.

2021-07-27 15:30:54 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Don't know how to handle update event for /sensors/26 (ZLLLightLevelSensor): {'id': '87746f7f-ef7b-4445-b3d1-287c24d7c951', 'id_v1': '/sensors/26', 'light': {'light_level': 32057, 'light_level_valid': True}, 'type': 'light_level'}
2021-07-27 15:34:18 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Don't know how to handle update event for /sensors/29 (ZLLLightLevelSensor): {'id': '2b513cc1-a1c1-4852-8f2a-8f339ffa6955', 'id_v1': '/sensors/29', 'light': {'light_level': 35847, 'light_level_valid': True}, 'type': 'light_level'}
2021-07-27 15:34:21 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Don't know how to handle update event for /sensors/32 (ZLLLightLevelSensor): {'id': '2ad753a2-309e-4297-8a92-48f896ccac8c', 'id_v1': '/sensors/32', 'light': {'light_level': 29783, 'light_level_valid': True}, 'type': 'light_level'}

2021-07-27 15:31:50 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Don't know how to handle update event for /sensors/27 (ZLLTemperatureSensor): {'id': '9f78f5fd-91bc-4f75-a990-1aa0eb62241a', 'id_v1': '/sensors/27', 'temperature': {'temperature': 20.540000915527344, 'temperature_valid': True}, 'type': 'temperature'}
2021-07-27 15:32:52 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Don't know how to handle update event for /sensors/30 (ZLLTemperatureSensor): {'id': 'bb2b03b1-7cff-48d4-9be9-9cdfaeb52fb4', 'id_v1': '/sensors/30', 'temperature': {'temperature': 21.270000457763672, 'temperature_valid': True}, 'type': 'temperature'}
2021-07-27 15:34:29 DEBUG (MainThread) [aiohue.bridge.0.0.0.0] Don't know how to handle update event for /sensors/33 (ZLLTemperatureSensor): {'id': 'b4ac69b4-1788-4e46-b630-4767ef4fd78e', 'id_v1': '/sensors/33', 'temperature': {'temperature': 23.09000015258789, 'temperature_valid': True}, 'type': 'temperature'}

@marcelveldt
Copy link
Collaborator

closing this issue as it is stale and we released the V2 implementation including the full support of all events

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants