Add DateTime channel type to comply with mqtt homie convention 3.x (#11894)

Signed-off-by: Lukas Agethen <lukas83@gmx.de>
This commit is contained in:
LukasA83 2022-01-06 23:35:41 +01:00 committed by GitHub
parent 348a1ce422
commit 1280a0e11b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 1 deletions

View 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:

View File

@ -36,7 +36,8 @@ public class PropertyAttributes extends AbstractMqttAttributeClass {
boolean_,
string_,
enum_,
color_
color_,
datetime_
}
public String name = "";

View 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>

View 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