Introduction
If you have a Smart Meter (DSMR P1) and want to connect it to Home Assistant you can use MQTT to benefit from all the functionality. The Smart Meter Gateway from Smart Gateways is the preferred way to connect all smart electricity meters from Europe which use the DSMR or SMR standard and have a P1 port. This P1 port looks like an old telephone connection but has 6 pins instead of 4. The DSMR or SMR standard was first developed in the Netherlands and due to it’s success it was rolled out to the rest of Europe. Smart Gateways was one of the first companies who developed a device which you can connect to your smart meter using WiFi and use it with Home Assistant and many other Home Automation solutions.
The following countries can use these Smart Meter Gateways on their smart meters:
- Netherlands
- Belgium
- Sweden
- Denmark
- Finland
- Lithuania
- Switzerland
- Ireland
- more countries will follow
If you are not sure if your Smart Meter is compatible, ask your energy company if they can apply the DSMR / EFS2 / HAN P1 profile on your meter. EFS1 / HAN-NVE profiles are not compatible. These last profiles are using old standards. Sometimes energy companies can switch profiles of smart meters remotely so your smart meter is compatible.
The Smart Meter Gateway from Smart Gateways uses a different firmware for every country. More countries are added to the support list while more countries are rolling out these smart meters with P1 ports. If your country is not listed but you have a meter with P1 port, contact Smart Gateways and ask if you can test a Smart Meter Gateway. Be sure to use only devices from Smart Gateways while other devices are not supported and these manuals will not work. You can check their compatibility list if your meter is supported.
The Smart Meter Gateway uses MQTT Autodiscovery so when the gateway is connected to Home Assistant, all sensors are automatically added.
Connect your Smart Meter Gateway to Home Assistant with MQTT
Connecting your Smart Meter Gateway to Home Assistant using MQTT is quite easy. Just follow the steps from the installation manual which you can find on their support site. Connect the gateway to the smart meter and your wifi network. Login to the webserver of the gateway. You can find the default username and password in the installation manual.
- First make sure you installed the Mosquitto MQTT Broker on Home Assistant. You can use this manual.
- Login to the gateway using it’s ip address and port number 82
- http://ip_address_gateway:82 (replace ip_address_gateway with the actual ip address of the gateway. Check you dhcp server for the mac address found on the gateway)
- Go to the MQTT Menu and fill in the details of your mqtt broker (you can use the same details you used for MQTT Explorer)
- Port: 1883
- Don’t fill in a prefix. If you use a prefix, mqtt autodiscovery will not work!
- MQTT Interval: the gateway will send updates from your meter with a 10 second interval by default. If you want to change this enter a new interval in seconds
- Leave the Enable encryption checkbox unchecked
- Click Submit new values
4. The gateway will now reboot. This can take a minute. Wait for the gateway to come back online. Check if the gateway can connect to your broker. It can take 2 minutes to connect. The first try can fail. Just wait for a while till the second or third try is succesful.
- You can use MQTT Explorer to check if the Smart Meter Gateway is sending mqtt messages to your broker. MQTT Explorer is explained on the end of this instruction.
- If you see topics under dsmr then the gateway is connected. If all values are 0 than your gateway is not receiving data from the meter or you installed the wrong firmware for your country. Check the Smart Meter Compatibility page or Contact Smart Gateways if you need help on this issue.
Using the dsmr_reader Integration within Home Assistant
When you completed the above steps the final part is to get all the readings in Home Assistant. The gateway is automatically detected and the needed dsmr_integration is discovered.
- Within your Home Assistant frontend/home navigate to the Settings menu
- Click on Devices & Services
- Make sure you are the Integrations part (shown on the upper side of the screen)
- dsmr_reader should appear as a discovered integration
- Click on CONFIGURE on the MQTT integration
- Click SUBMIT when asked for “Make sure to configure the ‘split topic’ data sources in DSMR Reader.”
- Click FINISH
Enable dsmr_reader Entities ( Smart Meter Sensors) within Home Assistant
All sensor Entities for all Smart Meter types are created. Most of them are not shown because they are hidden. Enable all the entities you need. Please note that not all entities are used. This depends on the smart meter. Some smart meters send more information than others. If your smart meter sends “0” as a value, your smart meter is not sending this data.
- Within your Home Assistant frontend/home navigate to the Settings menu
- Click on Devices & Services
- Make sure you are the Entities part (shown on the upper side of the screen)
- Search for “dsmr” in the Search entities box
- You will see a notification that not all entities are shown
- You will see a notification that not all entities are shown
- Select all entities
- Click ENABLE SELECTED
- Wait for a minute for all entities to be enabled and shown or restart Home Assistant
Setting up the Energy Dashboard
Home Assistant allows you to get on top of your energy use with its home energy management feature. Gain new insights, optimize your solar panel production, plan energy usage and save money.
- Within your Home Assistant frontend/home navigate to the Settings menu
- Click Dashboards
- Click Energy
- Click ADD CONSUMPTION within Electricity grid
- Add Low tariff usage (sensor.dsmr_reading_electricity_delivered_1) *please note that in Belgium low and high tariff usage are swapped.
- Add High tariff usage (sensor.dsmr_reading_electricity_delivered_2)
- Click ADD RETURN within Electricity grid
- Add Low tariff returned (sensor.dsmr_reading_electricity_returned_1) *please note that in Belgium low and high tariff usage are swapped.
- Add High tariff returned (sensor.dsmr_reading_electricity_returned_2)
- You are finished adding the Smart Meter Gateway to the Energy dashboard.
It can take two hours for the Energy Dashboard to fill with readings.
You can also use the Advanced Energy Dashboard exclusively for Smart Gateway users. Click on the image below to go to this tutorial.