Advertisement
penright

Untitled

Feb 2nd, 2022
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.57 KB | None | 0 0
  1.  
  2. #===================================================================================
  3. #When holding the board with USB down
  4. #   GND         RST         |       -GPIO  1   GND
  5. #   NC          GPIO 36     |       -GPIO  3  *GPIO 27
  6. #   GPIO 39    *GPIO 26     |        GPIO 22   GPIO 25
  7. #   GPIO 35     GPIO 18     |        GPIO 21  *GPIO 32
  8. #  *GPIO 33     GPIO 19     |        GPIO 17  *GPIO 12
  9. #   GPIO 34     GPIO 23     |       *GPIO 16   GPIO  4
  10. #  *GPIO 14     GPIO  5     |        GND       GPIO  0
  11. #   NC          3.3V        |        5V        GPIO  2
  12. #   GPIO  9    *GPIO 13     |       *GPIO 15  -GPIO  8
  13. #  -GPIO 11     GPIO 10     |       -GPIO  7  -GPIO  6
  14. #Notes
  15. #  * Pins are best to use
  16. #  - Pins that should never be use
  17. #  Unmark pins could be used as input only but ESPHome won't allow it
  18. #===================================================================================
  19.  
  20.  
  21.  
  22. binary_sensor:
  23.   - platform: gpio
  24.     pin:
  25.       number: GPIO27
  26.       mode: INPUT_PULLUP
  27.       inverted: true
  28.     name: "Shop North Overhead Door Closed Postion"
  29.     device_class: garage_door
  30.     id: contact_sensor_closed_postion
  31.     internal: false
  32.     filters:
  33.     - delayed_on: 100ms
  34.   - platform: gpio
  35.     pin:
  36.       number: GPIO12
  37.       mode: INPUT_PULLUP
  38.       inverted: true
  39.     name: "Shop North Overhead Door Open Postion"
  40.     device_class: garage_door
  41.     id: contact_sensor_open_postion
  42.     internal: false
  43.     filters:
  44.     - delayed_on: 100ms
  45.   - platform: gpio
  46.     pin:
  47.       number: GPIO32
  48.       mode: INPUT_PULLUP
  49.       inverted: False
  50.     name: "Shop Door"
  51.     device_class: door
  52.     filters:
  53.     - delayed_on: 100ms
  54.    
  55. switch:
  56.   - platform: gpio
  57.     pin:
  58.       number: GPIO13
  59.       inverted: true
  60.     name: "Shop North Overhead Door Relay"
  61.     id: relay
  62.     internal: true
  63.    
  64.    
  65.   - platform: restart
  66.     name: "Reset Shop garage Door ESPHome"
  67.  
  68. # This creates the actual garage door in HA. The state is based
  69. # on the contact sensor. Opening/closing the garage door simply
  70. # turns the relay on/off with a 0.5s delay in between.
  71.         #return COVER_CLOSED;
  72. cover:
  73.   - platform: template
  74.     device_class: garage
  75.     name: "Shop North Overhead Door"
  76.     id: template_cov
  77.     lambda: |-
  78.       if ((id(contact_sensor_open_postion).state) == true) {
  79.         return 1.0;
  80.       } else if (id(contact_sensor_closed_postion).state == true) {
  81.         return 0.0;
  82.       } else {
  83.         return 0.5;
  84.       }
  85.     open_action:
  86.       - switch.turn_on: relay
  87.       - delay: 0.5s
  88.       - switch.turn_off: relay
  89.     close_action:
  90.       - switch.turn_on: relay
  91.       - delay: 0.5s
  92.       - switch.turn_off: relay
  93.    
  94.    
  95.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement