From: LukasA83 <58861945+LukasA83@users.noreply.github.com> Date: Thu, 6 Jan 2022 22:35:41 +0000 (+0100) Subject: Add DateTime channel type to comply with mqtt homie convention 3.x (#11894) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=1280a0e11b69f5bf75b93f64dbe9d2e14fb29887;p=openhab-addons.git Add DateTime channel type to comply with mqtt homie convention 3.x (#11894) Signed-off-by: Lukas Agethen --- diff --git a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/Property.java b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/Property.java index 77775d13fc..b87e525c2e 100644 --- a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/Property.java +++ b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/Property.java @@ -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: diff --git a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/PropertyAttributes.java b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/PropertyAttributes.java index 53096c078a..993f242544 100644 --- a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/PropertyAttributes.java +++ b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/PropertyAttributes.java @@ -36,7 +36,8 @@ public class PropertyAttributes extends AbstractMqttAttributeClass { boolean_, string_, enum_, - color_ + color_, + datetime_ } public String name = ""; diff --git a/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/config/homie-channel-config.xml b/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/config/homie-channel-config.xml index 83e50a30bb..7bb8d25752 100644 --- a/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/config/homie-channel-config.xml +++ b/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/config/homie-channel-config.xml @@ -42,6 +42,7 @@ + diff --git a/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/i18n/mqtt.properties b/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/i18n/mqtt.properties index fcbe137d35..295e5a9f46 100644 --- a/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/i18n/mqtt.properties +++ b/bundles/org.openhab.binding.mqtt.homie/src/main/resources/OH-INF/i18n/mqtt.properties @@ -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