Closing blinds in summer

Hi,

For the past few days I’ve been busy switching from Domoticz to Home Assistant, so I’m completely new to Home Assistant.
Since summer is once again showing its best side, I want to automate my blinds as soon as possible.
However, when creating an automation I get completely stuck and I can’t figure out what I’m doing wrong or where the error is. I myself suspect that I am going wrong because I want to use data from my own weather station (PWS) (for which there is no out-of-the-box integration) or from data from my solar panels, which I get from the cloud using an API from Solaredge.

For the shutters to close there must be a certain temperature in the living room, the time of day must be between sunrise and sunset (or between 06:00 and 18:00) and the solar panels must produce an x amount of W/m or the solar intensity of my weather station must have reached a certain value (otherwise the shutters will close also in cloudy weather).
Who can help me with this?
This is what I have managed to fabricate so far, but it does not work:

alias: Warm weer rolluiken dicht
description: ''
trigger:
  - platform: device
    device_id: 663c8a1585e92bacbxxxxxxxx
    domain: climate
    entity_id: climate.tado_smart_thermostat_ruxxxxxxxx
    type: current_temperature_changed
    id: woonkamer te warm
    above: 22.6
    for:
      hours: 0
      minutes: 5
      seconds: 0
  - platform: webhook
    webhook_id: pws
    entity_id: sensor.pws_solar_radiation
    type: current_radiation_changed
    id: woonkamer te warm
    above: 275
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition:
  - condition: sun
    after_offset: '30'
    after: sunrise
    before: sunset
action:
  - device_id: 52f8d7c83b6ff53b64311xxxxxxxxx
    domain: rfxtrx
    type: send_command
    subtype: Stop
mode: single

Twohundredseventyfive? Man…you do stand some heat :slight_smile:

You only need one of them

Tip for newbee’s: start with few conditions/triggers and build up gradually, check also the “Show Trace” of the automation so see what/.when is happening

Thnx for your reaction!
Burn motherfucker burn… :rofl: :wink:
Now what did I do wrong?
That I gave the value of solar intensity the same ID as the value for temperature?

To keep it simple, I took out the 30 minutes after sunrise and adjusted the id of that value.

I have now created 2 simple automations (shutters open at sunrise and shutters closed at sunset). I’d like to explore this further, but in this case it’s also a race against time with large windows in the living room on the south…

This is what I’ve made of it now:

alias: Warm weer rolluiken dicht
description: ''
trigger:
  - platform: device
    device_id: 663c8a1585e92bacbxxxxxxxx
    domain: climate
    entity_id: climate.tado_smart_thermostat_ruxxxxxxxx
    type: current_temperature_changed
    id: woonkamer te warm
    above: 22.6
    for:
      hours: 0
      minutes: 5
      seconds: 0
  - platform: webhook
    webhook_id: pws
    entity_id: sensor.pws_solar_radiation
    type: current_radiation_changed
    id: zon schijnt
    above: 275
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition:
  - condition: sun
    after: sunrise
    after_offset: '30'

action:
  - device_id: 52f8d7c83b6ff53b64311xxxxxxxxx
    domain: rfxtrx
    type: send_command
    subtype: Stop
mode: single

What I read is that it

  1. triggers when your tado shows a temp more than 22.6 for more than 5 mins AND
    your solar radiation shows more than 275 for more than 5 minues
  2. then it will verify if it is 30 mins past sunrise
  3. if still ok…then send stop to some rf433 device

You could test this out through the States tab in Developer tools and set the states for tado + solar to those values … probably you need to quickly change the trigger ‘for’ to a few seconds else these might refresh within 5 mins

I got it working, because I apparently made a mistake in the approach to the trigger. I have now used time for that, because I want to keep checking all day to see if the conditions are met. For example, if it’s heavily cloudy for the first three hours of the day, I do want the shutters to just close after that, too.
This is what I’ve made of it so far:

alias: Rolluiken zomer test
description: De voorlopige test automatisering van de rolluiken
trigger:
  - platform: time_pattern
    minutes: "10"
condition:
  - type: is_temperature
    condition: device
    device_id: 663c8a1585e92baxxxxxxx
    entity_id: sensor.tado_thermostaat_current_temperature
    domain: sensor
    above: 22.5
  - type: is_illuminance
    condition: device
    device_id: b15513d185cffb1c1ca51f8d5ac4cb3f
    entity_id: sensor.solar_radiation
    domain: sensor
    above: 80
action:
  - device_id: 52f8d7c83b6ff53b6xxxxxx
    domain: cover
    entity_id: cover.rolluiken_woonkamer
    type: stop
mode: single

Now I want to go further and was wondering if it is possible to put, for example, the opening and closing of the shutters at sunrise and sunset also in the automation, so that it becomes an automation for these shutters.
How should I go about doing that?
Is it simply copying the code from those 2 other files and putting it into this one?

First of all… on the conditions, you possibly (?) need an ‘and’ between them, check the gui setup for that…there is a ‘and’ condition.
On the other question, you can use actions ‘choose’ or if/then.
So…
1 every 10 minutes check
if between sunrise/sunset (sun.sun = above_hoirzon) …run above script
else close

btw… for my lights&motion detector, I do not use sun.sun above horizon as in summer this responds way too late in the morning and way to early in the evening. I used sun2 (hacs) integration and created a dawndusk sensor with it.
Depends on what you need of course…ideal would be a lux detector but I only have one HUE and this one is poor on low lx values

So far, it is actually working fine and I don’t understand why I should put an “and” in between the conditions, because “Conditions are optional and prevent further execution unless all conditions are met”.
That implies that all conditions have an “and”, or am I misunderstanding this?
As I wrote, the matter is completely new to me and my moderate knowledge of the English language (I’m an old man :upside_down_face: ) doesn’t really help either. However, up to now this has never stopped me from achieving results in Domoticz and I expect that in HA this will not be different.

I have my whole house and garden full of Hue, also use many motion and light sensors. I also have several sensors from Xiaomi and Aqara.
So far I’m still controlling most of it with Hue automations, but in the future I want to automate everything with HA.
The automation of the roller shutters is also a stepping stone project for me to gain insight into the subject matter, because like many men I am more of the learning by doing than reading to learn. :wink:

sun2 I’m going to take a look at, because obviously that was made for a reason.

Thank you for helping me!

I doublechecked and indeed, not specifying AND/OR implies AND by default… I too get lost with the many options so I just add “AND” to my automations for reminding me what it does :slight_smile:

As mentioned, I only have on hue light sensor in-house (part of the motion sensor) and this one is pretty poor on low lightlevels where it quickly drops to 1 (lowest) although I can still see light outside. At the moment not interested to buy another one and using dawndusk which is fine for me… which of course does not cover the cloudy side of things but… it does not have to be perfect