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.

  1. First make sure you installed the Mosquitto MQTT Broker on Home Assistant. You can use this manual.
  2. 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)
  3. 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.

  1. Within your Home Assistant frontend/home navigate to the Settings menu
  2. Click on Devices & Services
  3. Make sure you are the Integrations part (shown on the upper side of the screen)
  4. dsmr_reader should appear as a discovered integration
  5. Click on CONFIGURE on the MQTT integration
  6. Click SUBMIT when asked for “Make sure to configure the ‘split topic’ data sources in DSMR Reader.”
  7. 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.

  1. Within your Home Assistant frontend/home navigate to the Settings menu
  2. Click on Devices & Services
  3. Make sure you are the Entities part (shown on the upper side of the screen)
  4. Search for “dsmr” in the Search entities box
  5. You will see a notification that not all entities are shown
  6. You will see a notification that not all entities are shown
  7. Select all entities
  8. Click ENABLE SELECTED
  9. 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.

  1. Within your Home Assistant frontend/home navigate to the Settings menu
  2. Click Dashboards
  3. Click Energy
  4. Click ADD CONSUMPTION within Electricity grid
  5. Add Low tariff usage (sensor.dsmr_reading_electricity_delivered_1) *please note that in Belgium low and high tariff usage are swapped.
  6. Add High tariff usage (sensor.dsmr_reading_electricity_delivered_2)
  7. Click ADD RETURN within Electricity grid
  8. Add Low tariff returned (sensor.dsmr_reading_electricity_returned_1) *please note that in Belgium low and high tariff usage are swapped.
  9. Add High tariff returned (sensor.dsmr_reading_electricity_returned_2)
  10. 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.

7 thoughts on “Connect a Smart Meter with p1 port to Home Assistant with MQTT”
  1. Hoeveel kost het als jullie dit voor mij doen!! Ik heb namelijk niet een 12 jarige it opleiding

  2. Ik vraag me af of er een foutje zit in de DSMR integratie. De 3 currently_delivery of currently_returned fases zijn uitgedrukt in kW, terwijl we gewoon W terugkrijgen via MQTT. Als ik het in HA naar W zet, doet hij *1000.

    In het dashboard valt dat niet op, omdat de eenheid apart wordt getoond. Maar bij gebruikt in de SunSynk viel het me op dat er kW werd gebruikt.

    Hoe los ik dit op? Of begrijp ik het verkeerd?

    1. Je hebt het goed gezien: er is inderdaad vaak verwarring tussen kW (kilowatt) en W (watt) in de DSMR-integratie, vooral omdat sommige slimme meters waarden in kW aanleveren, terwijl andere meters W aanleveren. Je kunt dit met templating oplossen door nieuwe sensors aan te maken. Dit valt wel buiten support maar hier heb je een voorbeeld:

      template:
      – sensor:
      – name: “DSMR Currently Delivered Power (W)”
      unit_of_measurement: “W”
      state_class: measurement
      device_class: power
      state: >
      {{ (states(‘sensor.dsmr_reading_electricity_currently_delivered’) | float * 1000) | round(0) }}
      – name: “DSMR Currently Returned Power (W)”
      unit_of_measurement: “W”
      state_class: measurement
      device_class: power
      state: >
      {{ (states(‘sensor.dsmr_reading_electricity_currently_returned’) | float * 1000) | round(0) }}

      1. OK, niet bij stil gestaan dat dat de verschillende slimme meters variabel zijn in hun eenheden. Ik ga ermee aan de slag.

  3. Is het mogelijk om de kabel die op de P1 poort aangesloten wordt te verlengen?
    Ik heb geen wifi bereik ter hoogte van mijn digitale teller. 10 à 15 meter verder heb ik wel goed bereik.

    1. Je kunt de P1 kabel van de slimme meter met maximaal 5 meter verlengen met deze kabel: https://smartgateways.nl/product/p1-kabel-0-5-meter-voor-slimme-meter/
      Als je langere afstanden nodig hebt kun je de splitter op de meter aansluiten. Deze versterkt het signaal waardoor je de slimme meter gateway ook wel op 10 meter (15 meter is wel op het randje) kunt aansluiten.
      De splitter hoef je dan niet te voeden als je deze alleen voor versterking gebruikt. De gateway moet je dan wel voeden via de usb aansluiting.
      Actieve P1 splitter: https://smartgateways.nl/actieve-p1-splitter-pro/
      Uiteraard is het een beetje afhankelijk van de situatie of je echt de afstanden haalt, maar de p1 splitter pro gebruiken als versterker is wel de beste optie.

Leave a Reply

Your email address will not be published. Required fields are marked *