Browse Source

sensor value conversion

esphome
Hendrik Langer 3 years ago
parent
commit
d38f365f56
  1. 2
      common/base.yaml
  2. 4
      common/battery.yaml
  3. 31
      common/bme280.yaml
  4. 31
      common/bme680.yaml
  5. 2
      common/display.yaml
  6. 1
      hendrik-test.yaml
  7. 1
      sensor-outdoor.yaml
  8. 1
      sensor-springer.yaml
  9. 1
      sensor-sz.yaml
  10. 1
      sensor-wz.yaml

2
common/base.yaml

@ -4,7 +4,7 @@ esphome:
board: lolin_d32_pro board: lolin_d32_pro
project: project:
name: "xd0.esp32weatherstation2" name: "xd0.esp32weatherstation2"
version: "0.0.6" version: "0.0.7"
includes: includes:
- fonts/weather_icon_map.h - fonts/weather_icon_map.h
- custom/veml6075_custom_sensor.h - custom/veml6075_custom_sensor.h

4
common/battery.yaml

@ -7,3 +7,7 @@ sensor:
# filters: # filters:
# - lambda: return ( x/4096.0 ) * 2 * 3.42; # - lambda: return ( x/4096.0 ) * 2 * 3.42;
update_interval: 60s update_interval: 60s
#deep_sleep:
# run_duration: 30s
# sleep_duration: 10min

31
common/bme280.yaml

@ -12,3 +12,34 @@ sensor:
id: humidity id: humidity
address: 0x77 address: 0x77
update_interval: 60s update_interval: 60s
- platform: template
name: "${node_name} Equivalent sea level pressure"
id: pressure_sealevel
lambda: |-
const float STANDARD_ALTITUDE = ${altitude}; // in meters, see note
return id(pressure).state / powf(1 - ((0.0065 * STANDARD_ALTITUDE) /
(id(temperature).state + (0.0065 * STANDARD_ALTITUDE) + 273.15)), 5.257); // in hPa
update_interval: 60s
unit_of_measurement: 'hPa'
- platform: template
name: "${node_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(temperature).state) /
(id(temperature).state + 243.5)) * id(humidity).state * mw) /
((273.15 + id(temperature).state) * r); // in grams/m^3
accuracy_decimals: 2
update_interval: 60s
icon: 'mdi:water'
unit_of_measurement: 'g/m³'
- platform: template
name: "${node_name} Dew Point"
lambda: |-
return (243.5*(log(id(humidity).state/100)+((17.67*id(temperature).state)/
(243.5+id(temperature).state)))/(17.67-log(id(humidity).state/100)-
((17.67*id(temperature).state)/(243.5+id(temperature).state))));
accuracy_decimals: 1
update_interval: 60s
unit_of_measurement: °C
icon: 'mdi:thermometer-alert'

31
common/bme680.yaml

@ -53,6 +53,37 @@ sensor:
- median: - median:
window_size: 12 window_size: 12
send_every: 12 send_every: 12
- platform: template
name: "${node_name} Equivalent sea level pressure"
id: pressure_sealevel
lambda: |-
const float STANDARD_ALTITUDE = ${altitude}; // in meters, see note
return id(pressure).state / powf(1 - ((0.0065 * STANDARD_ALTITUDE) /
(id(temperature).state + (0.0065 * STANDARD_ALTITUDE) + 273.15)), 5.257); // in hPa
update_interval: 60s
unit_of_measurement: 'hPa'
- platform: template
name: "${node_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(temperature).state) /
(id(temperature).state + 243.5)) * id(humidity).state * mw) /
((273.15 + id(temperature).state) * r); // in grams/m^3
accuracy_decimals: 2
update_interval: 60s
icon: 'mdi:water'
unit_of_measurement: 'g/m³'
- platform: template
name: "${node_name} Dew Point"
lambda: |-
return (243.5*(log(id(humidity).state/100)+((17.67*id(temperature).state)/
(243.5+id(temperature).state)))/(17.67-log(id(humidity).state/100)-
((17.67*id(temperature).state)/(243.5+id(temperature).state))));
accuracy_decimals: 1
update_interval: 60s
unit_of_measurement: °C
icon: 'mdi:thermometer-alert'
text_sensor: text_sensor:
- platform: bme680_bsec - platform: bme680_bsec

2
common/display.yaml

@ -70,7 +70,7 @@ display:
if (id(temperature).state) { if (id(temperature).state) {
it.printf(2, 21+4, id(font2), COLOR_OFF, "%.1f", id(temperature).state); it.printf(55, 21+4, id(font1), COLOR_OFF, "°C"); it.printf(2, 21+4, id(font2), COLOR_OFF, "%.1f", id(temperature).state); it.printf(55, 21+4, id(font1), COLOR_OFF, "°C");
it.printf(2, 57+4, id(font2), COLOR_OFF, "%.1f", id(humidity).state); it.printf(55, 57+4, id(font1), COLOR_OFF, "%%"); it.printf(2, 57+4, id(font2), COLOR_OFF, "%.1f", id(humidity).state); it.printf(55, 57+4, id(font1), COLOR_OFF, "%%");
it.printf(2, 93+4, id(font2), COLOR_OFF, "%.0f", id(pressure).state); it.printf(55, 93+4, id(font1), COLOR_OFF, "hPa"); it.printf(2, 93+4, id(font2), COLOR_OFF, "%.0f", id(pressure_sealevel).state); it.printf(55, 93+4, id(font1), COLOR_OFF, "hPa");
it.graph(70, 21, id(temperature_graph)); it.graph(70, 21, id(temperature_graph));
it.graph(70, 57, id(humidity_graph)); it.graph(70, 57, id(humidity_graph));
it.graph(70, 93, id(pressure_graph)); it.graph(70, 93, id(pressure_graph));

1
hendrik-test.yaml

@ -1,5 +1,6 @@
substitutions: substitutions:
node_name: hendrik-test node_name: hendrik-test
altitude: "111"
packages: packages:
base: !include common/base.yaml base: !include common/base.yaml

1
sensor-outdoor.yaml

@ -1,5 +1,6 @@
substitutions: substitutions:
node_name: sensor-outdoor node_name: sensor-outdoor
altitude: "30"
packages: packages:
base: !include common/base.yaml base: !include common/base.yaml

1
sensor-springer.yaml

@ -1,5 +1,6 @@
substitutions: substitutions:
node_name: sensor-springer node_name: sensor-springer
altitude: "30"
packages: packages:
base: !include common/base.yaml base: !include common/base.yaml

1
sensor-sz.yaml

@ -1,5 +1,6 @@
substitutions: substitutions:
node_name: sensor-sz node_name: sensor-sz
altitude: "30"
packages: packages:
base: !include common/base.yaml base: !include common/base.yaml

1
sensor-wz.yaml

@ -1,5 +1,6 @@
substitutions: substitutions:
node_name: sensor-wz node_name: sensor-wz
altitude: "30"
packages: packages:
base: !include common/base.yaml base: !include common/base.yaml

Loading…
Cancel
Save