Smartmeter2mqtt container with webserver and webrequest output setup
Introduction
Smartmeter2mqtt parses smart meter data over the network or through a P1 cable. I used it with a P1 reader connected to Home Assistant, MariaDB and InfluxDB 2.x. While the setup worked well, I decided not to rely too heavily on Home Assistant and aimed to create an interactive dashboard with Budibase.
I planned to save P1 reader data in QuestDB (though InfluxDB was also an option) using Smartmeter2mqtt and n8n. Despite the name “Smartmeter2mqtt,” I didn’t use MQTT, opting for the webrequest output and ensuring the web server was accessible.
For more details, check out the Smartmeter2mqtt GitHub page.
Setup
-
Create the folders needed by the container
Run the following commands inside your home folder:
-
Create the script needed to run the container
Save the following script as
smartmeter_run.sh
:Instructions:
- Optional Replace
docker
withpodman
if needed - Required Replace port number
3050
(on the left side of:
and after the settingSMARTMETER_web-server
) with a port number that is available if needed. This is the web server port - Required Replace
<P1 IP address>
with the IP address of the P1 reader. Port 23 is the default telnet port. For testing you could also connect via telnet for example by using Putty to view the P1 reader data - Required Replace
<post url>
with the webhook URL. For examplehttp://N8N_IP_ADDRESS:N8N_PORT/webhook/smartmeter
. This setting utilizes the webrequest output to send P1 reader data via a webhook, such as to n8n or Node-RED - Optional Replace
300
with another interval if needed. Now every 300 seconds the webrequest output will send P1 reader data via a webhook - Optional Add
-e SMARTMETER_post-json=false
if you want to use the webrequest output to send the P1 reader data via a webhook. By default the data is posted as form variables, if you want you can have it post as json. The only way this worked for me is by setting it to false - Optional Please note that I used the beta
svrooij/smartmeter:beta
because of, for example, the InfluxDB integration that you could possibly use. The beta version is stable for me - Required Replace
Europe/Amsterdam
with your own timezone. TheGENERIC_TIMEZONE
setting is used by for example the Cron-Node
- Optional Replace
-
Run the script to create the container
Run the following command:
The image
svrooij/smartmeter:beta
is automatically pulled and the container is created. -
Check the results
If needed you can check if the container is running properly.
You can view the webpage by opening a web browser and going to:
http://localhost:3050
. Replace localhost with the relevant IP address or FQDN if needed, and adjust the port if you changed it earlier.Now you can also configure an additional output, such as the webhook or MQTT.
No comments found for this note.
Join the discussion for this note on Github. Comments appear on this page instantly.