Templating I think it’s called? Here is the flow I’m working with:
Currently, if the garage door is open, TTS states; “It’s about to rain, so I’m closing the garage door. Please check all other doors and windows.”, if the garage door is closed, TTS states; “message”: “It’s about to rain, and the garage door is already closed. Please ensure all other doors and windows are closed as well.”.
If any doors or windows are left open, I get a Pushover notification sent to my phone. If 3 windows are open, I get three separate notifications to my phone.
I’d like to have more dynamic notifications that change depending on the situation. IF the garage door is open, and the dining room and front door are open, I’d like to receive a notification that says something like “It’s about to rain so I closed the garage door, and the dining room window and front door are open”.
I know this is possible with entity states and templating,m but I hae no idea how to start something like this. I’ve done a few Bayesian templates using prefabbed code, but I can’t find anything like that for this.
Does anyone have an example of what I’m trying to do?
[{"id":"84bc97e2.1bfc08","type":"tab","label":"Rainy Day","disabled":false,"info":""},{"id":"a5afbd08.facb3","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Turn on Rain Lights","server":"26956a45.92d866","version":1,"service_domain":"light","service":"turn_on","entityId":"group.rain_lights","data":"{\"brightness_pct\":45,\"transition\":1.5,\"rgb_color\":[7,235,205]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":true,"x":530,"y":180,"wires":[[]]},{"id":"9d17211d.506","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Turn Off Rain Lights","server":"26956a45.92d866","version":1,"service_domain":"light","service":"turn_off","entityId":"group.rain_lights","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":380,"y":720,"wires":[[]]},{"id":"d6507fe0.9b446","type":"server-state-changed","z":"84bc97e2.1bfc08","name":"Rain","server":"26956a45.92d866","version":1,"entityidfilter":"sensor.dark_sky_precip","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"rain","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":50,"y":400,"wires":[["2985f081.00df8","24ea9b14.88b054","265d3bb9.174074","664d7488.7c0dac","f7e4a96f.f1a7d8","375251b8.53a96e","d0ef0adb.52cb28","b79908a0.90a738","9a99ae33.3ec9d","fe5a3ea1.60c89","ab6026b.d40fad8"],["9d17211d.506"]]},{"id":"50cff154.28671","type":"comment","z":"84bc97e2.1bfc08","name":"Close the garage door if raining","info":"","x":410,"y":40,"wires":[]},{"id":"2985f081.00df8","type":"time-range-switch","z":"84bc97e2.1bfc08","name":"","lat":"27.918805","lon":"-81.866830","startTime":"05:00","endTime":"21:30","startOffset":0,"endOffset":0,"x":350,"y":200,"wires":[["a5afbd08.facb3"],[]]},{"id":"24ea9b14.88b054","type":"api-current-state","z":"84bc97e2.1bfc08","name":"Garage Door open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"open","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"cover.garage_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":380,"y":80,"wires":[["cc78e494.0aa7c8"],["1ca81669.8ad63a"]]},{"id":"cc78e494.0aa7c8","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Close Garage Door","server":"26956a45.92d866","version":1,"service_domain":"cover","service":"close_cover","entityId":"cover.garage_door","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":650,"y":60,"wires":[["84c74241.9846f"]]},{"id":"ca3ae3fc.0f92f","type":"comment","z":"84bc97e2.1bfc08","name":"If any doors or windows are left open, send notification.","info":"","x":480,"y":260,"wires":[]},{"id":"265d3bb9.174074","type":"api-current-state","z":"84bc97e2.1bfc08","name":"Front Door open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.front_door_contact","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":370,"y":300,"wires":[["47252d83.75e824"],[]]},{"id":"664d7488.7c0dac","type":"api-current-state","z":"84bc97e2.1bfc08","name":"Ava's window open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.ava_s_window_contact","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":380,"y":380,"wires":[["8e62c140.629cc"],[]]},{"id":"f7e4a96f.f1a7d8","type":"api-current-state","z":"84bc97e2.1bfc08","name":"Wyatt's window open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.wyatt_s_window_contact","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":380,"y":460,"wires":[["b3a12ac9.2900d8"],[]]},{"id":"375251b8.53a96e","type":"api-current-state","z":"84bc97e2.1bfc08","name":"Kid's bathroom window open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.kids_bathroom_window_contact","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":410,"y":580,"wires":[["ec79725c.3ee05"],[]]},{"id":"d0ef0adb.52cb28","type":"api-current-state","z":"84bc97e2.1bfc08","name":"Gwen's window open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.gwen_s_window_contact","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":380,"y":340,"wires":[["56bf9ba1.032994"],[]]},{"id":"b79908a0.90a738","type":"api-current-state","z":"84bc97e2.1bfc08","name":"LM Bedroom window open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.lm_bedroom_window_contact","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":400,"y":500,"wires":[["4eaaa549.fdacac"],[]]},{"id":"9a99ae33.3ec9d","type":"api-current-state","z":"84bc97e2.1bfc08","name":"RM Bedroom window open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.rm_bedroom_window_contact","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":400,"y":420,"wires":[["59add103.8821d"],[]]},{"id":"fe5a3ea1.60c89","type":"api-current-state","z":"84bc97e2.1bfc08","name":"Slider open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.slider_contact","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":350,"y":540,"wires":[["8cc61ae4.0f11c8"],[]]},{"id":"ab6026b.d40fad8","type":"api-current-state","z":"84bc97e2.1bfc08","name":"Dining room window open?","server":"26956a45.92d866","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.dining_room_window_contact","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":400,"y":620,"wires":[["ff7ea999.e7e2f8"],[]]},{"id":"47252d83.75e824","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Front door notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, and the Front Door is open!\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":580,"y":300,"wires":[[]]},{"id":"56bf9ba1.032994","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Gwen's window notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, and Gwen's window is open!\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":620,"y":340,"wires":[[]]},{"id":"8e62c140.629cc","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Ava's window notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, and Ava's window is open!\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":610,"y":380,"wires":[[]]},{"id":"59add103.8821d","type":"api-call-service","z":"84bc97e2.1bfc08","name":"RM bedroom window notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, and the RM bedroom window is open!\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":670,"y":420,"wires":[[]]},{"id":"b3a12ac9.2900d8","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Wyatt's window notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, and Wyatt's window is open!\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":620,"y":460,"wires":[[]]},{"id":"4eaaa549.fdacac","type":"api-call-service","z":"84bc97e2.1bfc08","name":"LM bedroom window notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, and the LM bedroom window is open!\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":670,"y":500,"wires":[[]]},{"id":"8cc61ae4.0f11c8","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Slider notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, and the Slider is open!\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":530,"y":540,"wires":[[]]},{"id":"ec79725c.3ee05","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Kids bathroom window notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, and the Kids bathroom window is open!\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":700,"y":580,"wires":[[]]},{"id":"67d9ba09.116514","type":"comment","z":"84bc97e2.1bfc08","name":"Turn off lights when rain is gone","info":"","x":410,"y":680,"wires":[]},{"id":"84c74241.9846f","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Garage door notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, so I'm closing the garage door.\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":870,"y":40,"wires":[["fdfc9f4c.fd62c"]]},{"id":"c1cd5fca.31d07","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say \"Closing the Garage...\"","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, so I'm closing the garage door. Please check all other doors and windows.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1330,"y":60,"wires":[[]]},{"id":"a0be89f4.158908","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Set volume 50%","server":"26956a45.92d866","version":1,"service_domain":"media_player","service":"volume_set","entityId":"media_player.kitchen_hub","data":"{\"volume_level\":0.5}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1100,"y":80,"wires":[["c1cd5fca.31d07"]]},{"id":"ff7ea999.e7e2f8","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Dining room window notification","server":"26956a45.92d866","version":1,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"It's about to rain, and the dining room window is open!\",\"title\":\"Home Assistant\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":670,"y":620,"wires":[[]]},{"id":"9f3c6b61.de4378","type":"comment","z":"84bc97e2.1bfc08","name":"If between 5a and 9p, turn on rain lights.","info":"","x":430,"y":140,"wires":[]},{"id":"8eaa9740.b40f18","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say Gwen's window is open","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and Gwen's window is open!\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1290,"y":340,"wires":[[]]},{"id":"5a48cbef.d28f64","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say Ava's window is open","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and Ava's window is open.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1270,"y":380,"wires":[[]]},{"id":"70fced48.ccba14","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say right master window open","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and the right master window is open.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1360,"y":420,"wires":[[]]},{"id":"e5dd219e.ec47d","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say Wyatt's window open","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and Wyatt's window is open.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1280,"y":460,"wires":[[]]},{"id":"a7827465.a061b8","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say left master window open","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and the left master window is open.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1350,"y":500,"wires":[[]]},{"id":"f1f42567.64af08","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say the slider is open","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and the slider is open.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1150,"y":540,"wires":[[]]},{"id":"68c0dc7e.048c14","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say kids bathroom window open","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and the kids bathroom window is open.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1430,"y":580,"wires":[[]]},{"id":"28babf63.f35b3","type":"stoptimer","z":"84bc97e2.1bfc08","duration":"45","units":"Second","payloadtype":"num","payloadval":"0","name":"45sec","x":1150,"y":420,"wires":[["70fced48.ccba14"],[]]},{"id":"4d80721c.a6e1ec","type":"stoptimer","z":"84bc97e2.1bfc08","duration":"75","units":"Second","payloadtype":"num","payloadval":"0","name":"75sec","x":1150,"y":500,"wires":[["a7827465.a061b8"],[]]},{"id":"84eff7c4.252068","type":"stoptimer","z":"84bc97e2.1bfc08","duration":"105","units":"Second","payloadtype":"num","payloadval":"0","name":"105sec","x":1200,"y":580,"wires":[["68c0dc7e.048c14"],[]]},{"id":"43513515.3a577c","type":"stoptimer","z":"84bc97e2.1bfc08","duration":"120","units":"Second","payloadtype":"num","payloadval":"0","name":"120sec","x":1160,"y":620,"wires":[["27655dc2.909452"],[]]},{"id":"27655dc2.909452","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say Dininf room window open","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and the Dining room window is open.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1380,"y":620,"wires":[[]]},{"id":"5d7aa873.406ab8","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say Front door is open","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and the Front Door is open.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1100,"y":300,"wires":[[]]},{"id":"ec41b92c.d0a148","type":"stoptimer","z":"84bc97e2.1bfc08","duration":"15","units":"Second","payloadtype":"num","payloadval":"0","name":"15sec","x":1090,"y":340,"wires":[["8eaa9740.b40f18"],[]]},{"id":"54cf03cc.93c55c","type":"stoptimer","z":"84bc97e2.1bfc08","duration":"30","units":"Second","payloadtype":"num","payloadval":"0","name":"30sec","x":1070,"y":380,"wires":[["5a48cbef.d28f64"],[]]},{"id":"a60f103d.5dde","type":"stoptimer","z":"84bc97e2.1bfc08","duration":"60","units":"Second","payloadtype":"num","payloadval":"0","name":"60sec","x":1090,"y":460,"wires":[["e5dd219e.ec47d"],[]]},{"id":"18b7dbd5.d6aaf4","type":"stoptimer","z":"84bc97e2.1bfc08","duration":"90","units":"Second","payloadtype":"num","payloadval":"0","name":"90sec","x":970,"y":540,"wires":[["f1f42567.64af08"],[]]},{"id":"da8504c8.a09be8","type":"api-call-service","z":"84bc97e2.1bfc08","name":"GH say \"It's about to rain...\"","server":"26956a45.92d866","version":1,"service_domain":"tts","service":"google_cloud_say","entityId":"media_player.kitchen_hub","data":"{\"message\":\"It's about to rain, and the garage door is already closed. Please ensure all other doors and windows are closed as well.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1320,"y":140,"wires":[[]]},{"id":"9add856b.f61d18","type":"comment","z":"84bc97e2.1bfc08","name":"Disconnected these, as I think my new implementation is better.","info":"","x":1210,"y":260,"wires":[]},{"id":"804c4777.8141e8","type":"api-call-service","z":"84bc97e2.1bfc08","name":"Set volume 50%","server":"26956a45.92d866","version":1,"service_domain":"media_player","service":"volume_set","entityId":"media_player.kitchen_hub","data":"{\"volume_level\":0.5}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1100,"y":160,"wires":[["da8504c8.a09be8"]]},{"id":"962fb6a.9b71f48","type":"inject","z":"84bc97e2.1bfc08","name":"Off @ 9:30pm","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"30 21 * * *","once":false,"onceDelay":0.1,"x":160,"y":720,"wires":[["9d17211d.506"]]},{"id":"fdfc9f4c.fd62c","type":"time-range-switch","z":"84bc97e2.1bfc08","name":"","lat":"27.918805","lon":"-81.866830","startTime":"07:00","endTime":"21:30","startOffset":0,"endOffset":0,"x":930,"y":100,"wires":[["a0be89f4.158908"],[]]},{"id":"1ca81669.8ad63a","type":"time-range-switch","z":"84bc97e2.1bfc08","name":"","lat":"27.918805","lon":"-81.866830","startTime":"07:00","endTime":"21:30","startOffset":0,"endOffset":0,"x":930,"y":180,"wires":[["804c4777.8141e8"],[]]},{"id":"26956a45.92d866","type":"server","z":"","name":"Hass.io","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]