S0 Energy Meter for Home Assistant


In today’s world, where energy conservation and sustainability are very important, monitoring energy usage has become a crucial aspect of managing our homes efficiently. With the advent of smart technology, it is now easier than ever to track and optimize energy consumption. One such method involves utilizing the S0 connection of an electricity meter or solar inverter and integrating it with a popular home automation platform like Home Assistant. In this blog post, we will explore the S0 connection and how it can be used in Home Assistant to monitor and track energy usage effectively.

After integrating the S0 gateway into Home Assistant you will have this beautiful dashboard that will show the energy consumption and a lot more. Also you will see the power consumption of your S0 meter in the Energy Dashboard.

S0 meter for home assistant domoticz and homey

Click here for a LIVE DEMO. Username: demo – password: smartgateways

Understanding the S0 Connection: The S0 (standard zero) connection is a common interface found on electricity meters and solar inverters. A S0 connection also known as DIN EN 62053-31 interface. It is a pulse output that represents energy consumption or production in kilowatt-hours (kWh). The S0 connection generates electrical pulses that are proportional to the amount of energy being consumed or generated. By counting these pulses, we can accurately measure energy usage or production over time.

Integrating S0 Connection with Home Assistant:

Home Assistant is a powerful open-source home automation platform that allows users to control and monitor various aspects of their homes. By integrating the S0 connection of an electricity meter or solar inverter into Home Assistant, we can create a comprehensive energy monitoring system. Here’s how you can set it up:

  1. Hardware Requirements:
  2. Configuring Home Assistant:
    • Install Home Assistant on your chosen device.
    • Configure the S0 sensor module to connect to your electricity meter or solar inverter.
    • Add the S0 sensor to your Home Assistant configuration.yaml file, specifying the relevant parameters like the pulse count, meter constant, and sensor name.
  3. Visualizing Energy Usage:
    • Home Assistant offers various ways to visualize energy usage, such as using the Energy Dashboard and the Smart Gateways S0 Dashboard.
    • Set up a dashboard to display real-time and historical energy consumption data, including charts, graphs, and statistics.
  4. Automating Energy Management:
    • With Home Assistant’s automation capabilities, you can create custom rules and triggers based on energy consumption data.
    • Set up alerts or notifications when energy usage exceeds predefined thresholds, helping you optimize consumption and detect anomalies.

Benefits of S0 Connection Integration:

By incorporating the S0 connection into Home Assistant, you can unlock a range of benefits, including:

  1. Accurate Energy Monitoring:
    • S0 connection provides precise measurements of energy consumption or production, ensuring reliable tracking.
    • Real-time data allows you to identify energy-intensive devices or patterns, empowering you to make informed decisions about energy usage.
  2. Energy Efficiency:
    • By visualizing energy consumption, you can identify areas where energy can be saved.
    • Home Assistant’s automation features enable you to implement energy-saving strategies like automatically turning off devices during idle periods or optimizing solar energy usage.
  3. Cost Optimization:
    • Detailed energy usage insights help you identify opportunities for reducing electricity bills.
    • By monitoring solar production, you can ensure you are maximizing the use of self-generated energy, potentially reducing reliance on the grid.

Connecting your electricity meter to Home Assistant

You can connect your old electricity meter or solar inverter with S0 interface to Home Assistant using the S0 Gateway from Smart Gateways. The S0 gateway is connected to the S0 connection of the meter with a two-wire connection. When connected and setup to use a mqtt connection to Home Assistant, your energy consumption or production can be monitored with some advanced dashboards. You can even track the costs and learn where to save on the energy bill.

S0 meter for home assistant domoticz and homey

If you are not sure if your energy meter or solar inverter is compatible with the gateway, just send a message to Smart Gateways and they will check if your device works with the S0 Gateway. You can use the contact form on their website for this.

In this blog, I will tell you how to make a dashboard that displays all the values from the Smart Gateways S0 Gateway. The dashboard not only presents consumption or production costs per day, week, month, and year but also empowers you to make your electricity or inverter meter intelligent by utilizing the Smart Gateways S0 Dashboard for Home Assistant. Actually Smart Gateways was the first company providing an off the shelf solution that could make your electricity meter or solar inverter smart.

The Smart Gateways S0 Dashboard for Home Assistant is the perfect complement to Home Assistant’s existing energy dashboard. Of course you can use both dashboards next to each other. Just pick the dashboard you like the most.

Home Assistant Energy Dashboard with Energy usage shown below:

S0 meter for home assistant domoticz and homey energy dashboard

Pre-requirements to setup the dashboard

Setting up the dashboard can be done in a few easy steps. Complete each step one by one and verify if the step is completed before proceeding with the next step.

  1. First install Mosquitto MQTT Broker on Home Assistant using this manual
  2. Connect the S0 Gateway using the Installation Manual found on the Smart Gateways Support page
  3. Enter the MQTT settings on the internal webpage of the S0 Gateway
  4. Install HACS (Home Assistant Community Store) using this manual

Install the Apexcharts-card plugin into Home Assistant

When you completed all the above steps it’s time to add the apexcharts-card repository to Home Assistant. You have to do this using HACS.

  1. Click HACS on the sidebar of Home Assistant
  2. Click Frontend
  3. Click EXPLORE & DOWNLOAD REPOSITORIES in the lower right corner
  4. Type apexcharts-card in the Search for repository box
  5. Click DOWNLOAD in the lower right corner
  6. Select the latest version and Click DOWNLOAD
  7. RELOAD the browser to activate the apexcharts-card plugin

Add additional MQTT Configuration for diagnostical data

*Send a copy of your order or the invoice (not the shipment information) to support@smartgateways.nl to receive the password for the configuration files.

The Advanced S0 Dashboard for Home Assistant will show some diagnostical data from the S0 Gateway. This data is sent by the gateway through MQTT. You can add this to Home Assistant by adding a mqtt file. You first have to install the File editor Add-on.

  1. Within your Home Assistant frontend/home navigate to the Settings menu
  2. Click Add-ons
  3. Click ADD-ON STORE in the lower right corner
  4. Go to the Search add-ons box
  5. Type File editor
  6. Click on File editor from the list
  7. Click INSTALL and wait for the File editor to be installed
  8. Enable Start on boot, Show in sidebar and Watchdog
  9. Click START to start the broker

Add the Packages directory to Home Assistant and place some configuration files

When using the packages directory for all your .yaml configuration files, you are able to sort all configuration in specific files for each integration. You have to edit the configuration.yaml file first for Home Assistant to use the packages directory.

  1. The file editor is shown in the sidebar. Click on the File editor icon
  2. Click on the configuration.yaml file
  3. The contents of the configuration.yaml file are shown
  4. Insert the following configuration into the file:
    • homeassistant:
        packages: !include_dir_named packages
  5. Click the save button (Floppy Disk Icon) on the upper right corner to save the configuration.yaml
  6. Click on the Browse File System Icon on the upper bar
  7. Click on the New Folder icon (second icon)
  8. name the new folder packages
  9. Click OK
  10. Download the following file (disable pop-up blockers)
  11. Unpack the zip file
  12. Place the file smartgateways_s0.yaml in the packages folder by using the Upload File button within the File editor Add-on
  13. Save the file
  14. Restart Home Assistant

Add the Advanced Energy Dashboard to Home Assistant

When you completed all the above steps it’s time to add the Advanced Energy Dashboard to Home Assistant.

  1. Enable Advanced Mode for your user account
    • Within your Home Assistant frontend/home navigate your user profile (in the lower left corner)
    • Enable Advanced Mode to unlock advanced features
  2. Open the file s0_dashboard.txt from the downloaded zip file and copy the contents of this file to the clipboard
  3. Click the three dots in the upper right corner of the dashboard in Home Assistant
  4. edit home assistant dashboardClick on the 3 dots againedit home assistant dashboard
  5. Click Raw configuration editor
  6. Scroll till the end and start a new line
  7. Paste the contents of the s0_dashboard.txt file into the editor
  8. Click SAVE in the upper right corner
  9. Close the editor by clicking the cross on the upper left corner
  10. Restart Home Assistant
  11. Notice the new Advanced S0 Gateway Dashboard.

Home Assistant S0 energy dashboard

Energy Costs

It is possible to enter the costs for energyconsumption or production into the dashboard. There are 3 values to be filled in. You can find those values in the lower right corner. Please note that these costs are based on electricity consumption in the Netherlands. You can ask your energy company for the prices.

  • Energie – Belasting: Tax on electricity per kWh
  • Energie – Prijs per liter: Price per kWh
  • Energie – Vastrecht: Fixed price you have to pay per year to the energy company

Adding the S0 Gateway to the Home Assistant Energy Dashboard

  1. Within your Home Assistant frontend/home navigate to the Settings menu
  2. Click Dashboards
  3. Click Energy in the lower right corner
  4. Go to Electricity Grid
  5. Click Add CONSUMPTION
  6. Add smartgateways_s0_totaal_kw
  7. Click SAVE

Home Assistant energy dashboard S0

If everything went right you will see your electricity consumtion on the Energy Dashboard:

Home Assistant energy dashboard S0 graphs


Integrating the S0 connection of an electricity meter or solar inverter with Home Assistant offers a powerful energy monitoring solution for your home. By accurately measuring energy consumption or production, visualizing usage data, and automating energy management, you can take control of your energy usage, increase efficiency, and work towards a more sustainable and cost-effective lifestyle. Embrace the power of S0 connection and Home Assistant to track and optimize your energy usage today!

Leave a Reply

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