UNPKG

node-red-contrib-home-assistant-websocket

Version:
1 lines 5.56 kB
[{"id":"d0f1fad3bf96a090","type":"group","z":"776c027950fc8c3f","name":"Current State node - read the state of an entity","style":{"label":true,"color":"#000000"},"nodes":["6394700dfd39838f","8388eb36d3e25254","852c05cf8c7cae73","a3e69091339a457c","11fc322e343cbd9c","6ac52ef3e9010615","63fa3b7423417fe4","a29810da49f1efd4","4f8197db85d55fb5","fd6d41b2f67b85e0","36912490ae36c0db","f84772ea62e6e7ba","6244f42dd53b7e1f","bc6cd64ba0266d97"],"x":34,"y":499,"w":1012,"h":382},{"id":"6394700dfd39838f","type":"api-current-state","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"climate.bedroom_aircon","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"(\t $att:=$entity().attributes;\t $diff:=$att.temperature-$att.current_temperature;\t ($diff>0 ? \"Heating\" : \"Cooling\") & \" by \" & $abs($diff) & \" degrees required\"\t)","valueType":"jsonata"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":430,"y":580,"wires":[["852c05cf8c7cae73"]]},{"id":"8388eb36d3e25254","type":"inject","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"Manual trigger","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":580,"wires":[["6394700dfd39838f"]]},{"id":"852c05cf8c7cae73","type":"debug","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"Output Text","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":770,"y":580,"wires":[]},{"id":"a3e69091339a457c","type":"comment","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"2a - JSONata builds output in current state node","info":"","x":240,"y":540,"wires":[]},{"id":"11fc322e343cbd9c","type":"api-current-state","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"","server":"","version":3,"outputs":2,"halt_if":"$entities('sensor.time').state < \"17:00\" ? \"cool\" : \"off\"","halt_if_type":"jsonata","halt_if_compare":"is","entity_id":"climate.bedroom_aircon","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"for":"$entity().state = \"off\" ? 0 : 2","forType":"jsonata","forUnits":"hours","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":430,"y":700,"wires":[["63fa3b7423417fe4"],["a29810da49f1efd4"]]},{"id":"6ac52ef3e9010615","type":"inject","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"Manual trigger","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":700,"wires":[["11fc322e343cbd9c"]]},{"id":"63fa3b7423417fe4","type":"debug","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"Cooling for 2+ hours before 17:00, or Off","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":840,"y":680,"wires":[]},{"id":"a29810da49f1efd4","type":"debug","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"otherwise","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":700,"y":740,"wires":[]},{"id":"4f8197db85d55fb5","type":"comment","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"2b - JSONata builds conditional test value, and UI parameter","info":"","x":280,"y":660,"wires":[]},{"id":"fd6d41b2f67b85e0","type":"comment","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"2c - JSONata builds conditional Boolean","info":"","x":220,"y":780,"wires":[]},{"id":"36912490ae36c0db","type":"api-current-state","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"","server":"","version":3,"outputs":2,"halt_if":"(\t $state:=$entity().state;\t $time:=$entities('sensor.time').state;\t ($time<=\"09:00\" or $time>=\"17:00\") and ($state=\"heat\" or $state=\"cool\")\t)","halt_if_type":"jsonata","halt_if_compare":"jsonata","entity_id":"climate.bedroom_aircon","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entity"}],"for":"$substringAfter($now(),\"T\")>\"10:00\" ? 20 : 10","forType":"jsonata","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":430,"y":820,"wires":[["6244f42dd53b7e1f"],["bc6cd64ba0266d97"]]},{"id":"f84772ea62e6e7ba","type":"inject","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"Manual trigger","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":820,"wires":[["36912490ae36c0db"]]},{"id":"6244f42dd53b7e1f","type":"debug","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"On outside of office hours","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload.state","targetType":"msg","statusVal":"payload.state","statusType":"auto","x":850,"y":800,"wires":[]},{"id":"bc6cd64ba0266d97","type":"debug","z":"776c027950fc8c3f","g":"d0f1fad3bf96a090","name":"otherwise","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload.state","targetType":"msg","statusVal":"payload.state","statusType":"auto","x":680,"y":840,"wires":[]}]