How to Build a Public Grafana-based Solar Monitoring Dashboard in Home Assistant
If you have a solar inverter setup, one thing you would agree on with me is that data from your solar inverter setup is really important. Another thing that is also important is having a way to show what your energy generation, consumption, and so on...

If you have a solar inverter setup, one thing you would agree on with me is that data from your solar inverter setup is really important. Another thing that is also important is having a way to show what your energy generation, consumption, and so on looks like publicly.
The thing is that most solar inverter brands have a form of remote data monitoring platform, from Victron’s VRM to Growatt’s ShineServer to Deye’s Cloud, among others. But I’m a fan of self-hosting and local control of data. This is one of the best ways to visualize and showcase all that beautiful data you have publicly to fellow tinkerers, solar inverter users, and the general public without relying on the company’s cloud data logger solution.
In this article, we will be using data available in our Home Assistant setup, sending it to InfluxDB and making a Grafana dashboard out of it. There are a good number of ways to connect your inverter to Home Assistant, depending on the manufacturer. I use a Growatt SPF ES 6000 inverter, and I shared a guide on how to make a local data logger for it that works with Home Assistant here.
Table of Contents
Prerequisites
Home Assistant OS
A domain name
An inverter connected to your Home Assistant instance
How to Install and Configure InfluxDB
We will be starting by setting up InfluxDB. InfluxDB is an open-source time series database, which differs from the database that Home Assistant uses by default, SQLite. We will be using InfluxDB v1, as it’s much easier to set up.
Go to your Home Assistant dashboard and go to Settings > Add-ons and click on the Add-On Store.
Inside the Add-on Store, search for “InfluxDB“ and click on the Add-on. You should see the screen below, then install.
Toggle the “Watchdog” on, as this allows the add-on to restart if it crashes. Also, toggle the “show in sidebar” on, which allows you to see the add-on on Home Assistant’s sidebar.
Start the add-on and look at the logs to be sure it is working. The “Starting NGINX” is an indicator it’s working.
Next, go to your Home Assistant sidebar and click on InfluxDB. You need to create a new database to hold your data and also create a new user that has admin privileges to read and write data. Go to the InfluxDB Admin tab.
Click on Create Database – and you can name the database anything you want. I will be naming mine homeassistant.
By default, the retention policy for a created database is infinity (which is forever), but you can configure this to be any time frame you want. Retention policy refers to the time frame of data the database can hold. I prefer to stick with infinity as I want to keep as much data as possible and I have enough storage in my Home Assistant hardware for that.
Once the database is created, go to the Users tab so you can create the new admin user. Input a username and password for that user and click on Grant Admin, so the permission level can be set to all. I created a new user called root.
At this point, what is left on the InfluxDB side is to tell Home Assistant to start sending sensor data to InfluxDB. You can do this by going to your Home Assistant configuration.yaml file and adding this config below to it. Your host is the IP of your Home Assistant, the port is the default port for the InfluxDB add-on, and the remaining values are based on the values you used during setup.
influxdb:
host: 192.168.8.12
port: 8086
database: homeassistant
username: root
password: password
max_retries: 3
default_measurement: state
Restart your Home Assistant and go to InfluxDB. Click on the Explore tab, and check to see if you have a database.autogen file there. Click on it, and if you see some values under Measurements & Tags, you are good to go.
How to Install and Configure Grafana
Next on our agenda is to install and configure Grafana. The goal is to have Grafana query InfluxDB and make dashboards based on the queried data.
Go to the Add-on store, search for Grafana, and install it. Remember to toggle on those important settings, then start the add-on.
Once it has started, click on Grafana on the sidebar. You will arrive at Grafana’s homepage which is where you can create those dashboards.
But before you do that, you need to connect InfluxDB to Grafana. Navigate to Grafana’s tab >> Connections. You should see an “Add new connection” page. Search for InfluxDB and choose it. Then click on the add new datasource button.
Under HTTP, edit the URL and use http://ha_ip_address:8086 – don’t omit the http://
or try to use localhost
with it. Scroll down to the InfluxDB Details and fill in the data you used while setting up InfluxDB. Then click on Save & Test. If the config is correct, you should see a green tick and text saying “datasource is working…measurements found.”
How to Create the Grafana Solar Dashboard
With that, you should have InfluxDB running and connected to Grafana. Let’s get to building beautiful dashboards out of all the data being generated. This part is subjective, so you can feel free to edit and modify the design to your taste. We will be using this dashboard here as the inspiration for our design.
So now go to your Grafana in Home Assistant, click on the + icon and create a new dashboard.
You should know that a dashboard in Grafana refers to the full space and each thing placed on the dashboard is a panel. Each visualization on the dashboard is a panel.
Let’s create a new panel. Pick InfluxDB as the data source, and at the FROM row, pick W which is the unit we want to create a visualization from. WHERE is entity_id::tag, as that is the way to sort the values by Home Assistant sensor entity name. Then pick the entity id of your panel – mine is growatt_pv1_charge_power. You can change the panel title, change the visualization to stat, and add the watt as the unit and the base colour to yellow.
The raw query looks like this:
SELECT mean("value") FROM "W" WHERE ("entity_id"::tag = 'growatt_pv1_charge_power') AND $timeFilter GROUP BY time($__interval) fill(null)
The Grafana edit page looks like this:
At this point, you should be able to recreate the remaining parts of the dashboard. But I manually did all that, so you don’t have to go through it all yourself if you don’t want to.
Here is the link to a GitHub repo that has the JSON file of this dashboard. When you go to create a dashboard, you will see an option to import from a JSON file. You can choose to copy and paste or upload the file, whichever works for you.
After importing, you only need to edit each panel through the GUI to use your own entity ID tag in Home Assistant and also the UID of your InfluxDB database.
Here is a picture of my finished result:
How to Create a New Admin User and Delete the Default Admin User
By default, the Grafana Add-on in Home Assistant uses an auth proxy and creates a default user (admin
) with a password (hassio
) that's synced with your HA login session. This prevents password or user changes through the UI.
For context, an auth proxy, or authentication proxy, acts as an intermediary between a client and a target resource, handling authentication and authorization on behalf of the client
As a security step, we need to create a new user for the Grafana Add-on and edit their permission to have admin privileges, then delete the default admin user. This is because you can’t change the default admin user password on the Add-on.
Go to Grafana’s menu > Administration> Users and access > Users. Then create a new user.
Next, give it admin privileges. Edit Grafana Admin to be yes and make sure the organization role is set to admin, then save.
Go back to the Add-on Configuration tab. Scroll to the Network setting and add a port to expose the Add-on. I will be using port 3000. Save and restart the Add-on. If you have SSL turned on and it isn’t configured, the add-on won’t start. You can disable it as we will have Cloudflare handle that.
To confirm that the port has been exposed properly, go to http://ha_ip:3000/
and confirm you see this Grafana login screen. Make sure it is http and not https.
Log in as the new user you created. Then go to your list of users and delete the default admin user.
After that, go back to the Grafana Add-on Configuration tab. Click on the 3 dots on the Options row and choose Edit in YAML. Then add this line below to your configuration file and save.
grafana_ingress_user: usernameofnewuser
How to Enable Remote Access to the Solar Dashboard
At this point, we have the solar dashboard all ready and we can access it in Home Assistant while inside our home network. But we don’t want it only that way. We want anyone to be able to visit the link without having access to our home network.
I will be implementing this part with the aid of a Home Assistant Cloudflared Add-on that leverages Cloudflare Tunnel. Here is the Github repository – the installation is simple and stress-free.
After going through the setup and having remote access to your Home Assistant network (remember to have 2FA turned on), go to the Cloudflared Add-on configuration tab and edit the Additional Hosts part.
- hostname: subdomain_you_want.your_domain.xyz
service: http://ha_ip:3000
disableChunkedEncoding: true
Save and restart the Add-on and check the logs. You should see it creating a DNS entry for the hostname you added.
As another security step, go to your Grafana Add-on Configuration tab. Add these values to the environment variables.
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "true"
- name: GF_AUTH_ANONYMOUS_ORG_ROLE
value: "Viewer"
- name: GF_AUTH_DISABLE_LOGIN_FORM
value: "true"
GF_AUTH_ANONYMOUS_ENABLED
: Anyone who visits Grafana without logging in will still be allowed in.GF_AUTH_ANONYMOUS_ORG_ROLE
: This sets the default permission for anonymous users. In this case, anonymous users will have the viewer role.GF_AUTH_DISABLE_LOGIN_FORM
: Disables the login form on the Grafana login page. Make sure you are already logged in on the remote hostname. But you can always edit this on the Add-on Configuration tab if you get locked out.
Wrapping Up
Finally, go to the Remote hostname for your Grafana and you should see the Grafana home page. Then go to your dashboards and click on the solar dashboard created. Share it and choose publicly. Now you can share that link (the URL on that page and not the actual copied URL from the share button) with anyone and they can get to see your beautiful dashboard.
This method serves as an all-in-one way of having everything done, through your Home Assistant machine. I hope you had fun tinkering, see you next time.