From 2c2ba4bed1742938c0243b02ec418128bb481a31 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Tue, 28 Mar 2023 10:26:13 -0600 Subject: [PATCH] [mqtt.homeassistant] fix JSON Schema lights (#14717) https://github.com/openhab/openhab-addons/pull/12238 was merged after JSON Schema Light was implemented, and changed some assumptions. this commit adjusts to the changed interface Signed-off-by: Cody Cutrer --- .../internal/component/JSONSchemaLight.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/JSONSchemaLight.java b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/JSONSchemaLight.java index 722af0b42..ab8fc37eb 100644 --- a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/JSONSchemaLight.java +++ b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/JSONSchemaLight.java @@ -181,17 +181,18 @@ public class JSONSchemaLight extends AbstractRawSchemaLight { } if (jsonState.state != null) { - onOffValue.update(new StringType(jsonState.state)); + onOffValue.update(onOffValue.parseCommand(new StringType(jsonState.state))); if (brightnessValue.getChannelState() instanceof UnDefType) { - brightnessValue.update((OnOffType) onOffValue.getChannelState()); + brightnessValue.update(brightnessValue.parseCommand((OnOffType) onOffValue.getChannelState())); } if (colorValue.getChannelState() instanceof UnDefType) { - colorValue.update((OnOffType) onOffValue.getChannelState()); + colorValue.update(colorValue.parseCommand((OnOffType) onOffValue.getChannelState())); } } if (jsonState.brightness != null) { - brightnessValue.update(new DecimalType(Objects.requireNonNull(jsonState.brightness))); + brightnessValue.update( + brightnessValue.parseCommand(new DecimalType(Objects.requireNonNull(jsonState.brightness)))); if (colorValue.getChannelState() instanceof HSBType) { HSBType color = (HSBType) colorValue.getChannelState(); colorValue.update(new HSBType(color.getHue(), color.getSaturation(),