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.AbstractMqttAttributeClass.AttributeChanged;
import org.openhab.binding.mqtt.generic.mapping.ColorMode; import org.openhab.binding.mqtt.generic.mapping.ColorMode;
import org.openhab.binding.mqtt.generic.values.ColorValue; 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.NumberValue;
import org.openhab.binding.mqtt.generic.values.OnOffValue; import org.openhab.binding.mqtt.generic.values.OnOffValue;
import org.openhab.binding.mqtt.generic.values.PercentageValue; 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); value = new NumberValue(min, max, step, attributes.unit);
} }
break; break;
case datetime_:
value = new DateTimeValue();
break;
case string_: case string_:
case unknown: case unknown:
default: default:

View File

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

View File

@ -42,6 +42,7 @@
<option value="string_">String</option> <option value="string_">String</option>
<option value="enum_">Enumeration</option> <option value="enum_">Enumeration</option>
<option value="color_">Colour</option> <option value="color_">Colour</option>
<option value="datetime_">DateTime</option>
</options> </options>
</parameter> </parameter>
</config-description> </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.string_ = String
channel-type.config.mqtt.homie-channel.datatype.option.enum_ = Enumeration 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.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.label = Format
channel-type.config.mqtt.homie-channel.format.description = The output format. channel-type.config.mqtt.homie-channel.format.description = The output format.
channel-type.config.mqtt.homie-channel.name.label = Name channel-type.config.mqtt.homie-channel.name.label = Name