diy solar

diy solar

Sol-Ark + Solar Assistant + Home Assistant - Question for those who know

Watts Happening

I call it like I see it.
Joined
May 3, 2022
Messages
802
Probably a super specific question here, but I'm tinkering with using Home Assistant to get all of our smart devices into a single app/control center. As I set up a new "dashboard" or "view" yesterday I added gauges to keep an eye on the pertinent solar data and I thought I was good to go, but today I realized the data for solar production is cumulative and not daily.

Basically I want the gauge to show how much production the system has generated for the day, what it appears I'm getting is how much production the system has generated cumulatively since Home Assistant started talking to Solar Assistant. I can't make sense of which "entity" to use to get daily production vs cumulative production. Any ideas?

I know the data exists because Solar Assistant shows me my production daily, so it must be getting that information somehow, I just need to figure out how to display it. Basic screenshots below, when I got up and going this morning it was showing 23kWh, which was true for yesterday, but it did not reset today.

Extra info you probably don't need, but if people are interested in Home Assistant (HA) this is how mine is set up:
Initially I ran HA in a Docker image on my Unraid server, it has a ton of resources and is always running so it was a quick and easy process. I then quickly learned there were some relatively important things you couldn't do with it when run as a Docker container, specifically run HACS (Home Assistant Community Store) which is basically where all sorts of cool integrations and community contributions live, you really DO want this. So I then deployed it as a Virtual Machine on the same Unraid server which was pretty darn easy. This gives you a lot more granular control and far easier backups.

You can absolutely run Home Assistant on something like a Raspberry Pi, which is very power efficient but for me would just be another device to add. I'd also highly recommend getting an Unraid server set up if you have any form of an old computer laying around, it really can be the core of your smart home in many ways, far beyond solar/HA.

Screenshot 2023-09-19 at 9.16.50 AM.png

This is the configuration of that particular "card"
Screenshot 2023-09-19 at 9.17.03 AM.png

And here's a screenshot of what Solar Assistant says for the day, you can see it's showing both daily and weekly values. I'd love to be able to use both if possible.

IMG_6306.png
 
@wattmatters - If you've got the time, would you mind eyeballing this? I assume this is right up your alley based on your post that forced me to use HA lol
 
What energy entities in HA is your Solar Assistant is providing?

These are what mine provides:

Screen Shot 2023-09-20 at 5.51.46 am.png

Note that there is only one PV output energy entity and it is a cumulative sensor.

Assuming your SA is also not providing a dedicated daily energy entity then you would either:

i. - use the Energy Dashboard as that will do daily / weekly / annual display consolidation for you using the cumulative energy sensor as the input. Go to Settings/Dashboard/Energy:

Screen Shot 2023-09-20 at 5.55.29 am.png

And you can start to populate this:

Screen Shot 2023-09-18 at 10.17.23 am.png

ii. create a daily energy sensor in Home Assistant, can use a Helper to set up a Riemann Sum integral sensor** see next post:

Screen Shot 2023-09-20 at 5.53.57 am.png

and that new sensor can be use in any dashboard you wish.
 
Last edited:
Apologies, the Riemann Sum sensor is a bum steer on my part.

I should have suggested the Utility Meter helper as that will use the cumulative energy sensor and create a new one which resets on whatever number of days you choose:

Screen Shot 2023-09-20 at 7.56.07 am.png

Screen Shot 2023-09-20 at 7.56.17 am.png
 
Apologies, the Riemann Sum sensor is a bum steer on my part.

I should have suggested the Utility Meter helper as that will use the cumulative energy sensor and create a new one which resets on whatever number of days you choose:

View attachment 168401

View attachment 168402
I'll have to have a look at that, but I'm wondering if maybe there is some YAML code (which I'm not at all familiar with) that I could insert here to simply show the data from the current date? IE line 3 being something like, "date: today" - no clue if such syntax exists in YAML?

Screenshot 2023-09-19 at 3.04.51 PM.png
 
I'll have to have a look at that, but I'm wondering if maybe there is some YAML code (which I'm not at all familiar with) that I could insert here to simply show the data from the current date?
No. You need to create a sensor which does the daily sum.

You can create it with YAML code, but it's just easier to use the in-built helper. It's a few clicks, give it a name, add the existing Wh sensor for PV and choose a daily reset. That's it - you have a new sensor which does exactly what you asked. Then display that new sensor in a gauge of your choice.
 
No. You need to create a sensor which does the daily sum.

You can create it with YAML code, but it's just easier to use the in-built helper. It's a few clicks, give it a name, add the existing Wh sensor for PV and choose a daily reset. That's it - you have a new sensor which does exactly what you asked. Then display that new sensor in a gauge of your choice.
I appreciate that, I've done what you suggested and when I try to add that gauge I get the following error, any ideas?

edit:
It is now working, but appears to only count each hour. I wonder if there is a way to have it update in real time rather than add hourly production on the hour?

Screenshot 2023-09-19 at 3.28.52 PM.png
 
Last edited:
I think the issue is that you are selecting the wrong display type. Use the History Graph Card and select the same sensor you have already and then put in how ever many hours you want it to display. I use that to display a week's worth of data for many dashboards
 
I think the issue is that you are selecting the wrong display type. Use the History Graph Card and select the same sensor you have already and then put in how ever many hours you want it to display. I use that to display a week's worth of data for many dashboards
I can get this do display, so obviously home assistant could do some form of calculation based on it, but it's not displaying kWh. Any ideas?

Screenshot 2023-09-19 at 3.32.50 PM.png
 
Ahh sorry. just re-read your initial post. I think the Energy dash is where you want to live. I know you are looking for something in your own dash. But, getting the energy one setup is pretty nice.

The Statistic Card doesn't do that if you select "change" and "Today"?
 
Ahh sorry. just re-read your initial post. I think the Energy dash is where you want to live. I know you are looking for something in your own dash. But, getting the energy one setup is pretty nice.

The Statistic Card doesn't do that if you select "change" and "Today"?
It wont let me select "change"
 
I think wattmatters' suggestion to create a Meter Helper (Settings -> Devices, Helpers -> Meter

Then use the Statistic card with Today & Change.

I think that will get you there

EDIT:

I think you should still look into the Energy dash. Reset it if you already set it up empty. The refresh on that is fairly constant. I don't know what the refresh is on the statistic card
 
@Watts Happening

Reading your post closer, I believe what I mentioned in my prior post is what you're asking for. So the instructions are similar to what @wattmatters provided.

  1. install the VS Code extension
  2. Create the helper using the utility meter option and have it reset daily.
  3. Create a template sensor in yaml. To do this create a template.yaml file in your config directory like this. Also update your config file to reference the template.yaml file.
    1695176341482.png1695175692770.png

  4. here is the exact YAML, but obviously substitute your sensor name

    YAML:
    - sensor:
        - name: "Solar Production 123"
          icon: mdi:battery-charging-100
          unit_of_measurement: "kWh"
          state: "{{ states('YOUR SENSOR NAME HERE') }}"

  5. Check your config under the developer tools if no errors good to go, re-load the templates
    1695175916522.png
  6. Go to your dashboard add a guage card and use the template sensor as your sensor.
    it will look something like this, and you can customize the colors if you want, add a needle etc.
    1695175796469.png
    1695176429012.png
 
Last edited:
@Watts Happening are you looking for like a gauge that goes up to some topline number ever day?

sorta like this but titled "Solar Production" in KWh
View attachment 168436
Yes that is what I’m looking for, I *think* I have it working but will need to see what happens at midnight tonight. Only thing I’m not loving about it thus far is that it only updates hourly on the hour
 
Back
Top