<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Home Assistant - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Home Assistant - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Mon, 25 May 2026 20:15:18 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/home-assistant/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Build a Public Grafana-based Solar Monitoring Dashboard in Home Assistant ]]>
                </title>
                <description>
                    <![CDATA[ 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... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-build-a-public-grafana-based-solar-monitoring-dashboard-in-home-assistant/</link>
                <guid isPermaLink="false">68010bea439877985a5bf3e2</guid>
                
                    <category>
                        <![CDATA[ iot ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Home Assistant ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Grafana ]]>
                    </category>
                
                    <category>
                        <![CDATA[ InfluxDB ]]>
                    </category>
                
                    <category>
                        <![CDATA[ solar energy ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Daniel Anomfueme ]]>
                </dc:creator>
                <pubDate>Thu, 17 Apr 2025 14:10:50 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1744899028552/8ad3f3c4-9b25-473d-b539-14dcb2f2b241.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>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.</p>
<p>The thing is that most solar inverter brands have a form of remote data monitoring platform, from <a target="_blank" href="https://www.victronenergy.com/panel-systems-remote-monitoring/vrm">Victron’s VRM</a> to <a target="_blank" href="https://en.growatt.com/products/growatt-monitoring-platform">Growatt’s ShineServe</a>r to <a target="_blank" href="https://www.deyeinverter.com/product/accessory-monitoring-1/smart-pv-management-platform.html">Deye’s Cloud</a>, 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.</p>
<p>In this article, we will be using data available in our Home Assistant setup, sending it to <a target="_blank" href="https://www.influxdata.com/products/influxdb/">InfluxDB</a> and making a <a target="_blank" href="https://grafana.com/oss/grafana/">Grafana</a> 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 <a target="_blank" href="https://hackernoon.com/turn-your-dumb-solar-inverter-into-a-smart-one-with-this-home-assistant-hack">here</a>.</p>
<h3 id="heading-table-of-contents">Table of Contents</h3>
<ul>
<li><p><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-install-and-configure-influxdb">How to Install and Configure InfluxDB</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-install-and-configure-grafana">How to Install and Configure Grafana</a></p>
</li>
<li><p><a class="post-section-overview" href="#how-to-create-the-grafana-solar-dashboard">How to Create the Grafana Solar Dashboard</a></p>
</li>
<li><p><a class="post-section-overview" href="#how-to-create-a-new-admin-user-and-delete-the-default-admin-user">How to Create a New Admin User and Delete the Default Admin User</a></p>
</li>
<li><p><a class="post-section-overview" href="#how-to-enable-remote-access-to-the-solar-dashboard">How to Enable Remote Access to the Solar Dashboard</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></p>
</li>
</ul>
<h3 id="heading-prerequisites"><strong>Prerequisites</strong></h3>
<ul>
<li><p>Home Assistant OS</p>
</li>
<li><p>A domain name</p>
</li>
<li><p>An inverter connected to your Home Assistant instance</p>
</li>
</ul>
<h2 id="heading-how-to-install-and-configure-influxdb">How to Install and Configure InfluxDB</h2>
<p>We will be starting by setting up InfluxDB. InfluxDB is an open-source time series database, which differs from the database that <a target="_blank" href="https://www.home-assistant.io/docs/backend/database/#:~:text=The%20default%20database%20used%20is,other%20databases%20can%20be%20used.">Home Assistant uses by default</a>, SQLite. We will be using InfluxDB v1, as it’s much easier to set up.</p>
<p>Go to your Home Assistant dashboard and go to Settings &gt; Add-ons and click on the Add-On Store.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744463486874/9dda1fca-24a9-4c30-a486-3b723e8535fe.png" alt="A screenshot of Home Assistant Add-ons" class="image--center mx-auto" width="1713" height="1378" loading="lazy"></p>
<p>Inside the Add-on Store, search for “InfluxDB“ and click on the Add-on. You should see the screen below, then install.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744463639772/75f66c35-e7b3-4c20-96ea-9e9154829ac5.png" alt="A screenshot of Home Assistant Add-ons, showing InfluxDB Add-on page" class="image--center mx-auto" width="1703" height="1350" loading="lazy"></p>
<p>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.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744465515531/0c9e9475-08c2-4bc3-afe5-baa4fdbae164.png" alt="A screenshot of InfluxDB Add-on installed and some configurations turned on" class="image--center mx-auto" width="1698" height="1252" loading="lazy"></p>
<p>Start the add-on and look at the logs to be sure it is working. The “Starting NGINX” is an indicator it’s working.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744465746577/f3adbd52-14cd-4e78-b2d7-789ad2c22b31.png" alt="A screenshot of InfluxDB Add-on logs" class="image--center mx-auto" width="1721" height="1246" loading="lazy"></p>
<p>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.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744466323654/78f21741-e6ca-4094-8fc3-adc563b3dfc1.png" alt="A screenshot of InfluxDB Add-on Admin settings showing database available" class="image--center mx-auto" width="1722" height="1367" loading="lazy"></p>
<p>Click on Create Database – and you can name the database anything you want. I will be naming mine <strong>homeassistant</strong>.</p>
<p>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.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744466625066/c2ae2012-44d8-4acb-91ae-25ad35fb18ff.png" alt="A screenshot of InfluxDB Add-on Admin settings showing the newly created database available" class="image--center mx-auto" width="1725" height="1350" loading="lazy"></p>
<p>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 <strong>root</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744467230710/6c025cb7-123a-4552-8090-6a9550e64ecf.png" alt="A screenshot of InfluxDB Add-on Admin settings showing users available" class="image--center mx-auto" width="1712" height="1350" loading="lazy"></p>
<p>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 <strong>configuration.yaml</strong> 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.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">influxdb:</span>
  <span class="hljs-attr">host:</span> <span class="hljs-number">192.168</span><span class="hljs-number">.8</span><span class="hljs-number">.12</span>
  <span class="hljs-attr">port:</span> <span class="hljs-number">8086</span>
  <span class="hljs-attr">database:</span> <span class="hljs-string">homeassistant</span>
  <span class="hljs-attr">username:</span> <span class="hljs-string">root</span>
  <span class="hljs-attr">password:</span> <span class="hljs-string">password</span>
  <span class="hljs-attr">max_retries:</span> <span class="hljs-number">3</span>
  <span class="hljs-attr">default_measurement:</span> <span class="hljs-string">state</span>
</code></pre>
<p>Restart your Home Assistant and go to InfluxDB. Click on the Explore tab, and check to see if you have a <strong>database.autogen</strong> file there<em>.</em> Click on it, and if you see some values under Measurements &amp; Tags, you are good to go.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744468647521/3082e165-04d9-4b7d-bfd7-8de0662c11a9.png" alt="A screenshot of InfluxDB Add-on Explore tab" class="image--center mx-auto" width="1712" height="1357" loading="lazy"></p>
<h2 id="heading-how-to-install-and-configure-grafana">How to Install and Configure Grafana</h2>
<p>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.</p>
<p>Go to the Add-on store, search for Grafana, and install it. Remember to toggle on those important settings, then start the add-on.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744470196074/b3d69925-9ccc-45b9-8078-905866222d15.png" alt="A screenshot of Grafana Add-on page" class="image--center mx-auto" width="1715" height="1386" loading="lazy"></p>
<p>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.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744470431232/0e4541a5-344f-4f46-bd85-44f4d92ea53c.png" alt="A screenshot of Grafana Add-on homepage" class="image--center mx-auto" width="1703" height="1346" loading="lazy"></p>
<p>But before you do that, you need to connect InfluxDB to Grafana. Navigate to Grafana’s tab &gt;&gt; Connections. You should see an “Add new connection” page. Search for InfluxDB and choose it. Then click on the add new datasource button.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744470636092/8dcb8f2b-7fcd-49d3-80d8-abce4f83ea07.png" alt="A screenshot of Grafana Add-on connection settings page" class="image--center mx-auto" width="1707" height="1355" loading="lazy"></p>
<p>Under HTTP, edit the URL and use <strong>http://ha_ip_address:8086</strong> – don’t omit the <code>http://</code> or try to use <code>localhost</code> with it. Scroll down to the InfluxDB Details and fill in the data you used while setting up InfluxDB. Then click on Save &amp; Test. If the config is correct, you should see a green tick and text saying “datasource is working…measurements found.”</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744471708830/5b0d0306-8b74-4c02-9163-cc23a7c3425c.png" alt="A screenshot of Grafana Add-on connection configuration for InfluxDB" class="image--center mx-auto" width="1700" height="1337" loading="lazy"></p>
<h2 id="heading-how-to-create-the-grafana-solar-dashboard">How to Create the Grafana Solar Dashboard</h2>
<p>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 <a target="_blank" href="https://helio.openculture.org.ng/public-dashboards/cf813bfa739044129e125bdd65db7a65?ref=blog.openculture.org.ng">here</a> as the inspiration for our design.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744548823070/811cb6b1-d3f6-4880-b665-8af999d4c703.png" alt="A screenshot of a dashboard we want to recreate" class="image--center mx-auto" width="1918" height="941" loading="lazy"></p>
<p>So now go to your Grafana in Home Assistant, click on the + icon and create a new dashboard.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744544792278/0bbc6140-1335-4597-a972-80a5ddee1744.png" alt="A screenshot of Grafana homepage" class="image--center mx-auto" width="1721" height="1340" loading="lazy"></p>
<p>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.</p>
<p>Let’s create a new panel. Pick InfluxDB as the data source, and at the <strong>FROM</strong> row, pick W which is the unit we want to create a visualization from. <strong>WHERE</strong> 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 <strong>growatt_pv1_charge_power.</strong> You can change the panel title, change the visualization to stat, and add the watt as the unit and the base colour to yellow.</p>
<p>The raw query looks like this:</p>
<pre><code class="lang-sql"><span class="hljs-keyword">SELECT</span> mean(<span class="hljs-string">"value"</span>) <span class="hljs-keyword">FROM</span> <span class="hljs-string">"W"</span> <span class="hljs-keyword">WHERE</span> (<span class="hljs-string">"entity_id"</span>::tag = <span class="hljs-string">'growatt_pv1_charge_power'</span>) <span class="hljs-keyword">AND</span> $timeFilter <span class="hljs-keyword">GROUP</span> <span class="hljs-keyword">BY</span> <span class="hljs-built_in">time</span>($__interval) fill(<span class="hljs-literal">null</span>)
</code></pre>
<p>The Grafana edit page looks like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744550024020/bb50d494-c6bc-45f2-8ff0-17173e7255bc.png" alt="A screenshot of Grafana edit panel view" class="image--center mx-auto" width="1710" height="1258" loading="lazy"></p>
<p>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.</p>
<p><a target="_blank" href="https://github.com/LifeofDan-EL/Grafana-Solar-Dashboard">Here</a> 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.</p>
<p>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.</p>
<p>Here is a picture of my finished result:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744559385614/57b58bfe-7fc2-4fa7-a0d2-19485558899a.png" alt="A screenshot of the finished product of the dashboard I built" class="image--center mx-auto" width="3436" height="1357" loading="lazy"></p>
<h2 id="heading-how-to-create-a-new-admin-user-and-delete-the-default-admin-user">How to Create a New Admin User and Delete the Default Admin User</h2>
<p>By default, the Grafana Add-on in Home Assistant uses an auth proxy and creates a default user (<code>admin</code>) with a password (<code>hassio</code>) that's synced with your HA login session. This prevents password or user changes through the UI.</p>
<p>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</p>
<p>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.</p>
<p>Go to Grafana’s menu &gt; Administration&gt; Users and access &gt; Users. Then create a new user.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744571233206/daf2c674-4501-4774-89d9-76992227b531.png" alt="A screenshot of Grafana users setting page" class="image--center mx-auto" width="1721" height="1332" loading="lazy"></p>
<p>Next, give it admin privileges. Edit Grafana Admin to be yes and make sure the organization role is set to admin, then save.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744749794592/21e85eab-99ca-4c7d-9d18-19e9f31ea1da.png" alt="A screenshot of Grafana user setting" class="image--center mx-auto" width="1715" height="1387" loading="lazy"></p>
<p>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.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744750541094/326aa725-7b81-4407-82ef-e6589a153b9c.png" alt="A screenshot of Grafana Add-on Configuration tab" class="image--center mx-auto" width="1712" height="1388" loading="lazy"></p>
<p>To confirm that the port has been exposed properly, go to <code>http://ha_ip:3000/</code> and confirm you see this Grafana login screen. Make sure it is http and not https.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744563139292/e17d2691-3b77-4faf-997d-95a0b3141066.png" alt="A screenshot of Grafana homepage accessed from outside Home Assistant url" class="image--center mx-auto" width="1698" height="1382" loading="lazy"></p>
<p>Log in as the new user you created. Then go to your list of users and delete the default admin user.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1744750661705/1d98e960-e325-4a5c-9746-64ff1819a573.png" alt="A screenshot of edit to the default admin user" class="image--center mx-auto" width="1718" height="1343" loading="lazy"></p>
<p>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.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">grafana_ingress_user:</span> <span class="hljs-string">usernameofnewuser</span>
</code></pre>
<h2 id="heading-how-to-enable-remote-access-to-the-solar-dashboard">How to Enable Remote Access to the Solar Dashboard</h2>
<p>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.</p>
<p>I will be implementing this part with the aid of a Home Assistant Cloudflared Add-on that leverages Cloudflare Tunnel. Here is the <a target="_blank" href="https://github.com/brenner-tobias/addon-cloudflared">Github repository</a> – the installation is simple and stress-free.</p>
<p>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.</p>
<pre><code class="lang-yaml"><span class="hljs-bullet">-</span> <span class="hljs-attr">hostname:</span> <span class="hljs-string">subdomain_you_want.your_domain.xyz</span>
  <span class="hljs-attr">service:</span> <span class="hljs-string">http://ha_ip:3000</span>
  <span class="hljs-attr">disableChunkedEncoding:</span> <span class="hljs-literal">true</span>
</code></pre>
<p>Save and restart the Add-on and check the logs. You should see it creating a DNS entry for the hostname you added.</p>
<p>As another security step, go to your Grafana Add-on Configuration tab. Add these values to the environment variables.</p>
<pre><code class="lang-yaml"><span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">GF_AUTH_ANONYMOUS_ENABLED</span>
  <span class="hljs-attr">value:</span> <span class="hljs-string">"true"</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">GF_AUTH_ANONYMOUS_ORG_ROLE</span>
  <span class="hljs-attr">value:</span> <span class="hljs-string">"Viewer"</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">GF_AUTH_DISABLE_LOGIN_FORM</span>
  <span class="hljs-attr">value:</span> <span class="hljs-string">"true"</span>
</code></pre>
<ul>
<li><p><code>GF_AUTH_ANONYMOUS_ENABLED</code>: Anyone who visits Grafana without logging in will still be allowed in.</p>
</li>
<li><p><code>GF_AUTH_ANONYMOUS_ORG_ROLE</code>: This sets the default permission for anonymous users. In this case, anonymous users will have the viewer role.</p>
</li>
<li><p><code>GF_AUTH_DISABLE_LOGIN_FORM</code>: 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.</p>
</li>
</ul>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>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.</p>
<p>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.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
