Garage Door Tilt Sensor Example

A couple have asked about using the MonoPrice Garage Door Tilt Sensors in HA. This is my current setup. If you have any questions let me know.

I added these Monoprice Garage Door Tilt Sensor to my garage doors -> https://www.monoprice.com/product?p_id=11987 I use them for triggering lights within the garage when returning home at night and then also run a script that has a delay built in to turn them off after a specific time and lock the door once the Garage Door has been closed. The delay allows time for exiting the car and getting into the house before shutting down the lights and locking the door. The config setup for the template,notification, lights and script is below as well as how the card looks in the UI.

sensor 8:
  platform: template
  sensors:
    gd1:
      friendly_name: "Garage 1"
      value_template: "{% if  states.sensor.vision_zg8101_garage_door_detector_alarm_level_10.state == '255' %}opened{% elif states.sensor.vision_zg8101_garage_door_detector_alarm_level_10.state == '0' %}closed{% endif %}"
  garagedoor_delay:
    alias: Garage Door Light Off Delay
    sequence:
      - delay:
          minutes: 3
      - service: homeassistant.turn_off
        data:
          entity_id:
            - switch.ge_45609_onoff_relay_switch_switch_12
  - alias: Turn Off Garage Lights After Delay
    trigger:
      - platform: state
        entity_id: sensor.vision_zg8101_garage_door_detector_alarm_level_10
        from: '255'
        to: '0'
      - platform: state
        entity_id: sensor.vision_zg8101_garage_door_detector_alarm_level_11
        from: '255'
        to: '0'
    condition:
      - condition: state
        entity_id: sensor.vision_zg8101_garage_door_detector_alarm_level_10
        state: '0'
      - condition: state
        entity_id: sensor.vision_zg8101_garage_door_detector_alarm_level_11
        state: '0'
    action:
      service: script.turn_on
      entity_id: script.garagedoor_delay
  - alias: Turn on Garage Light When Garage Doors Open
    condition:
      condition: or
      conditions:
       - condition: time
         before: "07:00"
       - condition: time
         after: "18:00"
    trigger:
      - platform: state
        entity_id: sensor.vision_zg8101_garage_door_detector_alarm_level_10
        from: '0'
        to: '255'
      - platform: state
        entity_id: sensor.vision_zg8101_garage_door_detector_alarm_level_11
        from: '0'
        to: '255'
    action:
      service: homeassistant.turn_on
      entity_id: switch.ge_45609_onoff_relay_switch_switch_12
  - alias: Garage Door 1 Open
    condition:
      condition: or
      conditions:
       - condition: time
         before: "05:00"
       - condition: time
         after: "20:00"
    trigger:
      - platform: state
        entity_id: sensor.vision_zg8101_garage_door_detector_alarm_level_10
        from: '0'
        to: '255'
        for:
          minutes: 15
    action:
      service: notify.mypushbullet
      data:
        title: "Garage Door 1 Open"
        message: Garage Door 1 is Open - Verify if this is correct and it needs to be closed
7 Likes

I use magnetic sensors to sense the closed or open status … but i like your implementation

good job :clap:

I went ahead and purchased the same tilt sensor from Monoprice. I did notice that sometimes mine wouldn’t show as open. Once the alarm level didn’t change from “0” to “255”. So I updated the template to use the state of the binary_sensor when it changes to “on”. But noticed it didn’t always change either.

Sometimes the alarm level changes, and sometimes the binary_sensor changes. But they weren’t always the same.

I used the following for my template, and it seems to catch both scenarios.

value_template: "{% if states.binary_sensor.vision_zg8101_garage_door_detector_sensor_2.state == 'on' %}open{% elif states.sensor.vision_zg8101_garage_door_detector_alarm_level_2.state == '255' %}open{% else %}closed{% endif %}"

I’m hoping it’s not a bad tilt sensor, but adding this in the event someone else runs into this issue.

5 Likes

Thanks, this was super helpful. I hope it’ll make my sensor more accurate. Otherwise I’ll be swapping out the ball switch with a mercury switch.

1 Like

Have you noticed this template doesn’t work anymore? For me it hasn’t worked since a December 2018 HA update.