]> git.basschouten.com Git - openhab-addons.git/commitdiff
Add DateTime channel type to comply with mqtt homie convention 3.x (#11894)
authorLukasA83 <58861945+LukasA83@users.noreply.github.com>
Thu, 6 Jan 2022 22:35:41 +0000 (23:35 +0100)
committerGitHub <noreply@github.com>
Thu, 6 Jan 2022 22:35:41 +0000 (23:35 +0100)
Signed-off-by: Lukas Agethen <lukas83@gmx.de>
bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/Property.java
bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/PropertyAttributes.java
bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/config/homie-channel-config.xml
bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/i18n/mqtt.properties

index 77775d13fc9077fe7528096edc250ebfb99472a8..b87e525c2ec4064391a8f4d615d3d57e9a69891f 100644 (file)
@@ -30,6 +30,7 @@ import org.openhab.binding.mqtt.generic.mapping.AbstractMqttAttributeClass;
 import org.openhab.binding.mqtt.generic.mapping.AbstractMqttAttributeClass.AttributeChanged;
 import org.openhab.binding.mqtt.generic.mapping.ColorMode;
 import org.openhab.binding.mqtt.generic.values.ColorValue;
+import org.openhab.binding.mqtt.generic.values.DateTimeValue;
 import org.openhab.binding.mqtt.generic.values.NumberValue;
 import org.openhab.binding.mqtt.generic.values.OnOffValue;
 import org.openhab.binding.mqtt.generic.values.PercentageValue;
@@ -218,6 +219,9 @@ public class Property implements AttributeChanged {
                     value = new NumberValue(min, max, step, attributes.unit);
                 }
                 break;
+            case datetime_:
+                value = new DateTimeValue();
+                break;
             case string_:
             case unknown:
             default:
index 53096c078a3ff80545d6d12e80da501fb480df57..993f242544682dcebf72c002fffbd6b246ffded1 100644 (file)
@@ -36,7 +36,8 @@ public class PropertyAttributes extends AbstractMqttAttributeClass {
         boolean_,
         string_,
         enum_,
-        color_
+        color_,
+        datetime_
     }
 
     public String name = "";
index 83e50a30bb53560d45a718f8bcb657cb5cb344e4..7bb8d2575271c7a39023ee336a69d5f3f51b6520 100644 (file)
@@ -42,6 +42,7 @@
                                <option value="string_">String</option>
                                <option value="enum_">Enumeration</option>
                                <option value="color_">Colour</option>
+                               <option value="datetime_">DateTime</option>
                        </options>
                </parameter>
        </config-description>
index fcbe137d35210804512b057eff1f031c1e1a008b..295e5a9f4662ac792478e2605fc71f4ccd410199 100644 (file)
@@ -6,6 +6,7 @@ channel-type.config.mqtt.homie-channel.datatype.option.boolean_ = Boolean
 channel-type.config.mqtt.homie-channel.datatype.option.string_ = String
 channel-type.config.mqtt.homie-channel.datatype.option.enum_ = Enumeration
 channel-type.config.mqtt.homie-channel.datatype.option.color_ = Colour
+channel-type.config.mqtt.homie-channel.datatype.option.datetime_ = DateTime
 channel-type.config.mqtt.homie-channel.format.label = Format
 channel-type.config.mqtt.homie-channel.format.description = The output format.
 channel-type.config.mqtt.homie-channel.name.label = Name