vejvik

ESPhome meteo Weather wind speed/wind heating

Jun 6th, 2022 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.18 KB | None | 0 0
  1. esphome:
  2. name: pokus2
  3. platform: ESP8266
  4. board: nodemcuv2
  5.  
  6. wifi:
  7. ssid: '***********'
  8. password: '***************'
  9.  
  10. # Enable fallback hotspot (captive portal) in case wifi connection fails
  11. ap:
  12. ssid: "Meteo Fallback Hotspot"
  13. password: "Zaloha1234"
  14.  
  15. captive_portal:
  16.  
  17. # Enable logging
  18. logger:
  19.  
  20.  
  21. api:
  22.  
  23. ota:
  24.  
  25. i2c:
  26. frequency: 100kHz #try for longer distance - currently works at 50' - 1 pair per 5v, Gnd, SDA, SCL
  27.  
  28. sensor:
  29. - platform: pulse_counter ##anemometr
  30. pin:
  31. # pin D5
  32. number: GPIO14
  33. mode: INPUT_PULLUP
  34. unit_of_measurement: 'm/s' ##change to m/s if metric
  35. name: 'Anemometr'
  36. icon: 'mdi:weather-windy'
  37. id: my_wind
  38. count_mode:
  39. rising_edge: DISABLE
  40. falling_edge: INCREMENT
  41. internal_filter: 50us
  42. update_interval: 15s
  43. #rotations_per_sec = pulses/2/60
  44. #circ_m=0.09*2*3.14 = 0.5652
  45. #mps = 1.18*circ_m*rotations_per_sec
  46. #mps = 1.18*0.5652/2/60 =0,0055578
  47. filters:
  48. - multiply: 0.0055578 #use for m/s
  49. # - multiply: 2.237 #m/s to mph
  50. # - sliding_window_moving_average:
  51. # window_size: 4
  52. # send_every: 1
  53. # - multiply: 0.04973 #1.492mph switch to close 1/sec per spec, pulse/sec (/60/2)*1.492
  54. # - multiply: 0.0124327986 #m/s * mph conversion
  55.  
  56. - platform: adc
  57. id: adc_sensor
  58. pin: A0
  59. name: ADC
  60. internal: true
  61. update_interval: 10s
  62. filters:
  63.  
  64. accuracy_decimals: 3 ##IMPORTANT to get resolution for resistance sensor
  65.  
  66. - platform: resistance
  67. sensor: adc_sensor
  68. id: resistance_sensor
  69. configuration: DOWNSTREAM
  70. resistor: 10kOhm
  71. internal: true
  72. name: 'smer vetru'
  73. accuracy_decimals: 1
  74.  
  75. on_value:
  76. - if:
  77. condition:
  78. sensor.in_range:
  79. id: resistance_sensor
  80. above: 3100
  81. below: 3200
  82. then:
  83. - text_sensor.template.publish:
  84. id: wind_dir_card
  85. state: "S"
  86. - sensor.template.publish:
  87. id: wind_heading
  88. state: 0.0
  89.  
  90. - if:
  91. condition:
  92. sensor.in_range:
  93. id: resistance_sensor
  94. above: 1600
  95. below: 1700
  96. then:
  97. - text_sensor.template.publish:
  98. id: wind_dir_card
  99. state: "SV"
  100. - sensor.template.publish:
  101. id: wind_heading
  102. state: 45.0
  103. - if:
  104. condition:
  105. sensor.in_range:
  106. id: resistance_sensor
  107. above: 250
  108. below: 350
  109. then:
  110. - text_sensor.template.publish:
  111. id: wind_dir_card
  112. state: "V"
  113. - sensor.template.publish:
  114. id: wind_heading
  115. state: 90.0
  116. - if:
  117. condition:
  118. sensor.in_range:
  119. id: resistance_sensor
  120. above: 550
  121. below: 650
  122. then:
  123. - text_sensor.template.publish:
  124. id: wind_dir_card
  125. state: "JV"
  126. - sensor.template.publish:
  127. id: wind_heading
  128. state: 135.0
  129. - if:
  130. condition:
  131. sensor.in_range:
  132. id: resistance_sensor
  133. above: 900
  134. below: 1100
  135. then:
  136. - text_sensor.template.publish:
  137. id: wind_dir_card
  138. state: "J"
  139. - sensor.template.publish:
  140. id: wind_heading
  141. state: 180.0
  142. - if:
  143. condition:
  144. sensor.in_range:
  145. id: resistance_sensor
  146. above: 2300
  147. below: 2450
  148. then:
  149. - text_sensor.template.publish:
  150. id: wind_dir_card
  151. state: "JZ"
  152. - sensor.template.publish:
  153. id: wind_heading
  154. state: 225.0
  155. - if:
  156. condition:
  157. sensor.in_range:
  158. id: resistance_sensor
  159. above: 3900
  160. below: 4100
  161. then:
  162. - text_sensor.template.publish:
  163. id: wind_dir_card
  164. state: "Z"
  165. - sensor.template.publish:
  166. id: wind_heading
  167. state: 270.0
  168. - if:
  169. condition:
  170. sensor.in_range:
  171. id: resistance_sensor
  172. above: 3500
  173. below: 3800
  174. then:
  175. - text_sensor.template.publish:
  176. id: wind_dir_card
  177. state: "SZ"
  178. - sensor.template.publish:
  179. id: wind_heading
  180. state: 315.0
  181.  
  182. - platform: template
  183. name: "Směr větru ve stupních"
  184. id: wind_heading
  185. unit_of_measurement: "°"
  186.  
  187.  
  188. # - platform: wifi_signal
  189. # name: "WiFi Signal anemometr"
  190. # update_interval: 60s
  191.  
  192. text_sensor:
  193. - platform: template
  194. name: "Směr větru"
  195. id: wind_dir_card
  196.  
  197.  
Advertisement
Add Comment
Please, Sign In to add comment