]> git.basschouten.com Git - openhab-addons.git/commitdiff
[mqtt.homeassistant] fix JSON Schema lights (#14717)
authorCody Cutrer <cody@cutrer.us>
Tue, 28 Mar 2023 16:26:13 +0000 (10:26 -0600)
committerGitHub <noreply@github.com>
Tue, 28 Mar 2023 16:26:13 +0000 (18:26 +0200)
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 <cody@cutrer.us>
bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/JSONSchemaLight.java

index 722af0b42eb295be113ad988d64e4339d513b0b5..ab8fc37ebfd0442e9911d6c0e40330d0e27e8c9c 100644 (file)
@@ -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(),