Guest User

Untitled

a guest
Jul 17th, 2023
1,023
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.59 KB | Source Code | 0 0
  1. esphome:
  2. name: hvacmonitor
  3. friendly_name: HVAC Monitor
  4.  
  5. esp32:
  6. board: esp32dev
  7. framework:
  8. type: arduino
  9.  
  10. # Enable logging
  11. logger:
  12.  
  13. # Enable Home Assistant API
  14. api:
  15. encryption:
  16. key: "CoIiyphdAMtXRKyVSBWAR9qfaApz8k4giUEwgJkUhY8="
  17.  
  18. ota:
  19. password: "f5e0e287db86c78da61c4995b0d1e999"
  20.  
  21. wifi:
  22. ssid: !secret wifi_ssid
  23. password: !secret wifi_password
  24.  
  25. # Enable fallback hotspot (captive portal) in case wifi connection fails
  26. ap:
  27. ssid: "Hvacmonitor Fallback Hotspot"
  28. password: "R6fpenQBvuhX"
  29.  
  30. i2c:
  31. - id: "bus_a"
  32. sda: GPIO23
  33. scl: GPIO33
  34. scan: true
  35. - id: "bus_b"
  36. sda: GPIO19
  37. scl: GPIO32
  38. scan: true
  39.  
  40. bme680_bsec:
  41. - id: hvac_in
  42. i2c_id: "bus_a"
  43. address: 0x77
  44. - id: hvac_out
  45. i2c_id: "bus_b"
  46. address: 0x77
  47.  
  48. captive_portal:
  49. sensor:
  50. - platform: bme680_bsec
  51. bme680_bsec_id: hvac_in
  52. temperature:
  53. name: "HVAC Intake Temperature"
  54. pressure:
  55. name: "HVAC Intake Pressure"
  56. id: pre1
  57. humidity:
  58. name: "HVAC Intake Humidity"
  59. id: hum1
  60. iaq:
  61. name: "HVAC Intake IAQ"
  62. id: iaq
  63. co2_equivalent:
  64. name: "HVAC Intake CO2 Equivalent"
  65. gas_resistance:
  66. name: "BME680 Gas Resistance"
  67. id: gr_in
  68. breath_voc_equivalent:
  69. name: "HVAC Intake Breath VOC Equivalent"
  70.  
  71. - platform: bme680_bsec
  72. bme680_bsec_id: hvac_out
  73. temperature:
  74. name: "HVAC Out Temperature"
  75. pressure:
  76. name: "HVAC Out Pressure"
  77. id: pre2
  78. humidity:
  79. name: "HVAC Out Humidity"
  80. id: hum2
  81. iaq:
  82. name: "HVAC Out IAQ"
  83. id: iaq2
  84. co2_equivalent:
  85. name: "HVAC Out CO2 Equivalent"
  86. gas_resistance:
  87. name: "BME680 Gas Resistance"
  88. id: gr_out
  89. breath_voc_equivalent:
  90. name: "HVAC Out Breath VOC Equivalent"
  91.  
  92. - platform: dht
  93. pin: GPIO18
  94. temperature:
  95. name: "Sensor Board Temperature"
  96. humidity:
  97. name: "Sensor Board Humidity"
  98. update_interval: 5s
  99.  
  100. - platform: template
  101. name: "BME680 IAQ"
  102. id: IAQ
  103. unit_of_measurement: IAQ
  104. lambda: 'return log(id(gr_in).state) + 0.04 * id(hum1).state;'
  105.  
  106. - platform: template
  107. name: "BME680 IAQ2"
  108. id: IAQ2
  109. unit_of_measurement: IAQ
  110. lambda: 'return log(id(gr_out).state) + 0.04 * id(hum2).state;'
  111. text_sensor:
  112.  
  113.  
  114. - platform: bme680_bsec
  115. bme680_bsec_id: hvac_in
  116. iaq_accuracy:
  117. name: "HVAC Intake IAQ Accuracy"
  118.  
  119. - platform: bme680_bsec
  120. bme680_bsec_id: hvac_out
  121. iaq_accuracy:
  122. name: "HVAC Out IAQ Accuracy"
  123.  
  124. - platform: template
  125. name: "HVAC Intake IAQ Classification"
  126. icon: "mdi:checkbox-marked-circle-outline"
  127. lambda: |-
  128. if ( int(id(iaq).state) <= 50) {
  129. return {"Excellent"};
  130. }
  131. else if (int(id(iaq).state) >= 51 && int(id(iaq).state) <= 100) {
  132. return {"Good"};
  133. }
  134. else if (int(id(iaq).state) >= 101 && int(id(iaq).state) <= 150) {
  135. return {"Lightly polluted"};
  136. }
  137. else if (int(id(iaq).state) >= 151 && int(id(iaq).state) <= 200) {
  138. return {"Moderately polluted"};
  139. }
  140. else if (int(id(iaq).state) >= 201 && int(id(iaq).state) <= 250) {
  141. return {"Heavily polluted"};
  142. }
  143. else if (int(id(iaq).state) >= 251 && int(id(iaq).state) <= 350) {
  144. return {"Severely polluted"};
  145. }
  146. else if (int(id(iaq).state) >= 351) {
  147. return {"Extremely polluted"};
  148. }
  149. else {
  150. return {"error"};
  151. }
  152.  
  153. - platform: template
  154. name: "HVAC Out IAQ Classification"
  155. icon: "mdi:checkbox-marked-circle-outline"
  156. lambda: |-
  157. if ( int(id(iaq2).state) <= 50) {
  158. return {"Excellent"};
  159. }
  160. else if (int(id(iaq2).state) >= 51 && int(id(iaq2).state) <= 100) {
  161. return {"Good"};
  162. }
  163. else if (int(id(iaq2).state) >= 101 && int(id(iaq2).state) <= 150) {
  164. return {"Lightly polluted"};
  165. }
  166. else if (int(id(iaq2).state) >= 151 && int(id(iaq2).state) <= 200) {
  167. return {"Moderately polluted"};
  168. }
  169. else if (int(id(iaq2).state) >= 201 && int(id(iaq2).state) <= 250) {
  170. return {"Heavily polluted"};
  171. }
  172. else if (int(id(iaq2).state) >= 251 && int(id(iaq2).state) <= 350) {
  173. return {"Severely polluted"};
  174. }
  175. else if (int(id(iaq2).state) >= 351) {
  176. return {"Extremely polluted"};
  177. }
  178. else {
  179. return {"error"};
  180. }
  181.  
  182. return (((id(temp_in).state)-(id(temp_out).state))*1.8)+32;
  183. return ((id(temp_in).state)*1.8)+32) - ((id(temp_out).state)*1.8)+32);
  184.  
Tags: ESPhome
Advertisement
Add Comment
Please, Sign In to add comment