Skip to content

RPI smart meter hub

sudo -s

lsusb

The following devices appear on the Raspberry:

  • Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
  • Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
  • Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
  • Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

we need the ID 0403:6001, this is the USB cable that is connected to the smart meter.

Zwave.me

installation manual

Smartmeter 2 MQTT

smartmeter2mqtt

sudo npm i -g smartmeter2mqtt --production

Make sure you are running the correct node.js version (102, v17) the correct node version can be used using nvm.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install 17
nvm use 17

Create a service

nano /lib/systemd/system/smartmeter2mqtt.service

[Unit]
Description=Smartmeter2mqtt

[Service]
RemainAfterExit=yes
ExecStart=/usr/local/bin/smartmeter2mqtt --port /dev/ttyUSB0 --web-server 80 --mqtt-url mqtt://smartmeter:smartmeter01@mqtt.loevencloud.nl
Restart=always

[Install]
WantedBy=multi-user.target
sudo systemctl --system daemon-reload

sudo systemctl enable smartmeter2mqtt.service

sudo systemctl start smartmeter2mqtt.service

Command reference

Options: --port The serial port to read, P1 to serial usb, eg. '/dev/ttyUSB0' --socket The tcp socket to read, if reading from serial to network device, as host:port, like '192.168.0.3:3000' --web-server Expose webserver on this port [number] --post-url Post the results to this url --post-interval Seconds between posts [number] [default: 300] --post-json Post the data as json instead of form parameters [boolean] --mqtt-url Send the data to this mqtt server --mqtt-topic Use this topic prefix for all messages [default: "smartmeter"] --mqtt-distinct Publish data distinct to mqtt [boolean] --mqtt-distinct-fields A comma separated list of fields you want published distinct. [default: "currentTarrif,totalT1Use,totalT2Use,totalT1Delivered,totalT2Deliver ed,powerSn,currentUsage,currentDelivery"] --mqtt-discovery Emit auto-discovery message [boolean] --mqtt-discovery-prefix Autodiscovery prefix [default: "homeassistant"] --tcp-server Expose JSON TCP socket on this port [number] --raw-tcp-server Expose RAW TCP socket on this port [number] --debug Enable debug output [boolean] --sunspec-modbus IP of solar inverter with modbus TCP enabled --sunspec-modbus-port modbus TCP port [number] [default: 502] --version Show version number [boolean] -h, --help Show help [boolean]

smartmeter2mqtt --port /dev/ttyUSB0 --web-server 80 --mqtt-url mqtt://mqtt.loevencloud.nl --debug

MQTT

Dynamic Access

create a client:

mosquitto_ctrl -u admin dynsec createClient (username)