to4ko

Untitled

Jun 23rd, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. substitutions:
  2. board_name: shp5_socket_1
  3. ip_address: 192.168.1.135
  4.  
  5. esphome:
  6. name: ${board_name}
  7. platform: ESP8266
  8. board: esp8285
  9. on_boot:
  10. - output.turn_on: red_led
  11.  
  12. wifi:
  13. ssid: !secret wifi_ssid
  14. password: !secret wifi_pass
  15. domain: .localdomain
  16. reboot_timeout: 0s
  17. manual_ip:
  18. static_ip: ${ip_address}
  19. gateway: 192.168.1.1
  20. subnet: 255.255.255.0
  21.  
  22. # Enable logging
  23. logger:
  24. baud_rate: 0
  25.  
  26. uart:
  27. tx_pin: GPIO01
  28. rx_pin: GPIO03
  29. baud_rate: 4800
  30.  
  31. # Enable Home Assistant API
  32. api:
  33. reboot_timeout: 0s
  34.  
  35. ota:
  36.  
  37. web_server:
  38. port: 80
  39.  
  40. binary_sensor:
  41. - platform: status
  42. name: ${board_name}_Status
  43.  
  44. - platform: gpio
  45. name: ${board_name}_Button
  46. pin:
  47. number: GPIO16
  48. mode: INPUT_PULLUP
  49. inverted: True
  50. on_press:
  51. - switch.toggle: relay_220
  52. on_double_click:
  53. min_length: 50ms
  54. max_length: 350ms
  55. then:
  56. - switch.toggle: relay_usb
  57.  
  58. output:
  59. - platform: gpio
  60. pin: GPIO00
  61. inverted: true
  62. id: red_led
  63.  
  64. status_led:
  65. pin:
  66. number: GPIO02
  67. inverted: true
  68.  
  69. switch:
  70. - platform: gpio
  71. name: ${board_name}_220_Relay
  72. pin: GPIO14
  73. id: relay_220
  74. restore_mode: RESTORE_DEFAULT_ON
  75. on_turn_on:
  76. - output.turn_on: red_led
  77. on_turn_off:
  78. - output.turn_off: red_led
  79.  
  80. - platform: gpio
  81. name: ${board_name}_USB_relay
  82. pin: GPIO05
  83. id: relay_usb
  84. restore_mode: RESTORE_DEFAULT_ON
  85.  
  86. - platform: restart
  87. name: ${board_name}_Restart
  88.  
  89. sensor:
  90. - platform: cse7766
  91. current:
  92. name: ${board_name}_Amperage
  93. icon: mdi:current-ac
  94. unit_of_measurement: 'A'
  95. accuracy_decimals: 3
  96. voltage:
  97. name: ${board_name}_Voltage
  98. icon: mdi:flash-circle
  99. unit_of_measurement: 'V'
  100. filters:
  101. - multiply: 1.92
  102. power:
  103. name: ${board_name}_Power
  104. icon: mdi:flash-outline
  105. unit_of_measurement: 'W'
  106. filters:
  107. - multiply: 2.14
  108. update_interval: 10s
  109.  
  110. - platform: uptime
  111. name: ${board_name}_Uptime_s
  112. id: uptime_sensor
  113.  
  114. - platform: wifi_signal
  115. name: ${board_name}_WiFi_RSSI
  116. update_interval: 60s
  117.  
  118. text_sensor:
  119. - platform: template
  120. name: ${board_name}_Uptime
  121. lambda: |-
  122. uint32_t dur = id(uptime_sensor).state;
  123. int dys = 0;
  124. int hrs = 0;
  125. int mnts = 0;
  126. if (dur > 86399) {
  127. dys = trunc(dur / 86400);
  128. dur = dur - (dys * 86400);
  129. }
  130. if (dur > 3599) {
  131. hrs = trunc(dur / 3600);
  132. dur = dur - (hrs * 3600);
  133. }
  134. if (dur > 59) {
  135. mnts = trunc(dur / 60);
  136. dur = dur - (mnts * 60);
  137. }
  138. char buffer[17];
  139. sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
  140. return {buffer};
  141. icon: mdi:clock-start
  142. update_interval: 15s
  143.  
  144. time:
  145. - platform: homeassistant
  146. id: homeassistant_time
Add Comment
Please, Sign In to add comment