From 4227b174ee970ec4f0993ddb66ac3930a3c268f1 Mon Sep 17 00:00:00 2001 From: Tom Billiet Date: Thu, 29 Feb 2024 18:19:34 +0100 Subject: [PATCH] Add openhab to readme --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 8d81715..94aca89 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,34 @@ There is a (basic) REST api available for debugging purposes. | /arylic/{device}/playpause | toggle play/pause | | /arylic/{device}/pause | pause | +## OpenHab + +The status published on MQTT can be used in various tool. The following example is on how to use it in OpenHab. + +`things/arylic.things` +``` +Thing mqtt:topic:arylic:Bureau "Arylic Bureau" (mqtt:broker:myBroker) @ "Arylic" { + Channels: + Type dimmer: volume [stateTopic="arylic/state/bureau/volume", commandTopic="arylic/cmd/bureau/volume", min="0", max="100"] + Type switch: play [stateTopic="arylic/state/bureau/playing", commandTopic="arylic/cmd/bureau/playpause", transformationPattern="DSL:truetoon.dsl"] +} +``` + +`transform/truetoon.dsl` +``` +val output = Boolean.parseBoolean(input) +if (output) { + "ON" +} else { + "OFF" +} +``` + +`items/arylic.items` +``` +Switch arylic_item_bureau_play "Audio Bureau play" {channel="mqtt:topic:arylic:Bureau:play"} +Dimmer arylic_item_bureau_volume "Audio Bureau volume" {channel="mqtt:topic:arylic:Bureau:volume"} +``` ## Development