[hueemulation] Provide non-null context to TriggerHandlerCallback (#12320)

This prevents NPEs and a compilation issue when openhab/openhab-core#2763 is merged.

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born 2022-02-19 21:37:51 +01:00 committed by GitHub
parent 187937fbd1
commit 33b613d283
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -19,6 +19,7 @@ import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
import java.util.Map;
import org.openhab.core.automation.ModuleHandlerCallback;
import org.openhab.core.automation.Trigger;
@ -106,7 +107,7 @@ public class AbsoluteDateTimeTriggerHandler extends BaseTriggerModuleHandler imp
@Override
public void run() {
((TriggerHandlerCallback) callback).triggered(module, null);
((TriggerHandlerCallback) callback).triggered(module, Map.of());
schedule = null;
}
}

View File

@ -13,6 +13,7 @@
package org.openhab.io.hueemulation.internal.automation;
import java.time.Duration;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Callable;
@ -32,7 +33,7 @@ import org.slf4j.LoggerFactory;
* As soon as that time has run up, it will trigger.
* <p>
* A random factor and repeat times can also be configured.
*
*
* @author David Graeff - Initial contribution
*/
@NonNullByDefault
@ -114,7 +115,7 @@ public class TimerTriggerHandler extends BaseTriggerModuleHandler implements Cal
@Override
public Duration call() {
((TriggerHandlerCallback) callback).triggered(module, null);
((TriggerHandlerCallback) callback).triggered(module, Map.of());
config.repeat -= 1;
if (config.repeat == 0) {
schedule = null;