Hier ein Dashboard Flow für eine Hue mit dimmen und Color Picker.
[{"id":"a05549e8.73f168","type":"function","z":"61375733.8d2a08","name":"Einstellung","func":"var dim = msg.payload.bri;\nif (msg.payload.on === false){dim=0}\nnode.send ([null,{payload:dim}])\nif (msg.payload.on === true) {\n var test = {\"text\":\"Erker rechts an\",\"background\":\"yellow\",\"icon\":\"yellow\",\"icon2\":\"fa fa-lightbulb-o \",\"dim\" :dim};\n return test;\n}\nif (msg.payload.on === false) {\n return {\"text\": \"Erker rechts aus \",\"background\":\"wihte\",\"icon\":\"wihte\",\"icon2\":\"fa fa-lightbulb-o\"};\n}\n","outputs":2,"noerr":0,"x":270,"y":2440,"wires":[["1b71ec54.439804"],["6eb2a7ab.9c2ec8"]]},{"id":"b58280e9.6b775","type":"switch","z":"61375733.8d2a08","name":"","property":"hueerkerrechts","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"false","repair":false,"outputs":2,"x":630,"y":2440,"wires":[["d4cabd82.6631c"],["5578e669.0c5e38"]]},{"id":"d4cabd82.6631c","type":"change","z":"61375733.8d2a08","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":2440,"wires":[["92981732.af4638"]]},{"id":"5578e669.0c5e38","type":"change","z":"61375733.8d2a08","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":2480,"wires":[["92981732.af4638"]]},{"id":"5ec01bbf.854114","type":"node-hue-out","z":"61375733.8d2a08","server":"f7407062.f82fc","lightID":"light5","name":"","x":70,"y":2440,"wires":[["a05549e8.73f168","a04666d8.9bd248"]]},{"id":"92981732.af4638","type":"node-hue-in","z":"61375733.8d2a08","server":"f7407062.f82fc","lightID":"light5","name":"","x":990,"y":2460,"wires":[]},{"id":"a04666d8.9bd248","type":"change","z":"61375733.8d2a08","name":"Speicher Licht ","rules":[{"t":"set","p":"hueerkerrechts","pt":"flow","to":"payload.on","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":2520,"wires":[[]]},{"id":"1b71ec54.439804","type":"ui_template","z":"61375733.8d2a08","group":"ef9ca666.a06b18","name":"Erker rechts hue","order":7,"width":"0","height":"0","format":"<md-button \nclass=\"md-raised\" \nstyle=\"background-color:black\" \nng-click=\"send({topic: 'button', payload: 1})\"> \n<div\nstyle=\"display: flex;height: 100%;justify-content: center;align-items: center;\">\n<i \nclass=\"{{msg.icon2}}\" \nstyle=\"color:{{msg.icon}}\"> {{msg.dim}}%\n</i> \n</div>\n <div md-colors=\"{background: black}\">\n <div md-colors=\"{color: '{{msg.icon}}'}\">\n <span>{{msg.text}}</span>\n \n </div>\n</div>\n<p align=\"left\">\n </p> \n </md-button>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":460,"y":2440,"wires":[["b58280e9.6b775"]]},{"id":"6eb2a7ab.9c2ec8","type":"ui_numeric","z":"61375733.8d2a08","name":"","label":"","group":"ef9ca666.a06b18","order":8,"width":"5","height":"1","passthru":false,"topic":"bri","format":"{{value}}","min":0,"max":"100","step":"10","x":440,"y":2480,"wires":[["92981732.af4638"]]},{"id":"d07b3a7f.4d2538","type":"ui_colour_picker","z":"61375733.8d2a08","name":"","label":"","group":"ef9ca666.a06b18","format":"hex","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showHue":false,"showAlpha":false,"showLightness":false,"dynOutput":"true","order":9,"width":"5","height":"4","passthru":true,"topic":"","x":130,"y":2560,"wires":[["2b069b84.1224f4"]]},{"id":"2b069b84.1224f4","type":"function","z":"61375733.8d2a08","name":"switch","func":"var payload = {\n \"hex\": msg.payload\n};\n\nmsg.payload = payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":491.7741165161133,"y":2559.5806760787964,"wires":[["92981732.af4638","9ad95543.12eba8","66150b51.6074e4"]]},{"id":"f7407062.f82fc","type":"node-hue-bridge","z":"61375733.8d2a08","name":"Hue Bridge","address":"","key":"","interval":"10000"},{"id":"ef9ca666.a06b18","type":"ui_group","z":"","name":"Wohnen","tab":"aca7e2c3.dd76","order":1,"disp":true,"width":"6","collapse":true},{"id":"aca7e2c3.dd76","type":"ui_tab","z":"","name":"Beleuchtung","icon":"dashboard","order":2}]
Hier ein Flow für die Schaltung von Geräten in homee.
[{"id":"4688a11b.79564","type":"function","z":"4c493bb3.fded14","name":"Rückkanal vom homee","func":"var attribute = msg.payload.attribute;\nconst attributes = global.get('homee.attributes');\nvar test = attributes.filter(attribute => attribute.id === 1472).map(a => a.current_value).reduce((a,c) => a+c);\n\n\nif (attribute && attribute.id === 1472 && attribute.current_value ===1 && attribute.last_value === 0 && attribute.current_value === attribute.target_value) {\n var msg = {\"text\":\"Küche Insel an\",\"background\":\"yellow\",\"icon\":\"yellow\",\"icon2\":\"fa fa-lightbulb-o \"};\n return msg;\n}\nif (attribute && attribute.id === 1472 && attribute.current_value === 0 && attribute.last_value === 1 && attribute.current_value === attribute.target_value) {\n return {\"text\": \"Küche Insel aus\",\"background\":\"wihte\",\"icon\":\"wihte\",\"icon2\":\"fa fa-lightbulb-o\"};\n}\nif (attribute && attribute.id === 1472 && attribute.current_value === 0 && attribute.last_value === 1 && attribute.target_value === 1 ) {\n return {\"text\": \"Küche Insel aus\",\"background\":\"red\",\"icon\":\"red\",\"icon2\":\"fa fa-cog fa-spin fa-1x fa-fw\"};\n}\nif (attribute && attribute.id === 1472 && attribute.current_value === 1 && attribute.last_value === 0 && attribute.target_value === 0 ) {\n return {\"text\": \"Küche Insel aus\",\"background\":\"red\",\"icon\":\"red\",\"icon2\":\"fa fa-cog fa-spin fa-1x fa-fw\"};\n}\n//if (attribute && attribute.id === 1472 && attribute.current_value === 0 && attribute.last_value === 0 && attribute.target_value === 0 ) {\n// return {\"text\": \"KücheInsel \",\"background\":\"blue\",\"icon\":\"blue\",\"icon2\":\"fa fa-exclamation-triangle blink\"};\n//}","outputs":1,"noerr":0,"x":280,"y":400,"wires":[["43a3c3db.c3590c"]]},{"id":"e8a84b84.25c268","type":"function","z":"4c493bb3.fded14","name":"Zustand an homee","func":"const attributes = global.get('homee.attributes');\nvar test = attributes.filter(attribute => attribute.id === 1472).map(a => a.current_value).reduce((a,c) => a+c);\nif (msg.payload === 1 && test === 1){\nreturn {payload: String `PUT:/nodes/375/attributes/1472?target_value=0`};}\nif (msg.payload === 1 && test === 0){\nreturn {payload: String `PUT:/nodes/375/attributes/1472?target_value=1`};}\n\n","outputs":1,"noerr":0,"x":690,"y":400,"wires":[["aa92dc03.8770b"]]},{"id":"43a3c3db.c3590c","type":"ui_template","z":"4c493bb3.fded14","group":"ce08c5c5.cada48","name":"Küchenlicht Insel","order":1,"width":"0","height":"0","format":"\n<md-button \nclass=\"md-raised\" \nstyle=\"background: none\" \nng-click=\"send({topic: 'button', payload: 1})\"> \n<div\nstyle=\"display: flex;height: 100%;justify-content: center;align-items: center;\">\n<i \nclass=\"{{msg.icon2}}\" \nstyle=\"color:{{msg.icon}}\">\n</i> \n</div>\n <div md-colors=\"{background: black}\">\n <div md-colors=\"{color: '{{msg.icon}}'}\">\n <span>{{msg.text}}</span>\n </div>\n</div>\n<p align=\"left\">\n </p> \n </md-button>\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":490,"y":400,"wires":[["e8a84b84.25c268"]]},{"id":"aa92dc03.8770b","type":"homee","z":"4c493bb3.fded14","name":"","host":"","x":470,"y":320,"wires":[["4688a11b.79564"]]},{"id":"ce08c5c5.cada48","type":"ui_group","z":"","name":"Küche","tab":"aca7e2c3.dd76","order":2,"disp":true,"width":"6","collapse":true},{"id":"aca7e2c3.dd76","type":"ui_tab","z":"","name":"Beleuchtung","icon":"dashboard","order":2}]
Ich habe hier das Template Node benutzt da ich hier die Icon sowie Fraben selber auswählen kann.
In diesem Fall drückst du einfach die Lampe und schon gehts los.
Habe hier noch eine Rückmeldung von homee eingebaut, sollte nach dem schalten die Lampe nicht angehen dann gibt es eine Rote Meldung mit einem drehenden Icon.
Viel Spaß
Micha