For those who want to use P1 Monitor, it is possible to use my P1 reader (WiFi and Ethernet). Especially if you don’t want to have a Raspberry Pi in the meter cupboard, or other reasons. To map the P1 reader to the /dev/ttyUSB0, I use socat. To use socat, you have to install it and configure it.
Installing and configuring socat in P1 Monitor
First start with installing the service:
$ sudo apt install socat
Once installed, you have to make a configuration/service-file for it. nUse your favourite editor to make the socat.service file (for me it’s vi, or nano):
$ sudo vi /etc/systemd/system/socat.service or $ sudo nano /etc/systemd/system/socat.service
Fill in the following content. Note that you need to fill in the ip-address of the P1 reader. Preferable a fixed ip:
[Unit] Description=Socat Serial Loopback [Service] Type=simple StandardOutput=syslog StandardError=syslog SyslogIdentifier=socat-serial-lo ExecStart=sudo /usr/bin/socat -T60 pty,link=/dev/ttyUSB0,rawer,group-late=dialout,mode=660 tcp:<ip-adres-device>:23.,retry=forever,interval=30 Restart=always RestartSec=2000ms [Install] WantedBy=multi-user.target
Save this socat.service file (“:wq” in vi and “<ctrl> + X” in nano, followed by “Y” and <enter>). Once it is saved, you have to reload the daemon, enable the new service (so it will start on (re)boot and start the service:
# Restart the daemon: $ sudo systemctl daemon-reload # Enable it on boot $ sudo systemctl enable socat.service # Start the service $ sudo systemctl start socat.service
Now there is one thing left: the user p1mon needs to have rights to read the serial device:
$ sudo usermod -a -G dialout p1mon
All set! you’re now able to use P1 Monitor to monitor your meter 🙂