mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
[netatmo] Webhook events are dispatched but group id is missing (#17661)
* Events were dispatched but group id was missing Signed-off-by: Gaël L'hopital <gael@lhopital.org>
This commit is contained in:
@@ -649,18 +649,19 @@ Person things are automatically created in discovery process for all known perso
|
|||||||
|
|
||||||
**Supported channels for the Person thing:**
|
**Supported channels for the Person thing:**
|
||||||
|
|
||||||
| Channel Group | Channel ID | Item Type | Description |
|
| Channel Group | Channel ID | Item Type | Description |
|
||||||
| ------------- | ------------ | --------- | ------------------------------------------------------ |
|
| -------------- | ------------ | --------- | ------------------------------------------------------------------------------------------------- |
|
||||||
| person | avatar-url | String | URL for the avatar of this person |
|
| security-event | home-event | | Trigger channel which is triggered by an event for this person (PERSON, PERSON_AWAY, PERSON_HOME) |
|
||||||
| person | avatar | Image | Avatar of this person |
|
| person | avatar-url | String | URL for the avatar of this person |
|
||||||
| person | at-home | Switch | Indicates if this person is known to be at home or not |
|
| person | avatar | Image | Avatar of this person |
|
||||||
| person | last-seen | DateTime | Moment when this person was last seen |
|
| person | at-home | Switch | Indicates if this person is known to be at home or not |
|
||||||
| last-event | subtype | String | Sub-type of event |
|
| person | last-seen | DateTime | Moment when this person was last seen |
|
||||||
| last-event | message | String | Last event message from this person |
|
| last-event | subtype | String | Sub-type of event |
|
||||||
| last-event | time | DateTime | Moment of the last event for this person |
|
| last-event | message | String | Last event message from this person |
|
||||||
| last-event | snapshot | Image | Picture of the last event for this person |
|
| last-event | time | DateTime | Moment 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 | snapshot | Image | Picture of the last event for this person |
|
||||||
| last-event | camera-id | String | ID of the camera that triggered the event |
|
| 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.
|
All these channels except at-home are read only.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -81,7 +81,7 @@ public enum ModuleType {
|
|||||||
PERSON(FeatureArea.SECURITY, "NAPerson", 1, "virtual", HOME,
|
PERSON(FeatureArea.SECURITY, "NAPerson", 1, "virtual", HOME,
|
||||||
Set.of(PersonCapability.class, ChannelHelperCapability.class, ParentUpdateCapability.class),
|
Set.of(PersonCapability.class, ChannelHelperCapability.class, ParentUpdateCapability.class),
|
||||||
new ChannelGroup(PersonChannelHelper.class, GROUP_PERSON),
|
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,
|
WELCOME(FeatureArea.SECURITY, "NACamera", 1, "camera", HOME,
|
||||||
Set.of(CameraCapability.class, ChannelHelperCapability.class, ParentUpdateCapability.class),
|
Set.of(CameraCapability.class, ChannelHelperCapability.class, ParentUpdateCapability.class),
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ public interface CommonInterface {
|
|||||||
void setThingStatus(ThingStatus thingStatus, ThingStatusDetail thingStatusDetail,
|
void setThingStatus(ThingStatus thingStatus, ThingStatusDetail thingStatusDetail,
|
||||||
@Nullable String thingStatusReason);
|
@Nullable String thingStatusReason);
|
||||||
|
|
||||||
void triggerChannel(String channelID, String event);
|
void triggerChannel(String groupID, String channelID, String event);
|
||||||
|
|
||||||
void updateThing(Thing thing);
|
void updateThing(Thing thing);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -109,8 +109,8 @@ public class DeviceHandler extends BaseBridgeHandler implements CommonInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void triggerChannel(String channelID, String event) {
|
public void triggerChannel(String groupID, String channelID, String event) {
|
||||||
super.triggerChannel(channelID, event);
|
super.triggerChannel(new ChannelUID(this.getThing().getUID(), groupID, channelID), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -113,8 +113,8 @@ public class ModuleHandler extends BaseThingHandler implements CommonInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void triggerChannel(String channelID, String event) {
|
public void triggerChannel(String groupID, String channelID, String event) {
|
||||||
super.triggerChannel(channelID, event);
|
super.triggerChannel(new ChannelUID(this.getThing().getUID(), groupID, channelID), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+3
-3
@@ -120,9 +120,9 @@ public class CameraCapability extends HomeSecurityThingCapability {
|
|||||||
// The channel should get triggered at last (after super and sub methods), because this allows rules to access
|
// 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.
|
// the new updated data from the other channels.
|
||||||
final String eventType = event.getEventType().name();
|
final String eventType = event.getEventType().name();
|
||||||
handler.recurseUpToHomeHandler(handler)
|
handler.recurseUpToHomeHandler(handler).ifPresent(
|
||||||
.ifPresent(homeHandler -> homeHandler.triggerChannel(CHANNEL_HOME_EVENT, eventType));
|
homeHandler -> homeHandler.triggerChannel(GROUP_SECURITY_EVENT, CHANNEL_HOME_EVENT, eventType));
|
||||||
handler.triggerChannel(CHANNEL_HOME_EVENT, eventType);
|
handler.triggerChannel(GROUP_SECURITY_EVENT, CHANNEL_HOME_EVENT, eventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSubGroup(WebhookEvent event, String group) {
|
private void updateSubGroup(WebhookEvent event, String group) {
|
||||||
|
|||||||
+6
-3
@@ -76,9 +76,12 @@ public class Capability {
|
|||||||
|
|
||||||
if (newData instanceof HomeEvent homeEvent) {
|
if (newData instanceof HomeEvent homeEvent) {
|
||||||
updateHomeEvent(homeEvent);
|
updateHomeEvent(homeEvent);
|
||||||
} else if (newData instanceof WebhookEvent webhookEvent
|
} else if (newData instanceof WebhookEvent webhookEvent) {
|
||||||
&& webhookEvent.getEventType().validFor(moduleType)) {
|
if (webhookEvent.getEventType().validFor(moduleType)) {
|
||||||
updateWebhookEvent(webhookEvent);
|
updateWebhookEvent(webhookEvent);
|
||||||
|
} else {
|
||||||
|
// dropped
|
||||||
|
}
|
||||||
} else if (newData instanceof Event event) {
|
} else if (newData instanceof Event event) {
|
||||||
updateEvent(event);
|
updateEvent(event);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -102,7 +102,7 @@ public class PersonCapability extends HomeSecurityThingCapability {
|
|||||||
return; // ignore incoming events if they are deprecated
|
return; // ignore incoming events if they are deprecated
|
||||||
}
|
}
|
||||||
lastEventTime = eventTime;
|
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())));
|
event.getSubTypeDescription().map(EventSubType::name).orElse(event.getEventType().name())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
@@ -123,6 +123,7 @@ public class WebhookServlet extends NetatmoServlet {
|
|||||||
event.getNAObjectList().forEach(id -> {
|
event.getNAObjectList().forEach(id -> {
|
||||||
Capability module = dataListeners.get(id);
|
Capability module = dataListeners.get(id);
|
||||||
if (module != null) {
|
if (module != null) {
|
||||||
|
logger.trace("Dispatching webhook event to {}", id);
|
||||||
module.setNewData(event);
|
module.setNewData(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user