Checking without a trigger

I made an automation “bedtime”: simply clicking on a dash button beside bed and:

  • -turn off lights
  • -shutdown pc
  • -upstrais climate off

I would like to add this:
“check if the upstair windows are open and, if yes, send me a notification”.

I saw a lot of automations checking doors and windows but all have a trigger and I don’t need it: I just need to check them!

I was thinking to create an input_boolean “bedtime_boolean” as a trigger to another “check windows” automation (of course “bedtime” has to put “bedtime_boolean” to on)

I am not sure if this is the correct way!
Plus: I would like to reuse “check windows” when I go away from home.

Thanks.

just put the additional condition before the notification action. eg:

action:
  - service: switch.turn_on
    entity_id: switch.amp_mute
  - service: media_player.media_pause
  - delay: '00:00:01'
  - condition: sun
    after: sunset
    after_offset: '00:00:00'
  - condition: sun
    before: sunrise
    before_offset: '00:00:00'
  - service: homeassistant.turn_on
    entity_id: light.front_door_light
  - delay: '00:02:00'
  - service: homeassistant.turn_off
    entity_id: light.front_door_light

in the above action for one of my automations, the control of the light only happens between the assigned hours because there is a condition within the actions. You can put the status of the upstairs windows as that condition to determine if the notification is to be sent.

Write a script to check the windows and send the notification? Then you can just call that wherever you like.

Yes!
I think that a script could be the best solution!
Thanks!