Home Monitoring with eMonTX, ESP8266, OpenHAB and Friends

magnayn
magnayn
Jan 12, 2018 · 9 min read

Energy Monitoring

Dumb Meters

One of these? You’re in luck

eMonTX

Glue : ESP8266, MQTT

ESP8266; ESP-12E board

Nodes

Optical Sensors

Charts And Graphs To Back Us Up

import org.openhab.core.library.types.*
import java.util.Date
var long LastUpdateHouse = 0rule "House Meter"
when
Item CurrentHouse changed
then
// power = current watts in use
var Number power = CurrentHouse.state as DecimalType
var Number energyTotal = 0
var Number energyToday = 0
try {
energyTotal = MeterHouse.state as DecimalType
} catch(Exception ex) {
}try {
energyToday = MeterHouseToday.state as DecimalType
} catch(Exception ex) {
}var long currentTime = now.millisif( LastUpdateHouse != 0 ) {
var long timeElapsed = currentTime - LastUpdateHouse
if( timeElapsed > 0 ) {
var Number energyUsed = (power * timeElapsed) / 3600000
postUpdate(MeterHouse, energyTotal + energyUsed)
postUpdate(MeterHouseToday, energyToday + energyUsed)
postUpdate(MeterHouseUse, energyUsed)
}
}
LastUpdateHouse = currentTimeend

Charts!

Rocking 230V. Not.

Charts the better

Bring on the Fancy
Meters meters meters

Analytics

Heating

magnayn

Written by

magnayn

I don't exist when you don't see me.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade