Hallo homee-Fans,
vorab schon jetzt vielen Dank für Eure Verbesserungsvorschläge.
Die Idee:
Ein Hue-Dimmschalter mit 8 Tasten, welche im homee als Auslöser für Homeegramme verwendet werden könne. Vier Tasten sollen sich so verhalten wie bei dem normalen Hue-Dimmschalter und vier weitere wenn die jeweilige Taste lange gedrückt wird.
Die Ausgangssituation:
Im homee unterstützt der Hue-Dimmschalter standardmäßig ja leider nur die Information ob eine Taste gedrückt oder losgelassen wurde. In Node-Red liefert node-red-contrib-huemagic zusätzlich a.A. auch die Information ob eine Taste lange gedrückt wurde.
Das Vorhaben:
Erstellung eines Flows der einen echten Hue-Dimmschalter, angebunden über eine Hue-Bridge und in Node-Red mit Huemagic eingebunden, mittels node-red-contrib-homee als virtueller 8-Tasten Schalter per homee-in-homee in den homee einbindet.
Das Ergebnis:
Taste 1. 2. 3 und 4 sind die ganz normalen Tasten. Taste 11, 12, 13 und 14 sind die selben Tasten, wenn lange gedrückt.
Als Basis für meinen Flow habe ich das Beispiel wallmote_iobroker_hue_dimmschalter von Micha2536 verwendet (ist das der @Micha ? falls ja, vielen Dank!).
Hier mein Flow:
[
{
"id": "cb51b872.be9528",
"type": "homeeDevice",
"z": "fbae2920.e11b18",
"virtual-homee": "",
"name": "Schalter Küche",
"nodeId": "38",
"showNodeId": true,
"profile": "26",
"icon": "",
"attributes": "[{\"id\":481,\"node_id\":38,\"instance\":1,\"minimum\":1,\"maximum\":2,\"current_value\":2,\"target_value\":2,\"last_value\":1,\"unit\":\"n%2Fa\",\"step_value\":1,\"editable\":0,\"type\":40,\"state\":1,\"last_changed\":1573065520,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":482,\"node_id\":38,\"instance\":2,\"minimum\":1,\"maximum\":2,\"current_value\":2,\"target_value\":2,\"last_value\":1,\"unit\":\"n%2Fa\",\"step_value\":1,\"editable\":0,\"type\":40,\"state\":1,\"last_changed\":1573065520,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":483,\"node_id\":38,\"instance\":3,\"minimum\":1,\"maximum\":2,\"current_value\":2,\"target_value\":2,\"last_value\":1,\"unit\":\"n%2Fa\",\"step_value\":1,\"editable\":0,\"type\":40,\"state\":1,\"last_changed\":1573065520,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":484,\"node_id\":38,\"instance\":4,\"minimum\":1,\"maximum\":2,\"current_value\":2,\"target_value\":2,\"last_value\":1,\"unit\":\"n%2Fa\",\"step_value\":1,\"editable\":0,\"type\":40,\"state\":1,\"last_changed\":1573065520,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":485,\"node_id\":38,\"instance\":11,\"minimum\":1,\"maximum\":2,\"current_value\":2,\"target_value\":2,\"last_value\":1,\"unit\":\"n%2Fa\",\"step_value\":1,\"editable\":0,\"type\":40,\"state\":1,\"last_changed\":1573065520,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":486,\"node_id\":38,\"instance\":12,\"minimum\":1,\"maximum\":2,\"current_value\":2,\"target_value\":2,\"last_value\":1,\"unit\":\"n%2Fa\",\"step_value\":1,\"editable\":0,\"type\":40,\"state\":1,\"last_changed\":1573065520,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":487,\"node_id\":38,\"instance\":13,\"minimum\":1,\"maximum\":2,\"current_value\":2,\"target_value\":2,\"last_value\":1,\"unit\":\"n%2Fa\",\"step_value\":1,\"editable\":0,\"type\":40,\"state\":1,\"last_changed\":1573065520,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":488,\"node_id\":38,\"instance\":14,\"minimum\":1,\"maximum\":2,\"current_value\":2,\"target_value\":2,\"last_value\":1,\"unit\":\"n%2Fa\",\"step_value\":1,\"editable\":0,\"type\":40,\"state\":1,\"last_changed\":1573065520,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":489,\"node_id\":38,\"instance\":0,\"minimum\":0,\"maximum\":100,\"current_value\":100,\"target_value\":100,\"last_value\":100,\"unit\":\"%25\",\"step_value\":1,\"editable\":0,\"type\":8,\"state\":1,\"last_changed\":1573065517,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":490,\"node_id\":38,\"instance\":0,\"minimum\":0,\"maximum\":0,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"text\",\"step_value\":1,\"editable\":0,\"type\":43,\"state\":1,\"last_changed\":1573711842,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"Taste gedrückt -> kurz: 1-4; lang: 11-14\"},{\"id\":491,\"node_id\":38,\"instance\":0,\"minimum\":0,\"maximum\":0,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"text\",\"step_value\":1,\"editable\":0,\"type\":44,\"state\":1,\"last_changed\":1573711842,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":492,\"node_id\":38,\"instance\":0,\"minimum\":0,\"maximum\":0,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"text\",\"step_value\":1,\"editable\":0,\"type\":45,\"state\":1,\"last_changed\":1573065500,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"}]",
"x": 1031,
"y": 4159,
"wires": [
[]
]
},
{
"id": "49d82f67.abbca",
"type": "template",
"z": "fbae2920.e11b18",
"name": "Button state 1",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":481,\"value\":{{payload}}}}",
"output": "json",
"x": 744.125,
"y": 4102,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "28d8caf4.23b18e",
"type": "template",
"z": "fbae2920.e11b18",
"name": "Button state 2",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":482,\"value\":{{payload}}}}",
"output": "json",
"x": 744.125,
"y": 4134,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "ab66260d.cfcca8",
"type": "template",
"z": "fbae2920.e11b18",
"name": "Button state 3",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":483,\"value\":{{payload}}}}",
"output": "json",
"x": 744.125,
"y": 4166,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "bf7669c.7688718",
"type": "template",
"z": "fbae2920.e11b18",
"name": "Button state 4",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":484,\"value\":{{payload}}}}",
"output": "json",
"x": 744.125,
"y": 4198,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "7aadd9d6.d0f5b8",
"type": "template",
"z": "fbae2920.e11b18",
"name": "Battery level",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":489,\"value\":{{payload}}}}",
"output": "json",
"x": 755.125,
"y": 4013,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "ad7bcd87.8f9198",
"type": "switch",
"z": "fbae2920.e11b18",
"name": "Input",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1002 ",
"vt": "num"
},
{
"t": "eq",
"v": "2002",
"vt": "num"
},
{
"t": "eq",
"v": "3002",
"vt": "num"
},
{
"t": "eq",
"v": "4002",
"vt": "num"
},
{
"t": "eq",
"v": "1001",
"vt": "num"
},
{
"t": "eq",
"v": "2001",
"vt": "num"
},
{
"t": "eq",
"v": "3001",
"vt": "num"
},
{
"t": "eq",
"v": "4001",
"vt": "num"
},
{
"t": "eq",
"v": "1003",
"vt": "num"
},
{
"t": "eq",
"v": "2003",
"vt": "num"
},
{
"t": "eq",
"v": "3003",
"vt": "num"
},
{
"t": "eq",
"v": "4003",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 12,
"x": 163.65985107421875,
"y": 4285.685546875,
"wires": [
[
"d1be07c4.081eb",
"e7e61c1.d050d6"
],
[
"9e1bc716.7a5278",
"e7e61c1.d050d6"
],
[
"afb9222d.b56418",
"e7e61c1.d050d6"
],
[
"a5522494.96cc3",
"e7e61c1.d050d6"
],
[
"c46c942b.ca3f08"
],
[
"8e4a9290.49555"
],
[
"78fe378e.7c9e68"
],
[
"6fa80c6a.fc6074"
],
[
"6852c7cb.a356c"
],
[
"f2da57b7.2eb0f8"
],
[
"6c8b2fe7.2b2a68"
],
[
"51ead2a2.96a1ac"
]
],
"info": "Just expand the flow.count to how ever many\npresses you want/need."
},
{
"id": "d1be07c4.081eb",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 1 (1002 short released)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 453.4376220703125,
"y": 4017.35205078125,
"wires": [
[
"49d82f67.abbca"
]
]
},
{
"id": "e5c53e4d.84065",
"type": "function",
"z": "fbae2920.e11b18",
"name": "return button",
"func": "\nreturn {payload: msg.payload.button };",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 158.31256103515625,
"y": 4043.11083984375,
"wires": [
[
"ad7bcd87.8f9198"
]
]
},
{
"id": "2d42557e.b910e2",
"type": "hue-switch",
"z": "fbae2920.e11b18",
"name": "Schalter Küche",
"bridge": "11bfbfbc.82419",
"sensorid": "39",
"x": 168.00006103515625,
"y": 3965.314453125,
"wires": [
[
"e5c53e4d.84065",
"c86db76.a3f9048",
"1d1613b9.e24b8c",
"39f7f50e.285362"
]
]
},
{
"id": "9e1bc716.7a5278",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 1 (2002 short released)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 453.4583740234375,
"y": 4050.444121360779,
"wires": [
[
"28d8caf4.23b18e"
]
]
},
{
"id": "afb9222d.b56418",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 1 (3002 short released)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 454.4583511352539,
"y": 4082.9995889663696,
"wires": [
[
"ab66260d.cfcca8"
]
]
},
{
"id": "a5522494.96cc3",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 1 (4002 short released)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 454.4584426879883,
"y": 4114.6658635139465,
"wires": [
[
"bf7669c.7688718"
]
]
},
{
"id": "c86db76.a3f9048",
"type": "function",
"z": "fbae2920.e11b18",
"name": "return battery level",
"func": "\nreturn {payload: msg.info.battery };",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 734.9028930664062,
"y": 3961.4443359375,
"wires": [
[
"7aadd9d6.d0f5b8"
]
]
},
{
"id": "c46c942b.ca3f08",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 1 (1001 holded)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 424.00011444091797,
"y": 4147.0001521110535,
"wires": [
[
"7db6940c.fef06c"
]
]
},
{
"id": "8e4a9290.49555",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 1 (2001 holded)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 424.02086639404297,
"y": 4179.092222690582,
"wires": [
[
"f75cab0d.ede828"
]
]
},
{
"id": "78fe378e.7c9e68",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 1 (3001 holded)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 424.0208435058594,
"y": 4210.647690296173,
"wires": [
[
"76792acf.7cfe9c"
]
]
},
{
"id": "6fa80c6a.fc6074",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 1 (4001 holded)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 424.02093505859375,
"y": 4242.31396484375,
"wires": [
[
"ffabc6d0.706e8"
]
]
},
{
"id": "7db6940c.fef06c",
"type": "template",
"z": "fbae2920.e11b18",
"name": "Button state 11",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":485,\"value\":{{payload}}}}",
"output": "json",
"x": 744,
"y": 4230,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "f75cab0d.ede828",
"type": "template",
"z": "fbae2920.e11b18",
"name": "Button state 12",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":486,\"value\":{{payload}}}}",
"output": "json",
"x": 744,
"y": 4262,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "76792acf.7cfe9c",
"type": "template",
"z": "fbae2920.e11b18",
"name": "Button state 13",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":487,\"value\":{{payload}}}}",
"output": "json",
"x": 744,
"y": 4294,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "ffabc6d0.706e8",
"type": "template",
"z": "fbae2920.e11b18",
"name": "Button state 14",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"attribute\":{\"id\":488,\"value\":{{payload}}}}",
"output": "json",
"x": 744,
"y": 4326,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "1d1613b9.e24b8c",
"type": "function",
"z": "fbae2920.e11b18",
"name": "return type as firmware",
"func": "var firmware = msg.info.type;\n\nreturn {\n payload: {\"attribute\": {\"id\": 491, \"value\": 0, \"data\": firmware}}\n}\n\n\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 725.0000610351562,
"y": 3928,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "39f7f50e.285362",
"type": "function",
"z": "fbae2920.e11b18",
"name": "return sw-version",
"func": "var software = msg.info.softwareVersion;\n\nreturn {\n payload: {\"attribute\": {\"id\": 492, \"value\": 0, \"data\": software}}\n}\n\n\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 735,
"y": 3895,
"wires": [
[
"cb51b872.be9528"
]
]
},
{
"id": "59fc53ae.8258a4",
"type": "delay",
"z": "fbae2920.e11b18",
"name": "",
"pauseType": "delay",
"timeout": "40",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 552,
"y": 3985,
"wires": [
[
"49d82f67.abbca",
"28d8caf4.23b18e",
"ab66260d.cfcca8",
"bf7669c.7688718"
]
]
},
{
"id": "6852c7cb.a356c",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 2 (1001 long released)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "2",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 442.9999809265137,
"y": 4274.000019073486,
"wires": [
[
"7db6940c.fef06c"
]
]
},
{
"id": "f2da57b7.2eb0f8",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 2 (2001 long released)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "2",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 443.0207328796387,
"y": 4306.092089653015,
"wires": [
[
"f75cab0d.ede828"
]
]
},
{
"id": "6c8b2fe7.2b2a68",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 2 (3001 long released)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "2",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 443.0207099914551,
"y": 4337.647557258606,
"wires": [
[
"76792acf.7cfe9c"
]
]
},
{
"id": "51ead2a2.96a1ac",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 2 (4001 long released)",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "2",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 443.02080154418945,
"y": 4369.313831806183,
"wires": [
[
"ffabc6d0.706e8"
]
]
},
{
"id": "e7e61c1.d050d6",
"type": "change",
"z": "fbae2920.e11b18",
"name": "Send: 2 reset",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "2",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 394,
"y": 3985,
"wires": [
[
"59fc53ae.8258a4"
]
]
},
{
"id": "11bfbfbc.82419",
"type": "hue-bridge",
"z": "",
"name": "Philips hue",
"bridge": "192.168.178.5",
"key": "geheim",
"interval": "3000"
}
]
Grundsätzlich funktioniert der Flow soweit ganz gut. Ich kann über einfachen Tastendruck und über langen Tastendruck meine Homeegramme individuell ansprechen.
Ein paar kleinigkeiten gefallen mir allerdings nicht ganz so sehr.
Der Flow recht groß geraten (ja, ich bin kein Entwickler) und ich hätte für den Reset der ersten vier Tasten lieber eine andere Lösung. Wird eine Taste lange gedrückt, gibt es beim Loslassen durch Huemagic die Information, dass eine lange gedrückte Taste jetzt losgelassen wurde. Dies bietet die Möglichkeit den Wert der gedrückten Taste von 1 auf 2 zurück zu setzen und genau so habe ich es auch umgesetzt. Für einfaches Drücken liefert Huemagic leider nur die Information, dass eine kurz gedrückte Taste wieder losgelassen worden ist. Ja, ich weiß, es gibt auch einen Wert für „Taste gedrückt“, aber in der Praxis kann ich die Taste 30x drücken und nur ein bis zwei Mal wird dieser Wert übermittelt und deshalb eignet er sich nicht als zuverlässiger Auslöser.
Falls einer von Euch hier Verbesserungsvorschläge und Ideen hat, immer gerne her damit.