Added espHome yaml configuration file - alternative to arduino firmware implementation.
This commit is contained in:
parent
d47c4c3c1c
commit
ea376846f5
1 changed files with 146 additions and 0 deletions
146
esphome_firmware/weatherstation.yml
Normal file
146
esphome_firmware/weatherstation.yml
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
esphome:
|
||||||
|
name: weatherstation
|
||||||
|
platform: ESP8266
|
||||||
|
board: d1_mini
|
||||||
|
|
||||||
|
i2c:
|
||||||
|
- id: bus_a
|
||||||
|
sda: 4 # D2
|
||||||
|
scl: 5 # D1
|
||||||
|
scan: true
|
||||||
|
|
||||||
|
apds9960:
|
||||||
|
address: 0x39
|
||||||
|
update_interval: 300s
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
#
|
||||||
|
#################### wind sensor
|
||||||
|
- platform: pulse_counter
|
||||||
|
pin:
|
||||||
|
# pin D8
|
||||||
|
number: GPIO15
|
||||||
|
mode: INPUT_PULLUP # TODO check if required
|
||||||
|
unit_of_measurement: 'm/s' ##change to m/s if metric
|
||||||
|
name: 'wind_speed'
|
||||||
|
icon: 'mdi:weather-windy'
|
||||||
|
id: my_wind
|
||||||
|
count_mode:
|
||||||
|
rising_edge: DISABLE
|
||||||
|
falling_edge: INCREMENT
|
||||||
|
internal_filter: 50us
|
||||||
|
update_interval: 300s
|
||||||
|
#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
|
||||||
|
|
||||||
|
#################### apds9960 sensor i2c
|
||||||
|
- platform: apds9960
|
||||||
|
type: CLEAR
|
||||||
|
name: "APDS9960_clear_channel"
|
||||||
|
|
||||||
|
- platform: bme280
|
||||||
|
temperature:
|
||||||
|
name: "BME280_temperature"
|
||||||
|
id: bme280_temperature
|
||||||
|
pressure:
|
||||||
|
name: "BME280_ressure"
|
||||||
|
id: bme280_pressure
|
||||||
|
humidity:
|
||||||
|
name: "BME280 Relative Humidity"
|
||||||
|
id: bme280_humidity
|
||||||
|
address: 0x76
|
||||||
|
update_interval: 300s
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "altitude"
|
||||||
|
lambda: |-
|
||||||
|
const float STANDARD_SEA_LEVEL_PRESSURE = 1013.25; //in hPa, see note
|
||||||
|
return ((id(bme280_temperature).state + 273.15) / 0.0065) *
|
||||||
|
(powf((STANDARD_SEA_LEVEL_PRESSURE / id(bme280_pressure).state), 0.190234) - 1); // in meter
|
||||||
|
update_interval: 300s
|
||||||
|
icon: 'mdi:signal'
|
||||||
|
unit_of_measurement: 'm'
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "absolute_humidity"
|
||||||
|
lambda: |-
|
||||||
|
const float mw = 18.01534; // molar mass of water g/mol
|
||||||
|
const float r = 8.31447215; // Universal gas constant J/mol/K
|
||||||
|
return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) /
|
||||||
|
(id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) /
|
||||||
|
((273.15 + id(bme280_temperature).state) * r); // in grams/m^3
|
||||||
|
accuracy_decimals: 2
|
||||||
|
update_interval: 300s
|
||||||
|
icon: 'mdi:water'
|
||||||
|
unit_of_measurement: 'g/m³'
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "dew_point"
|
||||||
|
lambda: |-
|
||||||
|
return (243.5*(log(id(bme280_humidity).state/100)+((17.67*id(bme280_temperature).state)/
|
||||||
|
(243.5+id(bme280_temperature).state)))/(17.67-log(id(bme280_humidity).state/100)-
|
||||||
|
((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state))));
|
||||||
|
unit_of_measurement: °C
|
||||||
|
update_interval: 300s
|
||||||
|
icon: 'mdi:thermometer-alert'
|
||||||
|
|
||||||
|
# battery power adc
|
||||||
|
- platform: adc
|
||||||
|
pin: A0
|
||||||
|
name: "battery_power"
|
||||||
|
update_interval: 300s
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
# battery charged pin
|
||||||
|
- platform: gpio
|
||||||
|
pin:
|
||||||
|
number: 12 # D6
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: false
|
||||||
|
name: "battery_charged"
|
||||||
|
|
||||||
|
# battery charging pin
|
||||||
|
- platform: gpio
|
||||||
|
pin:
|
||||||
|
number: 14 # D5
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: false
|
||||||
|
name: "battery_charging"
|
||||||
|
|
||||||
|
time:
|
||||||
|
- platform: sntp
|
||||||
|
id: my_time
|
||||||
|
|
||||||
|
# Enable logging
|
||||||
|
logger:
|
||||||
|
|
||||||
|
# Enable Home Assistant API
|
||||||
|
api:
|
||||||
|
|
||||||
|
ota:
|
||||||
|
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
ssid: UPC4556888
|
||||||
|
password: emmydhvZ4faw
|
||||||
|
manual_ip:
|
||||||
|
# Set this to the IP of the ESP
|
||||||
|
static_ip: 192.168.0.91
|
||||||
|
# Set this to the IP address of the router. Often ends with .1
|
||||||
|
gateway: 192.168.0.1
|
||||||
|
# The subnet of the network. 255.255.255.0 works for most home networks.
|
||||||
|
subnet: 255.255.255.0
|
||||||
|
|
||||||
|
captive_portal:
|
Loading…
Reference in a new issue