Add Conditional to Cover Garage Door Controller GD00Z-4

Home Assistant OS 5.10
Version core-2021.1.5

Someone just gave me GD00Z-4 Garage Door Opener and was able to finally get it working with the Covers Template. Can get it to open/close with the Dashboard card created. I have a zwave receptacle that turn off when leave to work. Tested the Cover with the receptacle OFF cause wanted to make sure that Cover wouldn’t open the door when the receptacle came back ON. Good news was it didn’t, but the ACCESS CONTROL entity went to 70, which I guess is for state unknown.

What would like to do is add a Conditional to the Cover in Configuration.yaml that the switch.garage_door_receptacle has to be in state ON. Doesn’t seem possible in Configuration.yaml to do that. Tried numerous attempts and just got errors in check config.

Here is the section created the cover in configuration.yaml

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: '{{ is_state("cover.garage_door_open_close", "open") }}'
        open_cover:
          service: script.open_garage_door
        close_cover:
          service: script.close_garage_door
        stop_cover:
          service: script.stop_garage_door

Is there a way to add a conditional for the switch.garage_door_receptacle in the cover template? I am either doing it wrong or not possible.

Would it be better to (not even sure this would work) make the cover simpler and create automation script for the open/close? Maybe like so:

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage

Then make a new Dashboard card that called an automation script for open and close!?

You can add a conditional to your open and close commands. Here’s an example of how I use a sensor to determine if I should send power to the garage door or not (otherwise close would always trigger it and it would then open if already closed):

  close_cover:
    - condition: state
      entity_id: 'binary_sensor.garage_door_sensor'
      state: 'off'  
    - service: switch.turn_on
      data:
        entity_id: switch.garage_door_opener

Thanks CO_4X4! Edited that to match mine and couldn’t get it to turn the receptacle ON.
In Config:

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: '{{ is_state("cover.garage_door_open_close", "open") }}'
        open_cover:
        - condition: state
          entity_id: switch.garage_door_receptacle
          state: 'off'
        - service: switch.turn_on
          entity_id: switch.garage_door_receptacle
          data: {}
        - service: script.open_garage_door
          data: {}
          entity_id: cover.garage_door_open_close

It just won’t turn the receptacle ON. So figured would write a script to see if could do it, then duplicate it in the configuration.yaml.
script wrote:

alias: Garage Door OPEN Test With Switch OFF.
sequence:
  - condition: state
    entity_id: switch.garage_door_receptacle
    state: 'off'
  - service: switch.turn_on
    entity_id: switch.garage_door_receptacle
    data: {}
  - delay: '00:00:00'
  - service: cover.open_cover
    data: {}
    entity_id: cover.garage_door_open_close
mode: single
icon: 'mdi:garage'

Also did an CLOSE with the switch (receptacle) OFF. Both work fine!!
They turn the switch (receptacle) on and the controller starts beeping and opens or closes the door.

Figured maybe it was in the Dashboard Card. So did a test: Removed/Saved the cover.garage_door_open_close. Then readded that and the cover.garage_door entity that shows up.

  1. cover.garage_door_open_close won’t turn on the receptacle and will just open the door, if the receptacle is already ON.
  2. The cover.garage_door will take what is in the config and turn the receptacle ON. But then says: " Failed to call service cover/open_cover. Unable to find service script.open_garage_door". And doesn’t do anything if the receptacle is already ON. Because: Garage Door: Test condition state: False
    Which leds to another problem where need it to work if receptacle is ON and if OFF turn it on. But think could just add another condition, if could get the 1st one to work in config file and not just with an non-service script I wrote.

Rebooted (have just been reloading the scripts) and still nogo.
Think might have to just write automation script and change the Dashboard Card.
The sensor.garage_door_access_control gets in the unknown state: 70 will the fails so have to keep resetting the states.

  1. Changed the cover.open_garage_door_open_close in the config to the other entity that shows up, the cover.open_garage_door, but upon reboot, same results. So that wasn’t it.

Pretty sure I just have something messed up or misunderstood.
These are the entities have associate with the Door Opener:
cover.garage_door: state open/closed
cover.garage_door_open_close: state open/closed
sensor.garage_door_access_control: state usually 0, 70 or 254
zwave.garage_door_controller
sensor.garage_door_source_nodeid
sensor.garage_door_burglar
sensor.garage_door_alarm_type and level

Probably something simple I am missing, since only started using Hassio couple weeks ago.

Your indentions look off on the template :

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: '{{ is_state("cover.garage_door_open_close", "open") }}'
        open_cover:
          - condition: state
            entity_id: switch.garage_door_receptacle
            state: 'off'
          - service: switch.turn_on
            entity_id: switch.garage_door_receptacle
            data: {}
          - service: script.open_garage_door
            data: {}
            entity_id: cover.garage_door_open_close

LOL what a difference indentions make! Worse than python, cause at least it tells you.
Anywho, that sort of worked, but ran into the same problem got earlier with:
Garage Door: Test condition state: False

Decided before you was able to respond with the indention to remove the condition and just turn on the receptacle to avoid that issue. Instead made two Dashboard Cards: Open and Close.

type: entity-button
entity: cover.garage_door_open_close
tap_action:
  action: call-service
  service: script.1612046300397
name: Garage Door Close
show_state: true
type: entity-button
entity: cover.garage_door_open_close
tap_action:
  action: call-service
  service: script.1612046135250
name: Garage Door Open
show_state: true
icon: 'hassio:garage-open'

That call these scripts

'1612046135250':
  alias: Garage Open Switch OFF.
  sequence:
  - service: switch.turn_on
    entity_id: switch.garage_door_receptacle
    data: {}
  - service: cover.open_cover
    data: {}
    entity_id: cover.garage_door_open_close
  mode: single
  icon: mdi:garage-open
'1612046300397':
  alias: Garage Close Switch OFF.
  sequence:
  - service: switch.turn_on
    entity_id: switch.garage_door_receptacle
    data: {}
  - service: cover.close_cover
    data: {}
    entity_id: cover.garage_door_open_close
  mode: single
  icon: mdi:garage

I think like the separate button cards better anyway than the up/down arrows. I’ll play with it some more. Might turn the switch (receptacle) back OFF after the door is down.

Also change from when testing using the cover.garage_door to the cover.garage_door.open_close cause the later showed opening and closing where as the former just showed the final status.
Bad thing about this device, have to seem to reset it lot while testing. Cause won’t work if in unknown state. Then you think maybe your script,… is bad.

Thanks for you help! Have a good weekend.

1 Like