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

[netatmo] Webhook events are dispatched but group id is missing #17661

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions bundles/org.openhab.binding.netatmo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,18 +649,19 @@ Person things are automatically created in discovery process for all known perso

**Supported channels for the Person thing:**

| Channel Group | Channel ID | Item Type | Description |
| ------------- | ------------ | --------- | ------------------------------------------------------ |
| person | avatar-url | String | URL for the avatar of this person |
| person | avatar | Image | Avatar of this person |
| person | at-home | Switch | Indicates if this person is known to be at home or not |
| person | last-seen | DateTime | Moment when this person was last seen |
| last-event | subtype | String | Sub-type of event |
| last-event | message | String | Last event message from this person |
| last-event | time | DateTime | Moment of the last event for this person |
| last-event | snapshot | Image | Picture of the last event for this person |
| last-event | snapshot-url | String | URL for the picture of the last event for this person |
| last-event | camera-id | String | ID of the camera that triggered the event |
| Channel Group | Channel ID | Item Type | Description |
| -------------- | ------------ | --------- | ------------------------------------------------------------------------ |
| security-event | home-event | | Trigger channel which is triggered an event for this person is triggered |
lsiepel marked this conversation as resolved.
Show resolved Hide resolved
| person | avatar-url | String | URL for the avatar of this person |
| person | avatar | Image | Avatar of this person |
| person | at-home | Switch | Indicates if this person is known to be at home or not |
| person | last-seen | DateTime | Moment when this person was last seen |
| last-event | subtype | String | Sub-type of event |
| last-event | message | String | Last event message from this person |
| last-event | time | DateTime | Moment of the last event for this person |
| last-event | snapshot | Image | Picture of the last event for this person |
| last-event | snapshot-url | String | URL for the picture of the last event for this person |
| last-event | camera-id | String | ID of the camera that triggered the event |

All these channels except at-home are read only.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public enum ModuleType {
PERSON(FeatureArea.SECURITY, "NAPerson", 1, "virtual", HOME,
Set.of(PersonCapability.class, ChannelHelperCapability.class, ParentUpdateCapability.class),
new ChannelGroup(PersonChannelHelper.class, GROUP_PERSON),
new ChannelGroup(EventPersonChannelHelper.class, GROUP_PERSON_LAST_EVENT)),
new ChannelGroup(EventPersonChannelHelper.class, GROUP_SECURITY_EVENT, GROUP_PERSON_LAST_EVENT)),

WELCOME(FeatureArea.SECURITY, "NACamera", 1, "camera", HOME,
Set.of(CameraCapability.class, ChannelHelperCapability.class, ParentUpdateCapability.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ default void updateState(String groupId, String id, State state) {
void setThingStatus(ThingStatus thingStatus, ThingStatusDetail thingStatusDetail,
@Nullable String thingStatusReason);

void triggerChannel(String channelID, String event);
void triggerChannel(String groupID, String channelID, String event);

void updateThing(Thing thing);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public boolean isLinked(ChannelUID channelUID) {
}

@Override
public void triggerChannel(String channelID, String event) {
super.triggerChannel(channelID, event);
public void triggerChannel(String groupID, String channelID, String event) {
super.triggerChannel(new ChannelUID(this.getThing().getUID(), groupID, channelID), event);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public boolean isLinked(ChannelUID channelUID) {
}

@Override
public void triggerChannel(String channelID, String event) {
super.triggerChannel(channelID, event);
public void triggerChannel(String groupID, String channelID, String event) {
super.triggerChannel(new ChannelUID(this.getThing().getUID(), groupID, channelID), event);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ protected void updateWebhookEvent(WebhookEvent event) {
// The channel should get triggered at last (after super and sub methods), because this allows rules to access
// the new updated data from the other channels.
final String eventType = event.getEventType().name();
handler.recurseUpToHomeHandler(handler)
.ifPresent(homeHandler -> homeHandler.triggerChannel(CHANNEL_HOME_EVENT, eventType));
handler.triggerChannel(CHANNEL_HOME_EVENT, eventType);
handler.recurseUpToHomeHandler(handler).ifPresent(
homeHandler -> homeHandler.triggerChannel(GROUP_SECURITY_EVENT, CHANNEL_HOME_EVENT, eventType));
handler.triggerChannel(GROUP_SECURITY_EVENT, CHANNEL_HOME_EVENT, eventType);
}

private void updateSubGroup(WebhookEvent event, String group) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void updateEvent(Event event) {
return; // ignore incoming events if they are deprecated
}
lastEventTime = eventTime;
handler.triggerChannel(CHANNEL_HOME_EVENT, Objects.requireNonNull(
handler.triggerChannel(GROUP_SECURITY_EVENT, CHANNEL_HOME_EVENT, Objects.requireNonNull(
event.getSubTypeDescription().map(EventSubType::name).orElse(event.getEventType().name())));
}

Expand Down