Which doors/windows are open?

If, for example, the get entities node catches 4 entities and so 4 friendly names, how would you do to make a comma separated string that has an “and” before the last element? i.e: A, B, C and D.

Hi,
I did not understand is it possible an example?

The solutions I found in the forum didn’t handle the windows-open-time seperately for each window.

So if you for example:

  • open window 1
  • after 2 minutes open window 2
  • close window 2

you would get an alarm X minutes after the FIRST window was opened, even that no window was opened longer than allowed.

So I created an alternate flow for open window detection.
Maybe someone else has a use case for it.

It also sends out an updated string of windows names whenever a new window reaches the alarm-timespan, or when one of the opened windows gets closed.

I want to use it with the actionable Notifications of the native HA iOS app,
as you can update an already delivered notification here instead of sending a new one

So e.g. the notification text gets updated with the name of another window, or one window is removed from the notification text.

You can also dismiss the notification completely from the lockscreen when all windows are closed, without touching the phone.

This helps a lot to avoid a notification spammed lockscreen and to make this “nag” messages more widely accepted within the family. :wink:

[{"id":"42442f06.7b14f","type":"server-state-changed","z":"5ddddd21.00d204","name":"Door/Window Open","server":"94fdcfdf.a00b","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"group.doors_windows","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":110,"y":1500,"wires":[["5cb1066a.159528"]]},{"id":"5cb1066a.159528","type":"switch","z":"5ddddd21.00d204","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":1500,"wires":[["92868919.54d7a8"],["a13066de.6decb8"]]},{"id":"92868919.54d7a8","type":"stoptimer","z":"5ddddd21.00d204","duration":"5","units":"Minute","payloadtype":"num","payloadval":"0","name":"5 Minutes","x":580,"y":1500,"wires":[["81951836.f6f138"],[]]},{"id":"a13066de.6decb8","type":"change","z":"5ddddd21.00d204","name":"Stop Timer","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1560,"wires":[["92868919.54d7a8","a154c077.9126e"]]},{"id":"3bfdd611.5a426a","type":"api-call-service","z":"5ddddd21.00d204","name":"Door/Window Open","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.door_open","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1030,"y":1500,"wires":[["3b2966e7.564c1a"]]},{"id":"a154c077.9126e","type":"api-call-service","z":"5ddddd21.00d204","name":"Door/Window Closed","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.door_open","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":800,"y":1560,"wires":[[]]},{"id":"81951836.f6f138","type":"api-call-service","z":"5ddddd21.00d204","name":"Turn Off Thermostats","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"climate","service":"turn_off","entityId":"climate.daikinap97021, climate.thermostat_bathroom, climate.thermostat_dining_room, climate.thermostat_downstairs_bathroom, climate.thermostat_entrance, climate.thermostat_gym, climate.thermostat_haileys_room, climate.thermostat_kitchen, climate.thermostat_living_room_2, climate.thermostat_master_bathroom, climate.thermostat_master_bedroom, climate.thermostat_play_room, climate.thermostat_spare_bedroom, climate.thermostat_storage, climate.thermostat_theatre, climate.thermostat_living_room_1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":800,"y":1500,"wires":[["3bfdd611.5a426a"]]},{"id":"3b2966e7.564c1a","type":"ha-get-entities","z":"5ddddd21.00d204","server":"94fdcfdf.a00b","name":"Which Doors/Windows?","rules":[{"property":"entity_id","logic":"in_group","value":"group.doors_windows","valueType":"str"},{"property":"state","logic":"includes","value":"on, open","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":1270,"y":1500,"wires":[["e0d33504.13ee68"]]},{"id":"e0d33504.13ee68","type":"template","z":"5ddddd21.00d204","name":"Format Msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.attributes.friendly_name}}","output":"str","x":1470,"y":1500,"wires":[["ce669e51.69747"]]},{"id":"ce669e51.69747","type":"join","z":"5ddddd21.00d204","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":", ","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1610,"y":1500,"wires":[["85ccf662.f8c1e8"]]},{"id":"85ccf662.f8c1e8","type":"api-call-service","z":"5ddddd21.00d204","name":"Notify","server":"94fdcfdf.a00b","version":1,"debugenabled":false,"service_domain":"notify","service":"pushover","entityId":"","data":"{\"message\":\"{{payload}} left open for 5 minutes. Thermostats turned off\",\"title\":\"Temperature\",\"data\":{\"priority\":0,\"sound\":\"pianobar\"}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1750,"y":1500,"wires":[[]]},{"id":"94fdcfdf.a00b","type":"server","z":"","name":"Home Assistant","addon":true}]
1 Like