chickey

Untitled

May 20th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. esphome:
  2. name: diningroomlamp
  3. platform: ESP8266
  4. board: esp01_1m
  5.  
  6. wifi:
  7. ssid: ""
  8. password: ""
  9.  
  10. # Enable Home Assistant API
  11. api:
  12.  
  13. # Enable logging
  14. logger:
  15. baud_rate: 0
  16.  
  17. ota:
  18.  
  19. uart:
  20. tx_pin: GPIO01
  21. rx_pin: GPIO03
  22. baud_rate: 19200
  23.  
  24. binary_sensor:
  25. - platform: gpio
  26. pin:
  27. number: GPIO10
  28. mode: INPUT_PULLUP
  29. inverted: True
  30. name: "Sonoff Basic Button"
  31. on_press:
  32. - switch.toggle: relay1
  33.  
  34. switch:
  35. - platform: uart
  36. id: relay_12_off
  37. data: [0xA0, 0x04, 0x00, 0xA1]
  38.  
  39. - platform: uart
  40. id: relay_1_on
  41. data: [0xA0, 0x04, 0x01, 0xA1]
  42.  
  43. - platform: uart
  44. id: relay_2_on
  45. data: [0xA0, 0x04, 0x02, 0xA1]
  46.  
  47. - platform: uart
  48. id: relay_12_on
  49. data: [0xA0, 0x04, 0x03, 0xA1]
  50.  
  51. - platform: template
  52. id: relay1
  53. name: "dining_room_lamp_relay1"
  54. turn_on_action:
  55. if:
  56. condition:
  57. switch.is_off: relay2
  58. then:
  59. - switch.turn_on: relay_1_on
  60. else:
  61. - switch.turn_on: relay_12_on
  62. turn_off_action:
  63. if:
  64. condition:
  65. switch.is_off: relay2
  66. then:
  67. - switch.turn_on: relay_12_off
  68. else:
  69. - switch.turn_on: relay_2_on
  70. optimistic: true
  71.  
  72. - platform: template
  73. id: relay2
  74. name: "dining_room_lamp_relay2"
  75. turn_on_action:
  76. if:
  77. condition:
  78. switch.is_off: relay1
  79. then:
  80. - switch.turn_on: relay_2_on
  81. else:
  82. - switch.turn_on: relay_12_on
  83. turn_off_action:
  84. if:
  85. condition:
  86. switch.is_off: relay1
  87. then:
  88. - switch.turn_on: relay_12_off
  89. else:
  90. - switch.turn_on: relay_1_on
  91. optimistic: true
Advertisement
Add Comment
Please, Sign In to add comment