Guest User

Untitled

a guest
Jun 1st, 2020
624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.89 KB | None | 0 0
  1. esphome:
  2. name: efs
  3. platform: ESP32
  4. board: esp32dev
  5.  
  6. wifi:
  7. ssid: !secret esphome_ssid
  8. password: !secret esphome_password
  9.  
  10. # Enable logging
  11. logger:
  12.  
  13. # Enable Home Assistant API
  14. api:
  15.  
  16. ota:
  17.  
  18. time:
  19. #- platform: sntp
  20. # id: my_time
  21.  
  22. - platform: homeassistant
  23. id: homeassistant_time
  24.  
  25. on_time:
  26. - seconds: 57
  27. minutes: 59
  28. hours: 23
  29. then:
  30. - sensor.template.publish:
  31. id: template_efs_veille
  32. state: !lambda return id(daily_efs).state;
  33.  
  34.  
  35. i2c:
  36. - sda: GPIO21
  37. scl: GPIO22
  38. id: i2c_bus1
  39.  
  40. switch:
  41. - platform: restart
  42. name: "restart_efs"
  43.  
  44.  
  45. sensor:
  46.  
  47. - platform: adc
  48. id: sensor_resistance
  49. pin: GPIO032
  50. update_interval: 10s
  51. attenuation: 0db
  52.  
  53. - platform: resistance
  54. sensor: sensor_resistance
  55. configuration: UPSTREAM
  56. resistor: 10.0kOhm
  57. accuracy_decimals: 2
  58. name: resistance_efs
  59. id: resistance_efs
  60. icon: mdi:resistor
  61.  
  62. #- platform: ntc
  63. # sensor: sensor_resistance
  64. # #calibration:
  65. # # b_constant: 3950
  66. # # reference_temperature: 25°C
  67. # # reference_resistance: 50kOhm
  68. # calibration:
  69. # - 200.720kOhm -> 6.0°C
  70. # - 57.094kOhm -> 22.0°C
  71. # - 28.766kOhm -> 37.0°C
  72. # name: temperature_efs
  73. # unit_of_measurement: "°C"
  74. # icon: "mdi:water-percent"
  75. # accuracy_decimals: 2
  76.  
  77.  
  78. - platform: template
  79. name: temperature_efs
  80. unit_of_measurement: "°C"
  81. icon: "mdi:water-percent"
  82. accuracy_decimals: 2
  83. update_interval: 10s
  84. filters:
  85. - sliding_window_moving_average:
  86. window_size: 7
  87. send_every: 1
  88. lambda: |-
  89. float A = -0.0023372161946098318;
  90. float B = 0.0006789562966514373;
  91. float C = -1.3022483012452408e-06;
  92. float LR = log(id(resistance_efs).state);
  93. return (1.0/(A + B*LR + C*LR*LR*LR) - 273.15);
  94.  
  95. - platform: bme280
  96. i2c_id: i2c_bus1
  97. temperature:
  98. name: "temperature_cuisine"
  99. oversampling: 16x
  100. id: temperature_cuisine
  101. pressure:
  102. name: "pression_cuisine"
  103. id: pression_cuisine
  104. unit_of_measurement: "bar"
  105. accuracy_decimals: 3
  106. filters:
  107. - lambda: return x / 1000.0;
  108. humidity:
  109. name: "humidite_cuisine"
  110. id: humidite_cuisine
  111. address: 0x76
  112. update_interval: 10s
  113.  
  114.  
  115. - platform: adc
  116. pin: GPIO34
  117. name: "pression_efs_amont"
  118. id: pression_efs_amont
  119. update_interval: 10s
  120. unit_of_measurement: "bar"
  121. icon: mdi:gauge
  122. accuracy_decimals: 3
  123. attenuation: 11db
  124. filters:
  125. - sliding_window_moving_average:
  126. window_size: 7
  127. send_every: 1
  128. - lambda: return ((x/5.0 - 0.1)*1.333333*10); #((x - 0.1)*1.333333*(10/6.4)); #2 # ((x/5.0 - 0.1)*1.333333*10)
  129.  
  130.  
  131. - platform: adc
  132. pin: GPIO35
  133. name: "pression_efs_aval"
  134. id: pression_efs_aval
  135. update_interval: 10s
  136. unit_of_measurement: "bar"
  137. icon: mdi:gauge
  138. accuracy_decimals: 3
  139. attenuation: 11db
  140. filters:
  141. - sliding_window_moving_average:
  142. window_size: 7
  143. send_every: 1
  144. - lambda: return ((x/5.0 - 0.1)*1.333333*10); #((x - 0.1)*1.333333*(10/7.5)); #4
  145.  
  146.  
  147.  
  148. - platform: pulse_counter
  149. id: water_flow_meter
  150. pin: GPIO15
  151. name: "water_flow_meter"
  152. update_interval: 1s
  153. icon: mdi:water
  154. filters:
  155. - lambda: return (x / 5.48);
  156. unit_of_measurement: "l"
  157.  
  158. - platform: total_daily_energy
  159. name: "efs_du_jour"
  160. power_id: water_flow_meter
  161. unit_of_measurement: "l"
  162. accuracy_decimals: 2
  163. id: daily_efs
  164.  
  165. - platform: template
  166. name: "efs_veille"
  167. id: template_efs_veille
  168. unit_of_measurement: "l"
  169. accuracy_decimals: 2
  170. icon: mdi:water
  171. update_interval: 10s
  172.  
  173. - platform: wifi_signal
  174. name: "WiFi puissance_efs"
  175. update_interval: 10s
  176.  
  177. - platform: uptime
  178. name: "up"
  179. id: uptime_sec
  180.  
  181.  
  182. binary_sensor:
  183. - platform: status
  184. name: "efs_status"
  185.  
  186. - platform: template
  187. name: filtre_efs
  188. lambda: |-
  189. if (abs(id(pression_efs_aval).state - id(pression_efs_amont).state) < 0.8) {
  190. // Changement de filtre
  191. return true;
  192. } else {
  193. // filtre ok
  194. return false;
  195. }
  196.  
  197.  
  198. text_sensor:
  199. - platform: template
  200. name: efs_uptime
  201. lambda: |-
  202. int seconds = (id(uptime_sec).state);
  203. int days = seconds / (24 * 3600);
  204. seconds = seconds % (24 * 3600);
  205. int hours = seconds / 3600;
  206. seconds = seconds % 3600;
  207. int minutes = seconds / 60;
  208. seconds = seconds % 60;
  209. return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
  210. icon: mdi:clock-start
  211. update_interval: 113s
Add Comment
Please, Sign In to add comment