Hi All,
I made a node red flow to systematically check ally my devices each day at specific intervals. It seems to be working fine, but i’m having trouble with the output. I was using iphone notifications, but there is a limit to how much data you can output in those. Is there a reporting dashboard, or report feature in Home Assistant where i can populate the names of entities that are offline? I was thinking about doing it via email, but i was hoping there was something more intuitive which that i can use write in home assistant.
Here’s my code:
[{"id":"841b9631392ea7aa","type":"tab","label":"Entity Loops extra","disabled":false,"info":""},{"id":"c12b0b71b35dad0c","type":"inject","z":"841b9631392ea7aa","name":"8am Run","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 08 * * *","once":false,"onceDelay":0.1,"topic":"8am","payload":"x","payloadType":"str","x":110,"y":120,"wires":[["c36782a00bd55b83"]]},{"id":"dac5738479251dde","type":"debug","z":"841b9631392ea7aa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":340,"wires":[]},{"id":"c36782a00bd55b83","type":"function","z":"841b9631392ea7aa","name":"","func":"var finalList = [];\nvar msgList = [];\n\nvar entList = [\n //Front Office\n 'binary_sensor.doorsens_frontoffice',\n 'sensor.temp_front_office',\n 'sensor.humidity_front_office',\n 'binary_sensor.pir1_ias_zone',\n \n\t\n ];\n\n\n//finds all unavailable entities\n\nfor (var i = 0; i<entList.length;i++){\n var states = global.get('homeassistant.homeAssistant.states');\n var entState = states[entList[i]].state;\n \n //for testing only\n //if (entState === \"on\") {\n \n if (entState === \"unavailable\") {\n msgList.push(states[entList[i]].attributes.friendly_name);\n } \n else {\n }\n }\n\n// If unavail ents found, put in format for notification.\nif (msgList.length >0) {\n for ( i = 0; i<msgList.length;i++){\n if (i === 0) {\n finalList= \"\\\\n\" + msgList[i];\n } \n else {\n finalList= finalList +'\\\\n' + msgList[i];\n }\n }\n\n msg.payload = finalList; \n }\nelse {\n msg.payload = 'All Good';\n }\n\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":260,"wires":[["782d9fbe594b974c"]]},{"id":"07f083210d641be8","type":"api-call-service","z":"841b9631392ea7aa","name":"Notify HA App","server":"402a621.201329c","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_iphone","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"The below devices are offline:<br>{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":620,"y":220,"wires":[["dac5738479251dde"]]},{"id":"9106391d8fee6bb4","type":"inject","z":"841b9631392ea7aa","name":"12pm Run","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 12 * * *","once":false,"onceDelay":0.1,"topic":"12pm","payload":"x","payloadType":"str","x":110,"y":180,"wires":[["c36782a00bd55b83"]]},{"id":"7ee4d84bd6981da3","type":"inject","z":"841b9631392ea7aa","name":"4pm Run","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 16 * * *","once":false,"onceDelay":0.1,"topic":"4pm","payload":"x","payloadType":"str","x":110,"y":240,"wires":[["c36782a00bd55b83"]]},{"id":"42c33f17a440477d","type":"inject","z":"841b9631392ea7aa","name":"8pm Run","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 20 * * *","once":false,"onceDelay":0.1,"topic":"8pm","payload":"x","payloadType":"str","x":110,"y":320,"wires":[["c36782a00bd55b83"]]},{"id":"d19260b25c2db811","type":"inject","z":"841b9631392ea7aa","name":"10pm Run","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 22 * * *","once":false,"onceDelay":0.1,"topic":"10pm","payload":"x","payloadType":"str","x":110,"y":380,"wires":[["c36782a00bd55b83"]]},{"id":"782d9fbe594b974c","type":"switch","z":"841b9631392ea7aa","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"All Good","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":180,"wires":[["c6630fb6f8569088"],["07f083210d641be8"]]},{"id":"c6630fb6f8569088","type":"api-call-service","z":"841b9631392ea7aa","name":"Notify HA App","server":"402a621.201329c","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_iphone","areaId":[],"deviceId":[],"entityId":[],"data":"{\"title\":\"1738 System Check - {{topic}}\",\"message\":\"All Systems Online\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":600,"y":160,"wires":[[]]},{"id":"402a621.201329c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]