Advertisement
penright

Untitled

Feb 2nd, 2022
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.22 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.     on_release:
  32.       - cover.template.publish:
  33.           id: template_cov
  34.           current_operation: OPENING
  35.     on_press:
  36.       - cover.template.publish:
  37.           id: template_cov
  38.           current_operation: IDLE
  39.     internal: true
  40.     filters:
  41.     - delayed_on: 100ms
  42.  
  43.   - platform: gpio
  44.     pin:
  45.       number: GPIO12
  46.       mode: INPUT_PULLUP
  47.       inverted: true
  48.     name: "Shop North Overhead Door Open Postion"
  49.     device_class: garage_door
  50.     id: contact_sensor_open_postion
  51.     on_release:
  52.       - cover.template.publish:
  53.           id: template_cov
  54.           current_operation: CLOSING
  55.     on_press:
  56.       - cover.template.publish:
  57.           id: template_cov
  58.           current_operation: IDLE
  59.     internal: true
  60.     filters:
  61.     - delayed_on: 100ms
  62.   - platform: gpio
  63.     pin:
  64.       number: GPIO32
  65.       mode: INPUT_PULLUP
  66.       inverted: False
  67.     name: "Shop Door"
  68.     device_class: door
  69.     filters:
  70.     - delayed_on: 100ms
  71.    
  72. switch:
  73.   - platform: gpio
  74.     pin:
  75.       number: GPIO13
  76.       inverted: true
  77.     name: "Shop North Overhead Door Relay"
  78.     id: relay
  79.     internal: true
  80.    
  81.    
  82.   - platform: restart
  83.     name: "Reset Shop garage Door ESPHome"
  84.  
  85. # This creates the actual garage door in HA. The state is based
  86. # on the contact sensor. Opening/closing the garage door simply
  87. # turns the relay on/off with a 0.5s delay in between.
  88.         #return COVER_CLOSED;
  89. cover:
  90.   - platform: template
  91.     device_class: garage
  92.     name: "Shop North Overhead Door"
  93.     id: template_cov
  94.     lambda: |-
  95.       if ((id(contact_sensor_open_postion).state) == true) {
  96.         return COVER_OPEN;
  97.       } else if (id(contact_sensor_closed_postion).state == true) {
  98.         return COVER_CLOSED;
  99.       } else {
  100.         return 0.5;
  101.       }
  102.     open_action:
  103.       - switch.turn_on: relay
  104.       - delay: 0.5s
  105.       - switch.turn_off: relay
  106.     close_action:
  107.       - switch.turn_on: relay
  108.       - delay: 0.5s
  109.       - switch.turn_off: relay
  110.     stop_action:
  111.       - switch.turn_on: relay
  112.       - delay: 0.5s
  113.       - switch.turn_off: relay
  114.    
  115.    
  116.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement