UNPKG

node-red-contrib-home-assistant-websocket

Version:
2 lines (1 loc) 1.24 kB
[{"id":"f79cd7b0.604f98","type":"inject","z":"ffbd7f06.4a014","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":332,"y":1200,"wires":[["753a1de3.091fa4"]]},{"id":"753a1de3.091fa4","type":"api-get-history","z":"ffbd7f06.4a014","name":"","startdate":"","enddate":"","entityid":"light.kitchen_light","entityidtype":"is","useRelativeTime":true,"relativeTime":"24 hours","flatten":true,"output_type":"array","output_location_type":"msg","output_location":"payload","x":476,"y":1200,"wires":[["389b5575.43217a"]]},{"id":"389b5575.43217a","type":"function","z":"ffbd7f06.4a014","name":"check state","func":"const state = \"on\";\nconst filtered = msg.payload.filter((entity) => entity.state === state);\n\nif(filtered.length > 0) {\n msg.payload = filtered;\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":644,"y":1200,"wires":[["6a582450.883bdc"]]},{"id":"6a582450.883bdc","type":"debug","z":"ffbd7f06.4a014","name":"do something","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":832,"y":1200,"wires":[]}]