Increase ventilation speed to level 3:

Triggers:
Someone leaves the house (leaves a zone)
It’s 8 o’clock in the morning


The conditions that should be met:
And: everyone is away from the zone (each smartphone is away)
And: the actual outdoor temperature should be below 20°C
And: time should be between 6 o’clock and 12
And: the forecasted outdoor temperature should be more than 25°C

Actions:
Set fan speed level to: 2 or 3
Send a message to my phone (testing purposes)

- id: 'xxxxxxxxxx'
  alias: Start smart ventilation
  trigger:
  - platform: time
    at: 08:00:00
  - platform: device
    device_id: XXXXXXXXXXXX
    domain: device_tracker
    entity_id: device_tracker.marcel
    type: leaves
    zone: zone.home
  - platform: device
    device_id: XXXXXXXXXXXX
    domain: device_tracker
    entity_id: device_tracker.mywife
    type: leaves
    zone: zone.home
  condition:
  - condition: and
    conditions:
    - condition: device
      device_id: XXXXXXXXXXXX
      domain: device_tracker
      entity_id: device_tracker.marcel
      type: is_not_home
    - condition: device
      device_id: XXXXXXXXXXXX
      domain: device_tracker
      entity_id: device_tracker.mywife
      type: is_not_home
    - condition: numeric_state
      entity_id: weather.huis
      attribute: temperature
      below: '20'
    - condition: time
      after: 06:00:00
      before: '12:00:00'
    - condition: numeric_state
      entity_id: weather.huis
      attribute: forecast
      above: '25'
  action:
  - type: turn_on
    device_id: XXXXXXXXXXXX
    entity_id: light.fan_speed_setpoint
    domain: light
    brightness_pct: 2
  - service: notify.mobile_app_marcel
    data:
      title: Ventilation started!
      message: The ventilation speed is set to: 2
  mode: single

 

- id: 'xxxxxxxxxx'
  alias: Stop ventilation
  trigger:
  - platform: device
    device_id: XXXXXXXXXXXX
    domain: device_tracker
    entity_id: device_tracker.marcel
    type: enters
    zone: zone.home
  - platform: device
    device_id: XXXXXXXXXXXX
    domain: device_tracker
    entity_id: device_tracker.mywife
    type: enters
    zone: zone.home
  - platform: numeric_state
    entity_id: weather.huis
    attribute: temperature
    above: '20'
  condition:
  - condition: numeric_state
    entity_id: sensor.fan_value
    above: '1'
  action:
  - type: turn_on
    device_id: XXXXXXXXXXXX
    entity_id: light.fan_speed_setpoint
    domain: light
    brightness_pct: 1
  mode: single

 

Set back ventilation speed to level 1:

Triggers:
Someone gets home (enters a zone)
The actual outdoor temperature has reached more than 20°C

Actions
Set fand speed level to: 1