Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 2.74 KB | None | 0 0
  1. [{"id":"3c885bf9.36dcf4","type":"ha-get-entities","z":"4a9c5e2e.b0823","server":"67344dd9.0c79e4","name":"","rules":[{"property":"attributes.Battery numeric","logic":"gte","value":"0","valueType":"num"},{"property":"attributes.Battery numeric","logic":"lt","value":"8","valueType":"num"},{"property":"entity_id","logic":"starts_with","value":"sensor.","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"bat1","output_results_count":1,"x":170,"y":540,"wires":[["21711907.c65626"]]},{"id":"21711907.c65626","type":"ha-get-entities","z":"4a9c5e2e.b0823","server":"67344dd9.0c79e4","name":"","rules":[{"property":"attributes.battery_level","logic":"gte","value":"0","valueType":"num"},{"property":"attributes.battery_level","logic":"lt","value":"50","valueType":"num"},{"property":"entity_id","logic":"starts_with","value":"sensor","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"bat2","output_results_count":1,"x":370,"y":520,"wires":[["5a14d4fd.8ae4dc"]]},{"id":"5a14d4fd.8ae4dc","type":"ha-get-entities","z":"4a9c5e2e.b0823","server":"67344dd9.0c79e4","name":"","rules":[{"property":"attributes.battery_level","logic":"gte","value":"0","valueType":"num"},{"property":"attributes.battery_level","logic":"lt","value":"50","valueType":"num"},{"property":"entity_id","logic":"starts_with","value":"binary_sensor","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"bat3","output_results_count":1,"x":570,"y":500,"wires":[["8acf8448.d19358"]]},{"id":"8acf8448.d19358","type":"function","z":"4a9c5e2e.b0823","name":"Get all low battery sensors","func":"var lowBatteryDevices = [];\n\n//if (msg.batt1 !== undefined) {\n    msg.bat1.forEach(function(element) {\n        lowBatteryDevices.push(element.device_id)\n    });\n   \n//} \n//if (msg.batt2 !== undefined) {\n    msg.bat2.forEach(function(element) {\n        lowBatteryDevices.push(element.device_id)\n    });\n   \n//} \n//if (msg.batt3 !== undefined) {\n    msg.bat3.forEach(function(element) {\n        node.error(element.entity_id);\n        lowBatteryDevices.push(element.entity_id)\n    });\n   \n//} \nmsg.payload = lowBatteryDevices;\n\nreturn msg;","outputs":1,"noerr":0,"x":660,"y":660,"wires":[["46d560e4.1435"]]},{"id":"46d560e4.1435","type":"ha-api","z":"4a9c5e2e.b0823","name":"Create group","server":"67344dd9.0c79e4","protocol":"http","method":"post","path":"/api/states/group.low_battery_devices","data":"{\"state\":\"on\", \"attributes\":{\"entity_id\":[\"{{payload}}\"]}}","location":"payload","locationType":"msg","responseType":"json","x":860,"y":600,"wires":[[]]},{"id":"67344dd9.0c79e4","type":"server","z":"","name":"Home Assistant"}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement