Introduction:
I am trying to prevent the bedrooms from heating up, by lowering the roller shutters under certain conditions.
Currently I use
- a bedroom temperature sensor
sensor.bedroom_temperature
to determine, if it is getting to warm in the bedrooms and - the sun’s position
sun.sun
to determine, if the sun is potentially shining at the side of the house where the bedroom windows sit.
As the radiators in the bedrooms are ususally turned off, the temperature threshold is not reached during winter, and the roller shutters remain open all day (as intended). Now in spring time, the temperature is usually below the threshold in the morning. In the afternoon, when the sun comes around, the bedrooms start to heat up and on sunny days, it may be, that the temperature crosses the threshold and the roller shutters lower down (as intended). If it is mostly cloudy, the bedrooms do not heat up enough to trigger the automation and the roller shutters remain open (as intended).
As the bedrooms are on the upper flow underneath the roof of the house, I am afraid, that throughout the hotter months of the year, the temperature may be constantly above the threshold. On a sunny day of course I would still like the roller shutters to lower down, to prevent the rooms from heating up even further, but if it is a very cloudy day, even though it may be hot/warm outside, I don’t think it is necessary to lower the roller shutters.
Current Automation
- alias: Shutters - Close Shutters Partly to keep Heat out
id: 'shutters_close_shutters_partly_to_keep_heat_out'
trigger:
- platform: numeric_state
entity_id: sensor.bedroom_temperature
above: 20
- platform: numeric_state
entity_id: sun.sun
value_template: "{{ state_attr('sun.sun', 'azimuth') }}"
above: 200 # sun shines at the west side of the house
mode: single
condition:
- condition: numeric_state
entity_id: sensor.bedroom_temperature
above: 20
- condition: template
value_template: >
{{ states.sun.sun.attributes.elevation > 6 and
states.sun.sun.attributes.azimuth > 200 }}
- condition: state
entity_id: input_boolean.disable_shutters
state: 'off'
action:
- choose:
- conditions:
- condition: template
value_template: >-
{{ (state_attr('cover.bedroom', 'current_position') | float) > 40 }}
sequence:
- service: cover.set_cover_position
data:
entity_id: cover.bedroom
position: 40
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ (state_attr('cover.kids_room', 'current_position') | float) > 40 }}
sequence:
- service: cover.set_cover_position
data:
entity_id: cover.kids_room
position: 40
default: []
Question:
For the reason above I am trying to figure out, if it is rather sunny, or cloudy outside. I do not have a lux sensor on the side of the house, but I do have a photovoltaic system on the roof. Using a modbus integration I am getting the Watts it generates sensor.e3dc_solar_power
currently with a default scan_interval of 30 seconds. The photovoltaic system ofcourse generates more power, if there are no clouds, but the power generated depends on the position of the sun. So a hardcoded threshold will not be sufficient to determine, if it is sunny, or cloudy outside.
Is there a way to use the sun’s position sun.sun
together with the solar power sensor.e3dc_solar_power
to determine if it is sunny and feed this into the automation?
Maybe even including a statistics sensor, to smooth out some spikes.