Replies: 7 comments 55 replies
-
I asked a similar thing a while ago and Ozzee helped me craft template sensors for pv_10 today and tomorrow which is all I wanted to see. He didn't want to add these to the core integration, think he wanted to keep it cleaner as these were easy for someone to create themselves if they wanted to, but it would be good if these were in the documentation to help others. My template sensors were created through the Home Assistant UI rather than in configuration.yaml, and are quite a bit simpler:
I think it's doing the same? |
Beta Was this translation helpful? Give feedback.
-
Thanks for sharing, that's a much nicer approach. The only thing that still might be helpful is the remaining for today as I discard anything that has gone past the time. |
Beta Was this translation helpful? Give feedback.
-
Updated code :-)
|
Beta Was this translation helpful? Give feedback.
-
There you go :-) IMHO the P90 is generally less intresting as I think you would usually want to base on most likely which the standard forecast and maybe worst case if like me off grid so being paranoid. The the map method would work for both and you could easily setup a bunch of sensors based on P90. I "think" the loop is needed for the date comparison, I see there is a filter for map but haven't looked at it too closely. |
Beta Was this translation helpful? Give feedback.
-
Im confused : The above p10 calculation formula for me produces a number for remaining for today of : 5.7kw If i set solcast to use : Forecast Estimate 10 (whuch i thought is the same) that creates a value of : 7.74kw |
Beta Was this translation helpful? Give feedback.
-
This is what Im using: {{ state_attr('sensor.solcast_pv_forecast_forecast_remaining_today', 'pv_estimate10') | float(0) }} Top Gives : 6.31now |
Beta Was this translation helpful? Give feedback.
-
Firstly thank you for the awesome resource..!
We are off grid so I make a lot of automations to run non critical workloads and very often use the P10 as the worst case call if I am going to risk running them before our batteries hit x percent.
I'm really new to HA but had a crack at writing some templates to create sums and thought I would share.
Maybe you would consider building in?
Matt
name: "solcast_pv_forecast_p10_remaining_today"
unique_id: "solcast_pv_forecast_p10_remaining_today"
unit_of_measurement: "kWh"
icon: mdi:solar-power
state: >
{% set data = state_attr('sensor.solcast_pv_forecast_forecast_today', 'detailedHourly') %}
{% set result = data | map(attribute='period_start') | list %}
{% set combined = data | map(attribute='pv_estimate10') | list %}
{% set time_now = as_timestamp(now()) %}
{% set ns = namespace(result=0) %}
{% for item in data %}
{% if as_timestamp(item.period_start) > as_timestamp(now()) %}
{% set ns.result = ns.result + item.pv_estimate10 | float %}
{% endif %}
{% endfor %}
{% set state = ns.result %}
{{ state | round(1) }}
name: "solcast_pv_forecast_p10_forecast_today"
unique_id: "solcast_pv_forecast_p10_forecast_today"
unit_of_measurement: "kWh"
icon: mdi:solar-power
state: >
{% set data = state_attr('sensor.solcast_pv_forecast_forecast_today', 'detailedHourly') %}
{% set result = data | map(attribute='period_start') | list %}
{% set combined = data | map(attribute='pv_estimate10') | list %}
{% set time_now = as_timestamp(now()) %}
{% set ns = namespace(result=0) %}
{% for item in data %}
{% set ns.result = ns.result + item.pv_estimate10 | float %}
{% endfor %}
{% set state = ns.result %}
{{ state | round(1) }}
name: "solcast_pv_forecast_p10_tomorrow"
unique_id: "solcast_pv_forecast_p10_tomorrow"
unit_of_measurement: "kWh"
icon: mdi:solar-power
state: >
{% set data = state_attr('sensor.solcast_pv_forecast_forecast_tomorrow', 'detailedHourly') %}
{% set result = data | map(attribute='period_start') | list %}
{% set combined = data | map(attribute='pv_estimate10') | list %}
{% set time_now = as_timestamp(now()) %}
{% set ns = namespace(result=0) %}
{% for item in data %}
{% set ns.result = ns.result + item.pv_estimate10 | float %}
{% endfor %}
{% set state = ns.result %}
{{ state | round(1) }}
name: "solcast_pv_forecast_p10_day_3"
unique_id: "solcast_pv_forecast_p10_day_3"
unit_of_measurement: "kWh"
icon: mdi:solar-power
state: >
{% set data = state_attr('sensor.solcast_pv_forecast_forecast_day_3', 'detailedHourly') %}
{% set result = data | map(attribute='period_start') | list %}
{% set combined = data | map(attribute='pv_estimate10') | list %}
{% set time_now = as_timestamp(now()) %}
{% set ns = namespace(result=0) %}
{% for item in data %}
{% set ns.result = ns.result + item.pv_estimate10 | float %}
{% endfor %}
{% set state = ns.result %}
{{ state | round(1) }}
Beta Was this translation helpful? Give feedback.
All reactions