diy solar

diy solar

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

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
You have the exact same system as me. I read through and am also trying settings out on my home assistant. Would be great to have this worked out
 
Update your YAML with this, it will cause the template sensor to update every minute.

YAML:
- sensor:
    - name: "Solar Production 123"
      icon: mdi:battery-charging-100
      unit_of_measurement: "kWh"
      state: "{{ states('sensor.daily_production_kWh') }}"
      attributes:
        attribute: "{{ now().minute }}"
 
Update your YAML with this, it will cause the template sensor to update every minute.

YAML:
- sensor:
    - name: "Solar Production 123"
      icon: mdi:battery-charging-100
      unit_of_measurement: "kWh"
      state: "{{ states('sensor.daily_production_kWh') }}"
      attributes:
        attribute: "{{ now().minute }}"
Oh boy, now I have to figure out how to edit my YAML lol!

Thank you for the input and help, it’s greatly appreciated!
 
Oh boy, now I have to figure out how to edit my YAML lol!
It's relatively easy with a file editor, the main thing to note is never restart HA after doing any YAML change unless you have checked the configuration is valid. That's an easy one button press check which was mentioned earlier in the thread.

See here for some:
 
It's relatively easy with a file editor, the main thing to note is never restart HA after doing any YAML change unless you have checked the configuration is valid. That's an easy one button press check which was mentioned earlier in the thread.

See here for some:
Looks like I've got some learning to do, it's full of errors:

Screenshot 2023-09-20 at 7.51.33 AM.png
 
That is easily fixed. Take a look back at my prior post


It's better to create a templates.yaml file to keep your config file clean, it's a preference of mine, but I've been coding in HA for years so I can save you a lot of headaches as the product matures by following a few tidy tips.

So your config file should look like this

YAML:
# Loads default set of integrations. Do not remove.
default_config:

map:
  - default_zoom: 8

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
template: !include templates.yaml


Then in your templates.yaml file it should look like this

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

Once you make those corrections that should fix the error and start you on the path to having a clean "manageable" configuration. Trust me once you get the taste, you'll be doing all sorts of custom sensors, the possibilities are endless. ;)
 
My sensor started at zero at midnight, and it's updating by the minute, but the actual value from the Sol-Ark is only changing every hour, even though it's sending every few minute. The sensors are smart enough that they will only show movement when the value has changed. So if the Sol-Ark says 1.2 every 1 minute for an hour, the sensor will continue to read 1.2 until the value changes to 1.3 or greater.

1695224722744.png

Looking at the MQTT explorer you can see in the history, and the value is coming in every minute from Sol-Ark to SA to HA, but it's the same value over and over so in my case it appears to update on the hour. With more freqent changes the sensor should show more granual and timely updates.

1695224912287.png
 
Alright, so I think I've followed along correctly, but now I don't know how to get it to display in a card, I tried making a gauge that displayed "solar production 123" and it says it's not a numeric value. Am I doing it wrong? (much appreciated).

Screenshot 2023-09-20 at 5.33.16 PM.png

Screenshot 2023-09-20 at 5.33.10 PM.png
 
Alright, so I think I've followed along correctly, but now I don't know how to get it to display in a card, I tried making a gauge that displayed "solar production 123" and it says it's not a numeric value. Am I doing it wrong? (much appreciated).

View attachment 168567

View attachment 168568
You probably need to add "| float" after the "states" call, to convert it to a number. Something like:

Code:
{{ states("deye_sunsynk_sol_ark_pv_energy") | float }}
 
Let us confirm we're talking about the same card type. This is the one you're using correct?

1695270909729.png

It's settings look similar to this image?
1695270946717.png

Does your entity for PV energy look exactly the same as this?
1695271126177.png
 
@Watts Happening there is some sort of data type initialization going on with your entity.

For your entity, does it have a value?
1695313670589.png

1695313707006.png

On my system I don't have any PV hooked up, but initially when I tried to add the gauge card with the "sensor.deye_sunsynk_sol_ark_pv_energy" I got the same non-numeric issue. This specific sensor "sensor.deye_sunsynk_sol_ark_pv_energy" is an aggregate sensor provided by SA from data it gathers from the inverter, IE a computed value from SA.

I presume you're using SA as the MQTT broker, which makes things harder since you cannot see the MQTT messages coming from SA and intercept them to force a value for testing. I would suggest getting your HA/SA instance set up so that HA is the MQTT broker so you can read the messages.

These are the instructions from SA that guide you through this process.

If you don't do this, it will be nearly impossible to see what is being sent and how frequently from SA to HA so you can diagnose and troubleshoot.

I'd be happy to coordinate a time with you to do a remote session and take a look with you, let me know if you're interested.
 
Last edited:
Back
Top