forked from homeean/node-red-contrib-homee-flows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Garagentor (Aeotec Garage Door Controller) mit allen Stati an normalem Switch + zwei Türsensoren (Endpositionen).json
1 lines (1 loc) · 5.8 KB
/
Garagentor (Aeotec Garage Door Controller) mit allen Stati an normalem Switch + zwei Türsensoren (Endpositionen).json
1
[{"id":"27978165.1886ae","type":"homeeDevice","z":"fd6d95c1.d70ae8","virtual-homee":"236538fb.027108","name":"Garagentor","nodeId":"700","profile":"2006","icon":"default","attributes":"[{\"id\":700,\"node_id\":700,\"instance\":0,\"minimum\":0,\"maximum\":4,\"current_value\":4,\"target_value\":1,\"last_value\":1,\"unit\":\"\",\"step_value\":1,\"editable\":1,\"type\":135,\"state\":1,\"last_changed\":1572990106,\"changed_by\":3,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":701,\"node_id\":700,\"instance\":0,\"minimum\":0,\"maximum\":3,\"current_value\":3,\"target_value\":3,\"last_value\":2,\"unit\":\"\",\"step_value\":1,\"editable\":1,\"type\":144,\"state\":1,\"last_changed\":1570808109,\"changed_by\":1,\"changed_by_id\":0,\"based_on\":1,\"data\":\"\"},{\"id\":702,\"node_id\":700,\"instance\":0,\"minimum\":0,\"maximum\":1,\"current_value\":0,\"target_value\":0,\"last_value\":0,\"unit\":\"\",\"step_value\":1,\"editable\":1,\"type\":75,\"state\":4,\"last_changed\":1558711883,\"changed_by\":2,\"changed_by_id\":1,\"based_on\":1,\"data\":\"\"}]","x":890,"y":3640,"wires":[["37bfda7d.a7c506","5ce8fce.176d804","f9849e34.39b3e"]]},{"id":"caa804c1.8921d8","type":"inject","z":"fd6d95c1.d70ae8","name":"Geschlossen","topic":"","payload":"{ \"id\": 700, \"value\": 1 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":3440,"wires":[["27978165.1886ae"]]},{"id":"8d8fa594.1c91e8","type":"inject","z":"fd6d95c1.d70ae8","name":"Gestoppt","topic":"","payload":"{ \"id\": 700, \"value\": 2 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":3480,"wires":[["27978165.1886ae"]]},{"id":"18a14ff2.894c","type":"inject","z":"fd6d95c1.d70ae8","name":"Öffnet","topic":"","payload":"{ \"id\": 700, \"value\": 3 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":3520,"wires":[["27978165.1886ae"]]},{"id":"bf123f35.69032","type":"inject","z":"fd6d95c1.d70ae8","name":"Schließt","topic":"","payload":"{ \"id\": 700, \"value\": 4 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":3560,"wires":[["27978165.1886ae"]]},{"id":"8cc73d5f.d5bc6","type":"inject","z":"fd6d95c1.d70ae8","name":"Offen","topic":"","payload":"{ \"id\": 700, \"value\": 0 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":3600,"wires":[["27978165.1886ae"]]},{"id":"f542abc5.df6f78","type":"function","z":"fd6d95c1.d70ae8","name":"Status Gestoppt","func":"const attributes = global.get('homee.attributes');\nvar contact1 = attributes.filter(attribute => attribute.id === 1156).map(a => a.current_value).reduce((a,c) => a+c);\nvar contact2 = attributes.filter(attribute => attribute.id === 1272).map(a => a.current_value).reduce((a,c) => a+c);\nif (contact1 === 1 && contact2 === 1){\n return {payload: { \"id\": 700, \"value\": 2 }};\n}\n","outputs":1,"noerr":0,"x":620,"y":3700,"wires":[["27978165.1886ae"]]},{"id":"a53ef183.91dd6","type":"delay","z":"fd6d95c1.d70ae8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":3700,"wires":[["f542abc5.df6f78"]]},{"id":"f9849e34.39b3e","type":"function","z":"fd6d95c1.d70ae8","name":"an-aus","func":"var nodeid = 218; // node ID in homee vom Gerät\nvar attributid = 1082; // attribut ID in homee vom Gerät\nconst attributes = global.get('homee.attributes');\nif (msg.payload.targetValue === 0) //öffnen\n{return {payload: \"PUT:/nodes/\"+nodeid+\"/attributes/\"+attributid+\"?target_value=1\"}}\nif (msg.payload.targetValue === 2) //stoppen\n{return {payload: \"PUT:/nodes/\"+nodeid+\"/attributes/\"+attributid+\"?target_value=1\"}}\nif (msg.payload.targetValue === 1) //schließen\n{return {payload: \"PUT:/nodes/\"+nodeid+\"/attributes/\"+attributid+\"?target_value=1\"}}","outputs":1,"noerr":0,"x":1070,"y":3640,"wires":[["297ab627.f8580a"]]},{"id":"6a057a4.295d184","type":"function","z":"fd6d95c1.d70ae8","name":"Status an Garagentor","func":"var attribute = msg.payload.attribute;\nvar contact1 = 1156; //Garage zu (Kontakt geschlossen = 0)\nvar contact2 = 1272; // Garage auf (Kontakt geschlossen = 0)\nif (attribute && attribute.id === contact1 && attribute.current_value === 0 ) {return [{payload: { \"id\": 700, \"value\": 1 }}];}\nif (attribute && attribute.id === contact1 && attribute.current_value === 1 ) {return [{payload: { \"id\": 700, \"value\": 3 }}];}\nif (attribute && attribute.id === contact2 && attribute.current_value === 0 ) {return [{payload: { \"id\": 700, \"value\": 0 }}];}\nif (attribute && attribute.id === contact2 && attribute.current_value === 1 ) {return [{payload: { \"id\": 700, \"value\": 4 }}];}\n","outputs":3,"noerr":0,"x":240,"y":3660,"wires":[["27978165.1886ae","a53ef183.91dd6"],[],[]],"outputLabels":["Taster 1 oben gedrückt","Taster 1 unten gedrückt","Taster 1 los gelassen"]},{"id":"fdd71e7a.0f9b9","type":"link in","z":"fd6d95c1.d70ae8","name":"","links":["bbddce99.fc4118","3ae89102.5a2a0e"],"x":95,"y":3660,"wires":[["6a057a4.295d184"]]},{"id":"37bfda7d.a7c506","type":"function","z":"fd6d95c1.d70ae8","name":"Status öffnet","func":"var state = msg.payload.targetValue\nif (state === 0){\n return {payload: { \"id\": 700, \"value\": 3 }};\n}","outputs":1,"noerr":0,"x":890,"y":3560,"wires":[["27978165.1886ae"]]},{"id":"5ce8fce.176d804","type":"function","z":"fd6d95c1.d70ae8","name":"Status schließt","func":"var state = msg.payload.targetValue\nif (state === 1){\n return {payload: { \"id\": 700, \"value\": 4 }};\n}","outputs":1,"noerr":0,"x":900,"y":3720,"wires":[["27978165.1886ae"]]},{"id":"297ab627.f8580a","type":"link out","z":"fd6d95c1.d70ae8","name":"","links":["1f6d5452.168fbc","939c6c61.0cf84"],"x":1175,"y":3640,"wires":[]},{"id":"236538fb.027108","type":"virtualHomee","z":"","name":"12345QWERT"}]