Block action unless pre-requisite satisfied

Hi

This feels like a simple requirement but I’m left scratching my head! :slight_smile:

I have some electric blinds on a number of doors and I want to stop them from closing when the doors are open. I can do this via an automation quite simply based on a condition linked to the state of the door sensors BUT how can I block adhoc activity via a Google/Nest voice command or the HomeAssistant UI? ie if someone issues the command to manually close the blinds it won’t be acted upon if the door sensor is open? (and optionally a voice response could alert that the blinds were not closed due to the door being open).

I’m sure there’s a very simple solution here but I’d appreciate any guidance please.

Many thanks

P.S. Apologies if there’s a more suitable sub forum to post this in…

You probably need a script or automation that you trigger from UI or Google.

Do your blinds report closing/opening?

Thanks but how do you stop people from saying Hey Google close the blinds?

Unfortunately not as they’re RTS Somfy Blinds…

I make the assumption that your “Hey Google” command activates an HA automation. That is Home Assistant must be running for the blind to be operated. As you seem to be aware, a conditional in the trigger section will do what you want.

If the blinds can be independently operated by either Google or HA, I would suggest a sock in the mouth of the one who uttered the command. (Sorry for the sarcasm, I just couldn’t resist.)

I am very biased in that I am not a fan of cloud based devices. With that understanding I advise you to ditch Google.

You make sure Google does not know about any blinds.
Only about the script or automation.

So remove it from Google and make sure HA does not share the blinds with Google

Is home assistant exposing the device in Google home? Or is the device directly connected to Google home skippIng HA?

Yes HA is exposing the blinds to Google Home. Gemini suggested that I used a Template Cover for the blinds and ‘hide’ the originals. This essentially creates a virtual blind that I’d then expose to Google etc

This is the sample YAML that it came up with:

cover:
  - platform: template
    covers:
      safe_living_room_blinds:
        device_class: blind
        friendly_name: "Living Room Blinds"
        value_template: "{{ states('cover.actual_blinds_id') }}"
        open_cover:
          service: cover.open_cover
          target:
            entity_id: cover.actual_blinds_id
        close_cover:
          # This is the "Restriction" logic
          choose:
            - conditions:
                - condition: state
                  entity_id: binary_sensor.door_sensor_id
                  state: "off" # Only proceeds if door is closed
              sequence:
                - service: cover.close_cover
                  target:
                    entity_id: cover.actual_blinds_id
            - conditions:
                - condition: state
                  entity_id: binary_sensor.door_sensor_id
                  state: "on" # If door is open, send a notification instead
              sequence:
                - service: notify.mobile_app_your_phone
                  data:
                    title: "Action Blocked"
                    message: "Cannot close blinds while the door is open!"
        stop_cover:
          service: cover.stop_cover
          target:
            entity_id: cover.actual_blinds_id

I’ve not had a chance to try this yet but does this sound viable?

Regards

The unavailable state is not covered.
But apart from that, it should probably work.

I would probably replace the second conditions: with a default.
That would mean it defaults to notify on anything else than door is closed.
Normally it won’t make a difference, but in case the door sensor is not available (battery died or whatever) then there will be nothing from this action as it is here.

Or have the default as an other error message.

cover:
  - platform: template
    covers:
      safe_living_room_blinds:
        device_class: blind
        friendly_name: "Living Room Blinds"
        value_template: "{{ states('cover.actual_blinds_id') }}"
        open_cover:
          service: cover.open_cover
          target:
            entity_id: cover.actual_blinds_id
        close_cover:
          # This is the "Restriction" logic
          choose:
            - conditions:
                - condition: state
                  entity_id: binary_sensor.door_sensor_id
                  state: "off" # Only proceeds if door is closed
              sequence:
                - service: cover.close_cover
                  target:
                    entity_id: cover.actual_blinds_id
            - conditions:
                - condition: state
                  entity_id: binary_sensor.door_sensor_id
                  state: "on" # If door is open, send a notification instead
              sequence:
                - service: notify.mobile_app_your_phone
                  data:
                    title: "Action Blocked"
                    message: "Cannot close blinds while the door is open!"
          default:
            - service: notify.mobile_app_your_phone
              data:
                title: "Action Blocked"
                message: "Something else is wrong with the door sensor."
        stop_cover:
          service: cover.stop_cover
          target:
            entity_id: cover.actual_blinds_id

While the solution of using a choose with conditions in the close action is sound, AI has typically suggested outdated and since 2025.12 now deprecated code (- platform: template)

You’ll need to refer to the documentation to see how to create a template cover with the future-proof code (essentially moving it from the cover to the template integration).

1 Like

Thanks for the info - much appreciated. I’ll play around with some future proof code and see if I can get a proof of concept working.