Created
July 11, 2020 05:44
-
-
Save christhehoff/342423a4ee769458461be0a24cdbe4e8 to your computer and use it in GitHub Desktop.
ESPHome based power meter for EM5100 "smart" meters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: esphome_power_meter | |
platform: ESP8266 | |
board: nodemcuv2 | |
wifi: | |
ssid: SSID | |
password: PASSWORD | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "Esphome Power Meter" | |
password: "SDAFLKHJ@#(*R&ASDFLHJK" | |
captive_portal: | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
password: "secret" | |
ota: | |
password: "secret" | |
sensor: | |
# This is the LDR Light sensor on the "wH" port - this flashses for both IMPORT and EXPORT | |
- platform: pulse_counter | |
name: 'Import Export Power Meter' | |
id: 'impexp_power' | |
pin: GPIO5 | |
unit_of_measurement: 'kW' | |
filters: | |
# Convert pulses per minutes into kW | |
- multiply: 0.06 | |
update_interval: 30s | |
# This is the IR sensor on the "TEST" port - flahses for power IMPORT only | |
- platform: pulse_counter | |
name: 'Import Power Meter' | |
id: 'import_power' | |
pin: GPIO4 | |
unit_of_measurement: 'kW' | |
filters: | |
# Convert pulses per minutes into kW | |
- multiply: 0.06 | |
update_interval: 30s | |
# Derived sensor for EXPORT (=Total - IMPORT) | |
- platform: template | |
name: 'Export Power Meter' | |
id: 'export_power' | |
icon: mdi:pulse | |
unit_of_measurement: 'kW' | |
lambda: !lambda |- | |
if (id(import_power).state > id(impexp_power).state) { | |
return 0.0; | |
} else { | |
return id(impexp_power).state - id(import_power).state; | |
} | |
update_interval: 30s | |
# Now for the daily totals | |
- platform: total_daily_energy | |
name: "Total Daily Import Energy" | |
power_id: import_power | |
icon: mdi:transmission-tower | |
accuracy_decimals: 2 | |
- platform: total_daily_energy | |
name: "Total Daily Export Energy" | |
power_id: export_power | |
icon: mdi:solar-power | |
accuracy_decimals: 2 | |
# Report on signal strength - useful for when its outside in a faraday cage | |
- platform: wifi_signal | |
name: "Power Meter WiFi Signal Sensor" | |
update_interval: 60s | |
- platform: adc | |
pin: VCC | |
name: “Power Meter Battery Voltage” | |
update_interval: 60s | |
time: | |
- platform: homeassistant | |
id: homeassistant_time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment