Free a raspberrypi powermeter [part 1]
My Powermeter is unfortunately in the Hallway outside my apartment. To get Readouts from the old Ferraris-Meter I found a cheap solution. It’s an “Energiespar Ampel”[EM-Dis-1-TW-BS-R2] from eQ-3 I got for 15€ on ebay. In general, it’s just a Rebranded ELV Homematic HM-ES-TX-WM with an optical Ferraris-Sensor but with a Receiver unit that displays some Power statistics. It is Battery powered and is sending out all the data on 868.3MHz Frequency roughly every 2-3 minutes according to the manual. The current setup is a RaspberryPi 3b with a nanoCUL stick as a receiver and fhem as the interpreter.
The goal was to get rid of this Pi that has also a second use case to communicate with my BLE body scale. The solution to this will be in Part 2.
SDR - SoftwareDefinedRadio
I could have used the nanoCul on my Thinclient and relocate everything on that one, but the nanoCUL seems a bit flimsy. The Better option I found was an old DVB-T/DAB/FM USB Stick that has a Realtek RTL2832U Chipset. These sticks are commonly used as an SDR Stick for amateur radio operators. It can be used with Airspy SDRSharp Software to look around for interesting signals on the Waterfall plot.
RTL_433
Decoding the signals is quite easy with a Project called rtl_433 that, despite its name, is also capable to decode different frequencies besides from 433MHz. For testing, I first plugged it into my Mac Mini and used Homebrew to “brew install rtl_433”. After fiddling around with the command line settings, I settled on “rtl_433 -f 868.3M -R 117” which will start listening on 868.3MHz for Protocol 117 that is looking for ESA1000 / ESA2000 Energy Monitor signals. And soon I got my first result from my Powermeter:

Final Setup with Docker
I very much love Docker and fortunately there is also a Docker Container for rtl_433. This Container will run on my Thinclient that handles every hosted service on my Network. With lsusb I found out that the RTL2838 DVB-T Stick is Plugged in BUS001 as Device 005 with the ID 0bda:2838. The ThinClient is completely setup and maintained by my Ansible Playbook, where I also added the rtl_433 container with the settings for the MQTT Broker.
- name: Rtl_433
community.docker.docker_container:
name: rtl_433
state: started
image: hertzg/rtl_433
pull: true
restart_policy: unless-stopped
command: -f 868.3M -R 117 -F "mqtt://MQTTIP:1883,retain=0,devices=rtl_433[/id]"
devices:
- "/dev/bus/usb/001/005"
Right after the Container was set up, I got the first MQTT messages.
Unfortunately, in the dataset is no information about how much actual W were used in the last period. This needs to be calculated and was calculated before by fhem. It is quite easy in theory, but it took me a while to implement it in OpenHab. To calculate the Power we need to divide the used kWh between the last two messages, divide it by the time difference between the messages. This Value is then multiplied by 3600s to get kW. [kWhDiff/timeDiff*3600]
Getting this to work in Openhab took a while, but after a bit of googling and some trial and error, I got it working:
rule "Calculate Watt"
when
Item Strom_raw_total changed
then
//Strom_lastTime.postUpdate(Strom_raw_total.lastUpdate.toInstant().toEpochMilli()) //since the new item was empty from the beginning i manually initialised it once!
val time_interval = (Strom_raw_total.lastUpdate.toInstant().toEpochMilli() - Strom_lastTime.state as DecimalType) / 1000 // convert time interval to seconds
Strom_Timediff.postUpdate(time_interval)
Strom_lastTime.postUpdate(Strom_raw_total.lastUpdate.toInstant().toEpochMilli()) //save last timestamp
val watt_value = (Strom_raw_total.state as DecimalType - Strom_raw_total.previousState(true).state as DecimalType) / time_interval * 3600 // convert kWh/s to kW
Strom_actual.postUpdate(watt_value)
end
So every time when the total kWh changes, it calculates the time difference and then the actual kW. Saving the last timestamp gave me some errors, with the newly created item being initialized with NULL. To fix that, I had to run the rule manually with The first line of code active to initialize it.
Now everything is running as it was before with the fhem Setup.