[{"id":"c47617b3.4c8918","type":"function","z":"d409c26d.a2129","name":"Rückkanal vom homee","func":"var attribute = msg.payload.attribute;\nconst attributes = global.get('homee.attributes');\nvar test = attributes.filter(attribute => attribute.id === 129);\n\nif (attribute && attribute.id === 129 && attribute.current_value ===1 && attribute.last_value === 0 && attribute.current_value === attribute.target_value) {\n var msg = {\"text\":\"Schlafzimmer ein\",\"background\":\"yellow\",\"icon\":\"yellow\",\"icon2\":\"fa fa-lightbulb-o fa-2x\"};\n return msg;\n}\nif (attribute && attribute.id === 129 && attribute.current_value === 0 && attribute.last_value === 1 && attribute.current_value === attribute.target_value) {\n return {\"text\": \"Schlafzimmer aus\",\"background\":\"white\",\"icon\":\"white\",\"icon2\":\"fa fa-lightbulb-o fa-2x\"};\n}\nif (attribute && attribute.id === 129 && attribute.current_value === 0 && attribute.last_value === 1 && attribute.target_value === 1 ) {\n return {\"text\": \"Schlafzimmer aus\",\"background\":\"red\",\"icon\":\"red\",\"icon2\":\"fa fa-cog fa-spin fa-2x fa-fw\"};\n}\nif (attribute && attribute.id === 129 && attribute.current_value === 1 && attribute.last_value === 0 && attribute.target_value === 0 ) {\n return {\"text\": \"Schlafzimmer aus\",\"background\":\"red\",\"icon\":\"red\",\"icon2\":\"fa fa-cog fa-spin fa-2x fa-fw\"};\n}","outputs":1,"noerr":0,"x":440,"y":340,"wires":[["7d5e872d.c25158"]]},{"id":"7d5e872d.c25158","type":"ui_template","z":"d409c26d.a2129","group":"d1e1646f.898738","name":"Licht Schlafzimmer","order":3,"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":650,"y":340,"wires":[["4cb7fec9.a3009"]]},{"id":"559eb1da.175ce","type":"homee","z":"d409c26d.a2129","name":"","host":"192.168.178.30","x":830,"y":300,"wires":[["c47617b3.4c8918"]]},{"id":"4cb7fec9.a3009","type":"function","z":"d409c26d.a2129","name":"Zustand an homee","func":"const attributes = global.get('homee.attributes');\nvar test = attributes.filter(attribute => attribute.id === 129).map(a => a.current_value).reduce((a,c) => a+c);\n\nif (msg.payload === 1 && test === 1){\n return {payload: \"PUT:/nodes/15/attributes/129?target_value=0\"};\n}\nif (msg.payload === 1 && test === 0){\n return {payload: \"PUT:/nodes/15/attributes/129?target_value=1\"};\n}\n","outputs":1,"noerr":0,"x":1030,"y":340,"wires":[["559eb1da.175ce"]]},{"id":"3d92f84a.39e4b8","type":"inject","z":"d409c26d.a2129","name":"","topic":"","payload":"get:nodes/15/","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":380,"wires":[["bcb5019b.63ca"]]},{"id":"bcb5019b.63ca","type":"homee","z":"d409c26d.a2129","name":"","host":"192.168.178.30","x":550,"y":380,"wires":[["d70486ac.6f7af8"]]},{"id":"d70486ac.6f7af8","type":"function","z":"d409c26d.a2129","name":"Rückkanal vom homee","func":"var attribute = msg.payload.attribute;\nconst attributes = global.get('homee.attributes');\nvar test = attributes.filter(attribute => attribute.id === 136).map(a => a.current_value).reduce((a,c) => a+c);\n\nmsg.payload = test;\nreturn msg","outputs":1,"noerr":0,"x":720,"y":380,"wires":[["7628f9fd.e8f6e8"]]},{"id":"7628f9fd.e8f6e8","type":"ui_text","z":"d409c26d.a2129","group":"d1e1646f.898738","order":4,"width":0,"height":0,"name":"","label":"Leistung:","format":"{{msg.payload}}","layout":"row-center","x":1060,"y":380,"wires":[]},{"id":"d1e1646f.898738","type":"ui_group","z":"","name":"Licht Schlafzimmer","tab":"e44102e4.a7807","order":2,"disp":true,"width":"6","collapse":false},{"id":"e44102e4.a7807","type":"ui_tab","z":"","name":"Beleuchtung","icon":"fa-lightbulb-o","order":1,"disabled":false,"hidden":false}]