From 94c8a556f3651defa2ac8298c9aa379d721bb77e Mon Sep 17 00:00:00 2001 From: Thomas Dietrich Date: Wed, 22 Mar 2017 21:33:29 +0100 Subject: [PATCH] Add zMote items and rules --- items/zmote.items | 12 ++ logitech-z906.json | 259 ++++++++++++++++++++++++++++++++++++++++ rules/kodi.rules | 9 ++ rules/soundsystem.rules | 9 ++ things/zmote.things | 1 + 5 files changed, 290 insertions(+) create mode 100644 items/zmote.items create mode 100644 logitech-z906.json create mode 100644 rules/soundsystem.rules create mode 100644 things/zmote.things diff --git a/items/zmote.items b/items/zmote.items new file mode 100644 index 0000000..f0526ee --- /dev/null +++ b/items/zmote.items @@ -0,0 +1,12 @@ +Switch zmote_reachable "zMote Online" { channel="zmote:zmt2:CI00070700:online" } +String zmote_sendkey "Send Button" { channel="zmote:zmt2:CI00070700:sendkey", expire="1s" } +String zmote_sendcode "Send IR Code" { channel="zmote:zmt2:CI00070700:sendcode", expire="1s" } + +// http://www.hifi-remote.com/forums/viewtopic.php?t=14120 +// http://irdb.tk/convert +// http://www.zmote.io/apis#convertingirsignalsfromotherformats +// +// Input (NEC1 2 160 8) 38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBBBCBBBBCCCBCCCC21,1672,343,86,21,3730 +// Input 1 (NEC1 2 160 4) 38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBBCBBBBBCCBCCCCC21,1672,343,86,21,3730 +// Input 2 (NEC1 2 160 130) 38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBCBBBBBCCBCCCCCB21,1672,343,86,21,3730 +// (Attention: second number needed to replaced 1->2) \ No newline at end of file diff --git a/logitech-z906.json b/logitech-z906.json new file mode 100644 index 0000000..32f4d6f --- /dev/null +++ b/logitech-z906.json @@ -0,0 +1,259 @@ +{ + "_id": "58c58cef5107a80100adbc62", + "brand": "Logitech", + "model": "Z906", + "name": "logitech_z906", + "__v": 0, + "comments": [], + "layout": [ + "KEY_POWER", + "rowbreak", + "KEY_VOLUMEDOWN", + "KEY_MUTE", + "KEY_VOLUMEUP", + "rowbreak", + "effect", + "rowbreak", + "pagebreak" + ], + "keys": [ + { + "key": "KEY_POWER", + "name": "POWER", + "icon": "settings_power", + "code": "38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBBBBBBBCCCCCCCCB21,1672,343,86,21,3730", + "_id": "58c58bc15107a80100adbc58", + "spec": { + "protocol": "NEC1", + "device": 2, + "subdevice": 160, + "obc": 128, + "misc": "+ 1 ditto" + }, + "confidence": 96, + "trigger": [] + }, + { + "key": "test", + "name": "TEST", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCCBCBBBBBBCBCCCCC21,1672", + "_id": "58c58bc15107a80100adbc57", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 5, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "direct", + "name": "DIRECT", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCBCBCBBBBCBCBCCCC21,1672", + "_id": "58c58bc15107a80100adbc56", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 10, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "optical", + "name": "OPTICAL", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCCCBCBBBBBBCBCCCC21,1672", + "_id": "58c58bc15107a80100adbc55", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 11, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "coax", + "name": "COAX", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCBBCCBBBBCCBBCCCC21,1672", + "_id": "58c58bc15107a80100adbc54", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 12, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "effect", + "name": "Input", + "code": "38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBBBCBBBBCCCBCCCC21,1672,343,86,21,3730", + "_id": "58c58bc15107a80100adbc53", + "icon": "call_merge", + "spec": { + "protocol": "NEC1", + "device": 2, + "subdevice": 160, + "obc": 8, + "misc": "+ 1 ditto" + }, + "confidence": 96, + "trigger": [] + }, + { + "key": "KEY_SETUP", + "name": "SETUP", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCCCCCCBBBBBBBBCCC21,1672", + "_id": "58c58bc15107a80100adbc52", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 31, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "KEY_SUBTITLE", + "name": "SUBTITLE", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCCCBBBBBBBBCCCCCC21,1672", + "_id": "58c58bc15107a80100adbc51", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 3, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "center+", + "name": "CENTER", + "icon": "add", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCBCBBBBBBCBCCCCCC21,1672", + "_id": "58c58bc15107a80100adbc50", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 2, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "center-", + "name": "CENTER", + "icon": "remove", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCBCCBBBBBCBBCCCCC21,1672", + "_id": "58c58bc15107a80100adbc4f", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 6, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "surround+", + "name": "SURROUND", + "icon": "add", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCBBBBBBBBCCCCCCCC21,1672", + "_id": "58c58bc15107a80100adbc4e", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 0, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "surround-", + "name": "SURROUND", + "icon": "remove", + "code": "38000,2,1,343,171,21,22BB21,65BBBBCCCBCCCCBBCBBBBBCCBCCCCC21,1672", + "_id": "58c58bc15107a80100adbc4d", + "spec": { + "protocol": "NEC", + "device": 8, + "subdevice": -1, + "obc": 4, + "misc": "no repeat" + }, + "confidence": 32, + "trigger": [] + }, + { + "key": "KEY_VOLUMEUP", + "name": "VOL", + "icon": "add", + "code": "38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBCBCBCBCCBCBCBCB21,1672,343,86,21,3730", + "_id": "58c58bc15107a80100adbc4c", + "spec": { + "protocol": "NEC1", + "device": 2, + "subdevice": 160, + "obc": 170, + "misc": "+ 1 ditto" + }, + "confidence": 96, + "trigger": [] + }, + { + "key": "KEY_VOLUMEDOWN", + "name": "VOL", + "icon": "remove", + "code": "38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBCBCBCCBCBCBCBBC21,1672,343,86,21,3730", + "_id": "58c58bc15107a80100adbc4b", + "spec": { + "protocol": "NEC1", + "device": 2, + "subdevice": 160, + "obc": 106, + "misc": "+ 1 ditto" + }, + "confidence": 96, + "trigger": [] + }, + { + "key": "KEY_MUTE", + "name": "MUTE", + "icon": "volume_off", + "code": "38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBCBCBCCCCBCBCBBB21,1672,343,86,21,3730", + "_id": "58c58bc15107a80100adbc4a", + "spec": { + "protocol": "NEC1", + "device": 2, + "subdevice": 160, + "obc": 234, + "misc": "+ 1 ditto" + }, + "confidence": 96, + "trigger": [] + } + ], + "type": "5.1 Sound System", + "score": 0, + "confidence": 43, + "created": "2017-03-12T17:55:33.227Z" +} \ No newline at end of file diff --git a/rules/kodi.rules b/rules/kodi.rules index 03857bf..ea971be 100644 --- a/rules/kodi.rules +++ b/rules/kodi.rules @@ -65,4 +65,13 @@ then ] end +rule "Kodi reset PlayPause controls" +when + Item KodiPlayerState changed +then + //logInfo(filename, "Kodi Speaker switch input") + if (KodiPlayerState.state == "Play") zmote_sendcode.sendCommand("38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBBCBBBBBCCBCCCCC21,1672,343,86,21,3730") + else if (KodiPlayerState.state == "Stop") zmote_sendcode.sendCommand("38000,2,69,343,171,21,22,21,65BBBBBBBBBBBCBCBCBBBBBCCBCCCCCB21,1672,343,86,21,3730") +end + // vim: syntax=Xtend diff --git a/rules/soundsystem.rules b/rules/soundsystem.rules new file mode 100644 index 0000000..4922741 --- /dev/null +++ b/rules/soundsystem.rules @@ -0,0 +1,9 @@ + +val String filename = "soundsystem.rules" + +rule "Soundsystem: Aus/Aktiv" +when + Item WZ_SoundSystem_Power received update +then + if (WZ_SoundSystem_Power.state > 10) WZ_SoundSystem_Active.postUpdate(ON) else WZ_SoundSystem_Active.postUpdate(OFF) +end \ No newline at end of file diff --git a/things/zmote.things b/things/zmote.things new file mode 100644 index 0000000..99998dc --- /dev/null +++ b/things/zmote.things @@ -0,0 +1 @@ +Thing zmote:zmt2:CI00070700 [ uuid="CI00070700", configFile="/etc/openhab2/logitech-z906.json" ] \ No newline at end of file