Automation for a beginner

Hi guys,

I actually try to get to an automation but stuck somewhere in the process. Maybe there is a good Samaritan who can help me

I have 3 covers which needs to get open at a certain windspeed (between 35 and 55 km/h)

I currently don’t know where to start. In my old automation software there where if/then routines and a simple “Click” Editor. In HA I see the Automation configurator and in the documentation text based automations. A little confused for a beginner :slight_smile:

Here are the devices and the sensor:

Cover:

- platform: knx
    name: "Wohnzimmer Jalousie rechts"
    move_long_address: '2/0/4'
    move_short_address: '2/1/4'
    position_address: '2/2/4'
    position_state_address: '2/4/4'
    travelling_time_down: 62
    travelling_time_up: 62
    
  - platform: knx
    name: "Wohnzimmer Jalousie Links 1"
    move_long_address: '2/0/5'
    move_short_address: '2/1/5'
    position_address: '2/2/5'
    position_state_address: '2/4/5'
    travelling_time_down: 62
    travelling_time_up: 62
    invert_position: true
    
  - platform: knx
    name: "Wohnzimmer Jalousie Links 2"
    move_long_address: '2/0/6'
    move_short_address: '2/1/6'
    position_address: '2/2/6'
    position_state_address: '2/4/6'
    travelling_time_down: 62
    travelling_time_up: 62
    invert_position: true

Sensor:

- platform: darksky
    api_key: xxxxxxxx
    language: de 
    units: ca
    monitored_conditions:
      - summary
      - icon
      - temperature
      - wind_speed
      - wind_gust

Really appreciate your feedback!

I believe you will need automations with a Numeric State Trigger.

I don’t have a complete solution but I offer you this example as a starting point. One automation opens all three covers and the other two close them.

For open_jalousie, its trigger is activated when the wind_speed exceeds 35 for at least 6 minutes. The "for at least 6 minutes’ is optional. It’s purpose is to avoid ‘false-positive’ situations where the wind_speed exceeds 35 but only momentarily. I chose 6 minutes because the DarkSky Sensor’s default scan_interval is every 2 minutes (so at least 2-3 consecutive wind-speed readings must exceed 35).

The other two automations close the covers depending on whether wind-speed is above 55 or below 35.

I don’t use the DarkSky Sensor so double-check if this is the correct entity_id: sensor.dark_sky_wind_speed

automation:
- alias: 'open_jalousie'
  trigger:
    platform: numeric_state
    entity_id: sensor.dark_sky_wind_speed
    above: 35
    for: '00:06:00'
  action:
    service: cover.open_cover
    entity_id: cover.wohnzimmer_jalousie_rechts, cover.wohnzimmer_jalousie_links_1, cover.wohnzimmer_jalousie_links_2

- alias: 'close_jalousie_high'
  trigger:
    platform: numeric_state
    entity_id: sensor.dark_sky_wind_speed
    above: 55
    for: '00:06:00'
  action:
    service: cover.close_cover
    entity_id: cover.wohnzimmer_jalousie_rechts, cover.wohnzimmer_jalousie_links_1, cover.wohnzimmer_jalousie_links_2

- alias: 'close_jalousie_low'
  trigger:
    platform: numeric_state
    entity_id: sensor.dark_sky_wind_speed
    below: 35
    for: '00:06:00'
  action:
    service: cover.close_cover
    entity_id: cover.wohnzimmer_jalousie_rechts, cover.wohnzimmer_jalousie_links_1, cover.wohnzimmer_jalousie_links_2

Wow! Thanks a lot! This seems pretty simple! No worries about the sensor. This is temporary as my “Hardware” Windsensor will be installed on Wednesday.

I assume in a future setup I can also “lock” my wall switches with automations?

Let’s say if the windspeed exceeds a certain value nobody is allowed to lower the cover manually?

I don’t think it’s that easy.

If the wall switches have direct control of the shutters, an automation cannot intercept and block their commands.

Do away with the wall switches and make everyone use home assistant. Then HA can lock them. But the WAF will be low.

Or even better, IOTise the wall switches so they communicate with HA, not directly to the blinds.

That was the Idea. No direct connection and switching via HA instead. I have to if this works with KNX

guys one more thing: Do I need to put a script behind an automation which checks it periodically or is this a true automation? Means there is a constant check for the wind speed?

Yes it should trigger automatically.

Hm…than something went wrong. I altered the automation so that I have a test setup. It worked exactly two times: when I launched it manually and as I restarted HA :neutral_face:

Please post your exact configuration for the automations.

Here you go. I put it together with the configurator in Lovelace

- id: '1551788148383'
  alias: Jalousie hoch
  trigger:
  - above: '12'
    entity_id: sensor.dark_sky_wind_speed
    platform: numeric_state
  condition:
  - condition: state
    entity_id: cover.wohnzimmer_jalousie_links_1
    state: closed
  action:
  - alias: ''
    data: {}
    service: cover.open_cover
  - data:
      message: Starker Wind! Jalousie fährt hoch
    service: notify.ios_iphone

You stumped me with this configuration. I’ve never seen this format:

  action:
  - alias: ''
    data: {}
    service: cover.open_cover

Where did you find an example of this format?

In all examples I’ve seen, you specify an entity_id for the the service cover.open_cover. Here’s the Services page:
Services%20-%20open_cover

I would suggest this:

action:
- service: cover.open_cover
  entity_id: cover.wohnzimmer_jalousie_links_1

This is what I get when I put it through the automation editor in Lovelace UI. I had only iPad Access throughout the day, where is it a PITA to type (especially if you’re holding one of your kids :wink: )

Here are the screenshots (Trigger, Conditions, Action) The values are only for testing purposes :slight_smile:

The first action (Aktionen) is incomplete.

Don’t know what happened during taking the screenshot but it shows up like it should in HA:

It’s still incomplete. It’s calling the service, cover.open_cover, without specifying a cover entity to act on.

In other words, it’s like calling the service light.turn_on without specifying which light to turn on.

I could put into the brackets:

{"entity":"cover.jalousie_wohnzimner_links_1"}

But in the automation.yaml it puts it already in…

Anyway. I will try your solution later :slight_smile:

Ok. Seemst to work now! Thanks for your support guys!

Aaaand I’m back!

As mentioned the automation is working flawlessly- thanks again for your support.

Now I want to improve it and have several requirements:

  • As you’ve seen I put a notification there. The issue is the following: If the windspeed goes above the threshold the automation is triggered. If it’s now slowing down and gaining speed a few minutes later I receive the notification again. Is there a way that this doesn’t happen? I had also the Idea to trigger that automation only when the covers are closed. Is there a way to do this in home assistant even if they are 25 of 60% closed?

  • Talking about notifications. As Home Assistant is able to send actionable notifications it would be great to receive one after the winds slown down which asks me if I would like to close the blinds again. The trigger shouldn’t be the pure windspeed as the threshold will be reached several times.

Thanks a lot guys,

Flo

Just bumping this one up