Dutch DSMR smart meter with P1 port
Smart Meters allow grid operators and energy suppliers to remotely access your energy usage data. These meters primarily measure electricity usage, but they also allow up to four peripheral meters to be connected to them to include usage data from e.g. gas, city block heating, water. In some cases suppliers will allow their customers to view their own data through a web portal and at least in one case the supplier feeds back this information through a "free" device that replaces your room thermostat (Toon).
What makes these meters attractive is that they also report their data on a serial port that we can connect to and that this data contains the actual meter values. This means that you never need to adjust counter values because you missed a few pulses.
Smart Meter support has been part of Domoticz from the very beginning.
Of course they had to make things difficult, so the serial port on the Smart Meter is a RJ-11 ("phone connector") port and the signal is inverted. To connect the Smart Meter to Domoticz you therefore need a special serial to USB converter cable. Several ready made cables are available , but you can also create your own. Other options include using e.g. an Arduino board,ESP8266 or c.h.i.p. with ser2net to push the data from the Smart Meter onto the network, which gives you the advantage that your Domoticz server does not have to be close to the Smart Meter.
Adding the Smart Meter to Domoticz
For direct connection via USB:
Use the Domoticz 'Set-up'->'Hardware' menu and choose the 'P1 Smart Meter USB' device.
The baud rate is either 9600 or 115200, where 9600 is reserved for the first generation meters. Therefore, if you receive a new Smart Meter you should select 115200 here. You may also find a hint which to select on the meter itself: newer meters will typically have the protocol version they use stamped on the front, so if you see something like DSMR 4.x or ESMR 5.x printed there you need baud rate 115200. If you don't see either, select 9600. Of course you can also simply choose either one and if you don't see any data coming in select the other one.
For connection via ethernet:
Setup ser2net with the the baudrate found like the USB setup. Use the Domoticz 'Set-up'->'Hardware' menu and choose the 'P1 Smart Meter with LAN interface' device. Fill in the ip number and port ser2net host. and press "Add" now you have the same meters as with USB.
Not so Smart Meters
No data coming in after installation of new Smart Meter
First thing to look at is the baud rate. Is that set to the correct value? If your old meter worked with 9600 baud there is also a chance that your cable might be incorrect. The DIY manual states that you should install a 1K resistor between RXD and VCC(TX) and this appears to work well with the older meters, but the new meters require a fairly higher value for this resistor: 10K
Gas meter not reporting any data
When a gas meter is paired with the Smart Meter it gets assigned one of the four available channels. Normally Domoticz will be able to tune in to the correct channel, but sometimes technicians leave the old gas meter registered in the Smart Meter and Domoticz ends up selecting the dead gas meter for input. To fix this you can use a hidden feature in the P1 Smart Meter class that allows you to override the channel auto select mechanism. Go to the Domoticz 'Set-up'->'More Options'->'User Variables' menu and create a new 'integer' value named 'P1GasMeterChannel'. Allowed values are 0 which is the default and enables auto select, or 1 to 4 for either of the four possible channels. To activate the change you must restart the hardware class. For this, go to the Domoticz 'Set-up'->'Hardware' menu, select your P1 Smart Meter hardware and click on 'Update'. You may check the log to verify that the override is now active.