Repeat announcement till state is changed node red

Hey all,

My Aircon Automation broke so I’m taking the opportunity to move it to Node Red. But I’m a bit stuck with how to have Alexa repeat announcing the doors/ windows are open untill the condition is met.

This is what I have so far, which should be fine for the functionality, but no idea how to get the announce repeating in there?

This is my announcement.

Also how would I convert that to JS for the node?

service: notify.alexa_media
data_template:
  target:
    - media_player.bedroom_show
    - media_player.bathroom
    - media_player.kitchen
  data:
    type: announce
  message: >
    {% set door = is_state('binary_sensor.balcony_door_sensor', 'on') %}  {% set
    bdoor = is_state('binary_sensor.bedroom_balcony_door_sensor', 'on') %}  {%
    set window = is_state('binary_sensor.bedroom_window_sensor', 'on') %}  {% if
    door and window and bdoor %}  Please close both balcony doors and the
    bedroom window? {% elif door and window %}  Please close the balcony door
    and the bedroom window? {% elif bdoor and window %}  Please close the
    bedroom balcony door and the bedroom window? {% elif bdoor and door %} 
    Please close both balcony doors? {% elif window %} Please close the bedroom
    window?  {% elif door %} Please close the balcony door?  {% elif bdoor %}
    Please close the bedroom balcony door?  {% else %} Everything is closed,
    turning on aircon. {% endif %}

Thanks all :slight_smile:

Cant help with the JS. But heres how I do my repeat announcement till condition is met.

[{"id":"2fbbfa4b10d760db","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"3ad05c1d374e1e82","type":"alexa-remote-routine","z":"2fbbfa4b10d760db","name":"Speak: Freezer open","account":"f0ce5fbc.18734","routineNode":{"type":"speakAtVolume","payload":{"type":"regular","text":{"type":"str","value":"The freezer is still open. I repeat, the freezer is still open."},"volume":{"type":"num","value":"50"},"mode":"set","devices":["G6G0XG11030204T1"]}},"x":685,"y":135,"wires":[["e9cb47e190a25c1a"]]},{"id":"e9cb47e190a25c1a","type":"stoptimer-varidelay","z":"2fbbfa4b10d760db","duration":"10","durationType":"num","units":"Second","payloadtype":"num","payloadval":"0","name":"","reporting":"none","persist":true,"ignoretimerpass":true,"x":675,"y":240,"wires":[["3ad05c1d374e1e82"],[],[]]},{"id":"735cea2343c31448","type":"server-state-changed","z":"2fbbfa4b10d760db","name":"Freezer opened","server":"ab3e2c53.e3491","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.open_close_freezer","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":125,"y":135,"wires":[["dab7c081aaea6590"],[]],"outputLabels":["Opened","Closed"]},{"id":"dab7c081aaea6590","type":"stoptimer-varidelay","z":"2fbbfa4b10d760db","duration":"60","durationType":"num","units":"Second","payloadtype":"num","payloadval":"0","name":"","reporting":"none","persist":true,"ignoretimerpass":true,"x":390,"y":135,"wires":[["3ad05c1d374e1e82"],[],[]]},{"id":"c6c6ed33517690ac","type":"server-state-changed","z":"2fbbfa4b10d760db","name":"Freezer closed","server":"ab3e2c53.e3491","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.open_close_freezer","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"stop","valueType":"str"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":140,"y":240,"wires":[["dab7c081aaea6590","e9cb47e190a25c1a"],[]],"outputLabels":["Opened","Closed"]},{"id":"f0ce5fbc.18734","type":"alexa-remote-account","name":"","authMethod":"proxy","proxyOwnIp":"192.168.86.215","proxyPort":"3456","cookieFile":"Auth","refreshInterval":"15","alexaServiceHost":"pitangui.amazon.com","amazonPage":"amazon.com","acceptLanguage":"en-US","userAgent":"","useWsMqtt":"on","autoInit":"on"},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

So pretty much:

  1. Freezer opens
  2. 60 sec countdown
  3. If 60sec countdown expires, speaks freezer opened
  4. Waits 10 sec
  5. Speaks again
  6. Rinese, repeat steps 4 & 5 until freezer is closed
  7. Freezer closes
  8. STOP payload sent to timers, which stops the countdown and the repeat cycle

Thanks mate I appreciate that!

I’m still stuck trying to translate the YAML to JSON for the announcement. Once I get that working Ill try your loop :slight_smile:

Just to let you know as well, those third party Alexa integrations can be pretty dodgy/ abandoned. You can do it directly though Alexa Media Center and NR. Without any extras.

[{"id":"df37a8ded6ba9d9a","type":"api-call-service","z":"a29274b0.e51e78","g":"9250990f876b2dbc","name":"Announce Printer is finished","server":"d272ac3c.e0735","version":3,"debugenabled":false,"service_domain":"notify","service":"alexa_media","entityId":"","data":"{\"message\":\"The Printer has finished, please remove the print\",\t\"data\":{\"type\":\"announce\", \"method\":\"speak\"},\t\"target\":[\"media_player.bedroom_show\",\"media_player.kitchen\",\"media_player.bathroom\"]\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":400,"y":4280,"wires":[[]]},{"id":"d272ac3c.e0735","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

This is one that announces when the printer is done, just change the endpoints and msg and away you go :slight_smile:

I also found it easier to have everything in NR, instead of doing some in NR and then having to do an accompanying routine. Hope it could help :slight_smile:

I would look at the get entities node.
This should be able to get all entities that is binary sensors with the state on (or off) and pass that in the message as an array.
Then from there you need some JavaScript read the array for “false” values like binary sensor screen active and such.

But it should probably be the easiest to scale up when new sensors come, because if you have a naming convention then it should just work without any changes at all.

I don’t have time right now to create a sequence but perhaps later tonight

1 Like

Will only stop announcing when the three windows/doors are closed

[{"id":"a651197c.d620d8","type":"api-current-state","z":"ebd7f2e4.a2afc","name":"door 1 open?","server":"9405c3fe.d0a6c","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":410,"y":1600,"wires":[["f23df8c5.d3d708"],["986d5bac.94f3d8"]]},{"id":"986d5bac.94f3d8","type":"api-current-state","z":"ebd7f2e4.a2afc","name":"door 2 open?","server":"9405c3fe.d0a6c","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":410,"y":1640,"wires":[["f23df8c5.d3d708"],["4fb73093.1a9ca"]]},{"id":"4fb73093.1a9ca","type":"api-current-state","z":"ebd7f2e4.a2afc","name":"door 3 open?","server":"9405c3fe.d0a6c","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":410,"y":1680,"wires":[["f23df8c5.d3d708"],[]]},{"id":"f23df8c5.d3d708","type":"api-call-service","z":"ebd7f2e4.a2afc","name":"announce","server":"9405c3fe.d0a6c","version":3,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":1640,"wires":[["c0229472.69e968"]]},{"id":"c0229472.69e968","type":"delay","z":"ebd7f2e4.a2afc","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":600,"y":1520,"wires":[["a651197c.d620d8"]]},{"id":"ab84f4d5.1ce588","type":"inject","z":"ebd7f2e4.a2afc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":1600,"wires":[["a651197c.d620d8"]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

regarding the message

[{"id":"d4c4575e.d58338","type":"ha-get-entities","z":"877467b7.3b2fb8","name":"","server":"9405c3fe.d0a6c","version":0,"rules":[{"property":"entity_id","logic":"includes","value":"binary_sensor.balcony_door_sensor, binary_sensor.bedroom_balcony_door_sensor, binary_sensor.bedroom_window_sensor","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":470,"y":2340,"wires":[["9ab90ed7.80ed"]]},{"id":"9ab90ed7.80ed","type":"switch","z":"877467b7.3b2fb8","name":"None?","property":"payload.length","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":620,"y":2340,"wires":[["bf7fcada.c95898"],["191aecef.5e29f3"]]},{"id":"bf7fcada.c95898","type":"debug","z":"877467b7.3b2fb8","name":"None","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":760,"y":2320,"wires":[]},{"id":"191aecef.5e29f3","type":"split","z":"877467b7.3b2fb8","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":760,"y":2360,"wires":[["95cc879d.e04f38"]]},{"id":"95cc879d.e04f38","type":"join","z":"877467b7.3b2fb8","name":"","mode":"custom","build":"string","property":"payload.attributes.friendly_name","propertyType":"msg","key":"topic","joiner":", ","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":880,"y":2360,"wires":[["8f663127.f561c"]]},{"id":"8f663127.f561c","type":"debug","z":"877467b7.3b2fb8","name":"payload.attributes.friendly_name","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1090,"y":2360,"wires":[]},{"id":"43036d60.95ec84","type":"inject","z":"877467b7.3b2fb8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":320,"y":2340,"wires":[["d4c4575e.d58338"]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

I like the integration for the easier drop down menus and for sound effects. The one Im using has been abandoned well over a year lol, but does what I need right now.

Something like this perhaps?

[{"id":"8527963bcb759035","type":"inject","z":"ebaa69a9.649708","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":760,"wires":[["f76a3e42d6e4e382"]]},{"id":"f76a3e42d6e4e382","type":"ha-get-entities","z":"ebaa69a9.649708","name":"","server":"4bbca37b.1700ec","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"binary_sensor","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":370,"y":780,"wires":[["16c073b2e703c080"]]},{"id":"cb3b50a331cbd8f3","type":"debug","z":"ebaa69a9.649708","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":910,"y":780,"wires":[]},{"id":"16c073b2e703c080","type":"function","z":"ebaa69a9.649708","name":"","func":"var response = \"\";\nfor (let entity of msg.payload) {\n    if(entity.entity_id.includes(\"door\") || entity.entity_id.includes(\"window\")){\n        if(entity.state == \"off\"){\n            response = response + entity.entity_id.replace(\"binary_sensor.\", \"\").replace(\"_\", \" \") + \", \" \n        }\n    }\n}\nif(response != \"\") { \n    msg.message = \"Please close \" + response.substring(0, response.length - 1);\n}else{\n    msg.message = \"Everything is closed\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":780,"wires":[["e019996f844828c3"]]},{"id":"e019996f844828c3","type":"switch","z":"ebaa69a9.649708","name":"","property":"message","propertyType":"msg","rules":[{"t":"eq","v":"Everything is closed","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":780,"wires":[["cb3b50a331cbd8f3"],["77e99e0c7acc2313"]]},{"id":"77e99e0c7acc2313","type":"delay","z":"ebaa69a9.649708","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":550,"y":880,"wires":[["f76a3e42d6e4e382"]]},{"id":"4bbca37b.1700ec","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

This loops every minute until all sensors report “on”.
Just remove the debug and connect it to a TTS call service that speaks the msg.message.

The CakeBake one right? Yeah I was using it for a while as well, I just got worried about security ect.

But I do miss the GUI, makes like a little easier LOL

Thank you that’s awesome. I’m just trying to work it out.

Get entities; all binary sensors
Function node; get all BS that contain “window” and “door” with a state of open (off)

Either send a message that everything is closed
Or “Please close BS” that matches above logic

I think I got that part ok.

I’m having issues playing the msg though. I have another set of nodes that works the same way and plays a greeting for whoever comes home based on a function. Trying to use the same TTS, but it does nothing. No debug msgs out of the switch.

So guess thats the real issue,

But this should play the msg.message?

{
    "data": {
        "type": "announce",
        "method": "all"
    },
    "target": "media_player.bedroom_show"
}

Or am I missing something in this instance?

Thanks again, I can really see how once I get this working, can use it anywhere with changing a few variables :slight_smile:

Ok, I have worked out how to convert the YAML to JSON, Huzza!

Was missing some brackets, because of course I was LOL.

Id still love to get some feed back from you Hellis.

But for anyone else that comes across this and wants to use if statements in an announce, check this out

[{"id":"689a025a2a0489b6","type":"api-call-service","z":"a29274b0.e51e78","name":"Announce Printer is finished","server":"d272ac3c.e0735","version":3,"debugenabled":false,"service_domain":"notify","service":"alexa_media","entityId":"","data":"{\"message\":\"[{% set door = is_state('binary_sensor.balcony_door_sensor', 'on') %}  {% set bdoor = is_state('binary_sensor.bedroom_balcony_door_sensor', 'on') %}  {% set window = is_state('binary_sensor.bedroom_window_sensor', 'on') %}  {% if door and window and bdoor %}  Please close both balcony doors and the bedroom window? {% elif door and window %}  Please close the balcony door and the bedroom window? {% elif bdoor and window %}  Please close the bedroom balcony door and the bedroom window? {% elif bdoor and door %}  Please close both balcony doors? {% elif window %} Please close the bedroom window?  {% elif door %} Please close the balcony door?  {% elif bdoor %} Please close the bedroom balcony door?  {% else %} Everything is closed, turning on aircon. {% endif %}]\",\t\"data\":{\"type\":\"announce\", \"method\":\"speak\"},\t\"target\":[\"media_player.bedroom_show\",\"media_player.kitchen\",\"media_player.bathroom\"]\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1277.3778076171875,"y":4310.0966796875,"wires":[["e7607818f0085bdd"]]},{"id":"d272ac3c.e0735","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

Ok guys,

This is what ive got for now. Not sure if its the most effeciant, but it works.

Anyone that wants to use this, just note that.
This has an input Boolean exposed to Alexa
I have a dumb thermostat so I’m using a swtichbot to turn it on and off

[{"id":"88025a79cdd54fbb","type":"api-current-state","z":"a29274b0.e51e78","name":"Is the Balcony Door open?","server":"d272ac3c.e0735","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.balcony_door_sensor","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":620,"y":4600,"wires":[["689a025a2a0489b6"],["b9154baf8199e605"]]},{"id":"b9154baf8199e605","type":"api-current-state","z":"a29274b0.e51e78","name":"Is the Bedroom Window open?","server":"d272ac3c.e0735","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.bedroom_window_sensor","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":630,"y":4660,"wires":[["689a025a2a0489b6"],[]]},{"id":"ff33de37806ea48b","type":"api-current-state","z":"a29274b0.e51e78","name":"Is the Bedroom Balcony Door open?","server":"d272ac3c.e0735","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.bedroom_balcony_door_sensor","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":710,"y":4540,"wires":[["689a025a2a0489b6"],["88025a79cdd54fbb"]]},{"id":"8581f2a41a7f3468","type":"ha-wait-until","z":"a29274b0.e51e78","name":"Wait until Balcony Door is closed","server":"d272ac3c.e0735","version":0,"outputs":1,"entityId":"binary_sensor.balcony_door_sensor","entityIdFilterType":"exact","property":"state","comparator":"is","value":"off","valueType":"str","timeout":0,"timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":640,"y":4740,"wires":[["5e887ccd4ae1f854"]]},{"id":"c0229472.69e968","type":"delay","z":"a29274b0.e51e78","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":940,"y":4440,"wires":[["ff33de37806ea48b"]]},{"id":"689a025a2a0489b6","type":"api-call-service","z":"a29274b0.e51e78","name":"Check doors and window are shut","server":"d272ac3c.e0735","version":3,"debugenabled":false,"service_domain":"notify","service":"alexa_media","entityId":"","data":"{\"message\":\"[{% set door = is_state('binary_sensor.balcony_door_sensor', 'on') %}  {% set bdoor = is_state('binary_sensor.bedroom_balcony_door_sensor', 'on') %}  {% set window = is_state('binary_sensor.bedroom_window_sensor', 'on') %}  {% if door and window and bdoor %}  Please close both balcony doors and the bedroom window? {% elif door and window %}  Please close the balcony door and the bedroom window? {% elif bdoor and window %}  Please close the bedroom balcony door and the bedroom window? {% elif bdoor and door %}  Please close both balcony doors? {% elif window %} Please close the bedroom window?  {% elif door %} Please close the balcony door?  {% elif bdoor %} Please close the bedroom balcony door?  {% else %} Everything is closed, turning on aircon. {% endif %}]\",\t\"data\":{\"type\":\"announce\", \"method\":\"speak\"},\t\"target\":[\"media_player.bedroom_show\",\"media_player.kitchen\",\"media_player.bathroom\"]\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":960,"y":4640,"wires":[["c0229472.69e968"]]},{"id":"5e887ccd4ae1f854","type":"ha-wait-until","z":"a29274b0.e51e78","name":"Wait until Bedroom Balcony Door is closed","server":"d272ac3c.e0735","version":0,"outputs":1,"entityId":"binary_sensor.bedroom_balcony_door_sensor","entityIdFilterType":"exact","property":"state","comparator":"is","value":"off","valueType":"str","timeout":0,"timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":670,"y":4800,"wires":[["b1b10feb432b8805"]]},{"id":"b1b10feb432b8805","type":"ha-wait-until","z":"a29274b0.e51e78","name":"Wait until Balcony Door is closed","server":"d272ac3c.e0735","version":0,"outputs":1,"entityId":"binary_sensor.bedroom_window_sensor","entityIdFilterType":"exact","property":"state","comparator":"is","value":"off","valueType":"str","timeout":0,"timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":640,"y":4860,"wires":[["fabd1e0e202955ac"]]},{"id":"fabd1e0e202955ac","type":"api-call-service","z":"a29274b0.e51e78","name":"Turn on AirCon switch","server":"d272ac3c.e0735","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.aircon_switch","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":960,"y":4860,"wires":[["8d135ac6656219ef","8ceaf52c3238acb1"]]},{"id":"8d135ac6656219ef","type":"delay","z":"a29274b0.e51e78","name":"Wait 1 hour","pauseType":"delay","timeout":"1","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1190,"y":4820,"wires":[["8a0bfe9b0ecd89f2"]]},{"id":"8a0bfe9b0ecd89f2","type":"api-call-service","z":"a29274b0.e51e78","name":"Turn Off AirCon switch","server":"d272ac3c.e0735","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.aircon_switch","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1480,"y":4840,"wires":[["df7490ef69a59bb8"]]},{"id":"df7490ef69a59bb8","type":"api-call-service","z":"a29274b0.e51e78","name":"Turn Off AirCon Boolean","server":"d272ac3c.e0735","version":3,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.aircon","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1730,"y":4800,"wires":[[]]},{"id":"8ceaf52c3238acb1","type":"ha-wait-until","z":"a29274b0.e51e78","name":"Wait untill temp is below 25","server":"d272ac3c.e0735","version":0,"outputs":1,"entityId":"sensor.desk_temperature_sensor.bedroom_window_sensor","entityIdFilterType":"exact","property":"state","comparator":"lte","value":"26","valueType":"num","timeout":0,"timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":1220,"y":4880,"wires":[["8a0bfe9b0ecd89f2"]]},{"id":"48aaed6da86c3b25","type":"api-current-state","z":"a29274b0.e51e78","name":"Is Aircon Switch on?","server":"d272ac3c.e0735","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.aircon_switch","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":380,"y":4540,"wires":[[],["ff33de37806ea48b","8581f2a41a7f3468"]]},{"id":"b376c4c5e0cf6925","type":"server-state-changed","z":"a29274b0.e51e78","name":"Aircon Boolean turns on?","server":"d272ac3c.e0735","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.aircon","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":130,"y":4540,"wires":[["48aaed6da86c3b25"],[]]},{"id":"d272ac3c.e0735","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

This is what it looks like;

I’ll look at it when I’m at the computer and can import the sequence.

If you got it to work then that is great!