if multiple DeviceTrigger components share a topic, and each
has a payload value configured, only messages matching that
payload should be delivered to the corresponding channel
Signed-off-by: Cody Cutrer <cody@cutrer.us>
// Is trigger?: Special handling
if (config.trigger) {
+ try {
+ cachedValue.parseMessage(new StringType(strValue));
+ } catch (IllegalArgumentException e) {
+ // invalid value for this trigger; ignore
+ receivedOrTimeout();
+ return;
+ }
channelStateUpdateListener.triggerChannel(channelUID, strValue);
receivedOrTimeout();
return;
verify(thingHandler).triggerChannel(eq(component.getChannel(channelId).getChannel().getUID()), eq(trigger));
}
+ /**
+ * Assert a channel does not triggers=
+ */
+ protected void assertNotTriggered(AbstractComponent<@NonNull ? extends AbstractChannelConfiguration> component,
+ String channelId, String trigger) {
+ verify(thingHandler, never()).triggerChannel(eq(component.getChannel(channelId).getChannel().getUID()),
+ eq(trigger));
+ }
+
/**
* Assert that given payload was published exact-once on given topic.
*
spyOnChannelUpdates(component, "action");
publishMessage("zigbee2mqtt/Charge Now Button/action", "on");
assertTriggered(component, "action", "on");
+
+ publishMessage("zigbee2mqtt/Charge Now Button/action", "off");
+ assertNotTriggered(component, "action", "off");
}
@Override