Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: pokus2
- platform: ESP8266
- board: nodemcuv2
- wifi:
- ssid: '***********'
- password: '***************'
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "Meteo Fallback Hotspot"
- password: "Zaloha1234"
- captive_portal:
- # Enable logging
- logger:
- api:
- ota:
- i2c:
- frequency: 100kHz #try for longer distance - currently works at 50' - 1 pair per 5v, Gnd, SDA, SCL
- sensor:
- - platform: pulse_counter ##anemometr
- pin:
- # pin D5
- number: GPIO14
- mode: INPUT_PULLUP
- unit_of_measurement: 'm/s' ##change to m/s if metric
- name: 'Anemometr'
- icon: 'mdi:weather-windy'
- id: my_wind
- count_mode:
- rising_edge: DISABLE
- falling_edge: INCREMENT
- internal_filter: 50us
- update_interval: 15s
- #rotations_per_sec = pulses/2/60
- #circ_m=0.09*2*3.14 = 0.5652
- #mps = 1.18*circ_m*rotations_per_sec
- #mps = 1.18*0.5652/2/60 =0,0055578
- filters:
- - multiply: 0.0055578 #use for m/s
- # - multiply: 2.237 #m/s to mph
- # - sliding_window_moving_average:
- # window_size: 4
- # send_every: 1
- # - multiply: 0.04973 #1.492mph switch to close 1/sec per spec, pulse/sec (/60/2)*1.492
- # - multiply: 0.0124327986 #m/s * mph conversion
- - platform: adc
- id: adc_sensor
- pin: A0
- name: ADC
- internal: true
- update_interval: 10s
- filters:
- accuracy_decimals: 3 ##IMPORTANT to get resolution for resistance sensor
- - platform: resistance
- sensor: adc_sensor
- id: resistance_sensor
- configuration: DOWNSTREAM
- resistor: 10kOhm
- internal: true
- name: 'smer vetru'
- accuracy_decimals: 1
- on_value:
- - if:
- condition:
- sensor.in_range:
- id: resistance_sensor
- above: 3100
- below: 3200
- then:
- - text_sensor.template.publish:
- id: wind_dir_card
- state: "S"
- - sensor.template.publish:
- id: wind_heading
- state: 0.0
- - if:
- condition:
- sensor.in_range:
- id: resistance_sensor
- above: 1600
- below: 1700
- then:
- - text_sensor.template.publish:
- id: wind_dir_card
- state: "SV"
- - sensor.template.publish:
- id: wind_heading
- state: 45.0
- - if:
- condition:
- sensor.in_range:
- id: resistance_sensor
- above: 250
- below: 350
- then:
- - text_sensor.template.publish:
- id: wind_dir_card
- state: "V"
- - sensor.template.publish:
- id: wind_heading
- state: 90.0
- - if:
- condition:
- sensor.in_range:
- id: resistance_sensor
- above: 550
- below: 650
- then:
- - text_sensor.template.publish:
- id: wind_dir_card
- state: "JV"
- - sensor.template.publish:
- id: wind_heading
- state: 135.0
- - if:
- condition:
- sensor.in_range:
- id: resistance_sensor
- above: 900
- below: 1100
- then:
- - text_sensor.template.publish:
- id: wind_dir_card
- state: "J"
- - sensor.template.publish:
- id: wind_heading
- state: 180.0
- - if:
- condition:
- sensor.in_range:
- id: resistance_sensor
- above: 2300
- below: 2450
- then:
- - text_sensor.template.publish:
- id: wind_dir_card
- state: "JZ"
- - sensor.template.publish:
- id: wind_heading
- state: 225.0
- - if:
- condition:
- sensor.in_range:
- id: resistance_sensor
- above: 3900
- below: 4100
- then:
- - text_sensor.template.publish:
- id: wind_dir_card
- state: "Z"
- - sensor.template.publish:
- id: wind_heading
- state: 270.0
- - if:
- condition:
- sensor.in_range:
- id: resistance_sensor
- above: 3500
- below: 3800
- then:
- - text_sensor.template.publish:
- id: wind_dir_card
- state: "SZ"
- - sensor.template.publish:
- id: wind_heading
- state: 315.0
- - platform: template
- name: "Směr větru ve stupních"
- id: wind_heading
- unit_of_measurement: "°"
- # - platform: wifi_signal
- # name: "WiFi Signal anemometr"
- # update_interval: 60s
- text_sensor:
- - platform: template
- name: "Směr větru"
- id: wind_dir_card
Advertisement
Add Comment
Please, Sign In to add comment