UNPKG

node-red-contrib-home-assistant-websocket

Version:
1 lines 3.08 kB
[{"id":"fcb0d3b1b8ed3478","type":"group","z":"776c027950fc8c3f","name":"Switch node - selection routing based on entity details","style":{"label":true,"color":"#000000"},"nodes":["7f01d6eef386f743","84b7ac3a7e469780","60331de530222f6f","e253c6a934a17919","76bb91be0ae4c7b4","52713f1b7157f1f0"],"x":34,"y":2159,"w":852,"h":262},{"id":"7f01d6eef386f743","type":"poll-state","z":"776c027950fc8c3f","g":"fcb0d3b1b8ed3478","name":"","server":"","version":3,"exposeAsEntityConfig":"","updateInterval":"10","updateIntervalType":"num","updateIntervalUnits":"seconds","outputInitially":false,"outputOnChanged":true,"entityId":"switch.t1","stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputs":1,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":2240,"wires":[["84b7ac3a7e469780"]]},{"id":"84b7ac3a7e469780","type":"switch","z":"776c027950fc8c3f","g":"fcb0d3b1b8ed3478","name":"","property":"$round(data.timeSinceChangedMs/60000,0)","propertyType":"jsonata","rules":[{"t":"btwn","v":"2","vt":"num","v2":"3","v2t":"num"},{"t":"gt","v":"data.state=\"on\" ? 4 : 1","vt":"jsonata"},{"t":"jsonata_exp","v":"data.timeSinceChangedMs < 60000","vt":"jsonata"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":350,"y":2240,"wires":[["60331de530222f6f"],["e253c6a934a17919"],["76bb91be0ae4c7b4"],["52713f1b7157f1f0"]]},{"id":"60331de530222f6f","type":"debug","z":"776c027950fc8c3f","g":"fcb0d3b1b8ed3478","name":"Last changed between 2 and 3 minutes ago","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"\"Is \" & payload & \" for \" & $round(data.timeSinceChangedMs/60000, 0) & \" minutes\"","targetType":"jsonata","statusVal":"payload","statusType":"auto","x":670,"y":2200,"wires":[]},{"id":"e253c6a934a17919","type":"debug","z":"776c027950fc8c3f","g":"fcb0d3b1b8ed3478","name":"If on > 4 mins or if off > 1 mins","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"\"Is \" & payload & \" for \" & $round(data.timeSinceChangedMs/60000, 0) & \" minutes\"","targetType":"jsonata","statusVal":"payload","statusType":"auto","x":630,"y":2260,"wires":[]},{"id":"76bb91be0ae4c7b4","type":"debug","z":"776c027950fc8c3f","g":"fcb0d3b1b8ed3478","name":"Changed state < 1 minute ago","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"\"Is \" & payload & \" for \" & $round(data.timeSinceChangedMs/60000, 0) & \" minutes\"","targetType":"jsonata","statusVal":"payload","statusType":"auto","x":630,"y":2320,"wires":[]},{"id":"52713f1b7157f1f0","type":"debug","z":"776c027950fc8c3f","g":"fcb0d3b1b8ed3478","name":"Otherwise","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"\"Is \" & payload & \" for \" & $round(data.timeSinceChangedMs/60000, 0) & \" minutes\"","targetType":"jsonata","statusVal":"payload","statusType":"auto","x":560,"y":2380,"wires":[]}]