Added Channel of DateTimeType (#2347)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp 2021-05-06 22:11:30 +02:00 committed by GitHub
parent 305683ac6a
commit aa48f5990e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -13,6 +13,7 @@
package org.openhab.core.magic.binding.handler;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.library.types.DateTimeType;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
@ -35,6 +36,7 @@ public class MagicOnOffLightHandler extends BaseThingHandler {
@Override
public void handleCommand(ChannelUID channelUID, Command command) {
triggerChannel("trigger", command.toString());
updateState("timestamp", new DateTimeType());
}
@Override

View File

@ -152,4 +152,10 @@
</event>
</channel-type>
<channel-type id="timestamp">
<item-type>DateTime</item-type>
<label>Timestamp</label>
<category>time</category>
</channel-type>
</thing:thing-descriptions>

View File

@ -17,6 +17,7 @@
<channels>
<channel id="switch" typeId="switch"/>
<channel id="timestamp" typeId="timestamp"/>
<channel id="trigger" typeId="trigger"/>
</channels>