Entropy Reduction

Personal log of yet another digital native.


Project maintained by andre-abadi Hosted on GitHub Pages — Theme by mattgraham

Purpose

Reference

Actions

Pictures

garage-door

Code

# reed switch sensor
binary_sensor:
  - platform: gpio
    id: gpio2
    name: "${friendly_name} Sensor"
    device_class: garage_door
    pin:
      number: GPIO2
      mode: INPUT_PULLUP
      inverted: true
    filters:
      - delayed_on: 1000ms
      - delayed_off: 1000ms

switch:
  # actual GPIO0 switch
  - platform: gpio
    id: gpio0
    restore_mode: ALWAYS_OFF
    pin:
      number: GPIO0
  # wrapper for GPIO0 making it a momentary switch
  - platform: template
    internal: true
    id: gpio0_momentary
    name: "${friendly_name} Button"
    icon: "mdi:light-switch"
    turn_on_action:
      - switch.turn_on: gpio0
      - delay: 250ms
      - switch.turn_off: gpio0
cover:
  - platform: template
    name: "${friendly_name}"
    id: garage_door_cover
    device_class: garage
    lambda: |-
      if (id(gpio2).state) {
        return COVER_OPEN;
      } else {
        return COVER_CLOSED;
      }
    open_action:
      - switch.turn_on: gpio0_momentary
    close_action:
      - switch.turn_on: gpio0_momentary

Observations