So I built a sensor that reports my yesterday max sun elevation. (as I dont know how to get the todays at noon, in the early morning, and its changing slowly enough that I dont realy care.)
I added to sensor.yaml:
# max sun elevation yesterday
- platform: statistics
name: "Sun_Solar_Elevation-Maximum_Yesterday"
entity_id: sensor.sun_solar_elevation
state_characteristic: value_max
max_age:
hours: 48
and this gives me a nice graph with a line (and coresponding number) representing the hightes elevation the sun has had in the past 24h with two decimals. (asside form the first day if you start it after the highest elevation.)
now I try to use that in an automation with this.
condition: and
conditions:
- condition: trigger
id:
- shade
- condition: numeric_state
entity_id: sensor.sun_solar_elevation_maximum_yesterday
value_template: ""
above: 20
enabled: true
- condition: template
value_template: >-
{{state_attr('weather.dwd_weather_berlin', 'forecast')[0]['temperature']
>= 15 }}
- condition: state
entity_id: input_boolean.rolladen_eg_kuche_beschattung
state: "on"
explanation: with AND
- the trigger is run by azimuth -45 from the direction of the window (unshade to 100% open always runs at azimuth +45Ā° from the window.)
- when the elevation yesterday was above 20 (for test purposes, in real life it depends on location, for mine I would go with 40, as that was the average of what I manually activated the shutter in the past while at home)
- when the forecast for today is above 15 (also for test purposes, in real life I would chose somewhere around 22-25)
- and finally, if the shade option is active for that window shutter.
But when I test the elevation condition in automations I get:
In ānumeric_stateā: In ānumeric_stateā condition: entity sensor.sun_solar_elevation_maximum_yesterday state āā cannot be processed as a number
Ć suspect I need to add a float somewhere, but I cant figgure out where and how that should look.
who could give me a clue?