Help with automation for ventilation

Hello,

I need some help with this automation.
It does not trigger accordingly.

- alias: co2 keuken hoog
  trigger:
    - platform: numeric_state
      entity_id: sensor.tasmota_co2_keuken
      above: 700
    - platform: numeric_state
      entity_id: sensor.tasmota_co2_keuken
      below: 650
  action:
    - service_template: "switch.turn_{{'on' if trigger.below | int > 0 else 'off'}}"
      entity_id: switch.ventilatie_hoog

Thanks

You can use an ‘Bayesian’ sensor see https://www.home-assistant.io/integrations/bayesian/

I use it for my bathroom ventilation.

Thanks Willem,

Is a nice idea.

But I am also interested in the automation as I tried because I could use “variants” for other automatisations also.

Anybody else?

Your template doesn’t look like anything else I’ve seen

Personally I’d scrap your action and use a choose action instead, with the two different options

Hi

What do you mean with “a choose” action?

Regards


Can also be used in an automation action
You set a condition (or multiple) then a corresponding sequence of actions.
You can also have more than one set of choose which will be carried it sequentially or you can nest them for complex things.
Here’s an example where I use choose to handle all my timer end events in one automation.
alias: Timer End Event Handlers
description: ''
trigger:
  - platform: event
    event_type: timer.finished
    event_data: {}
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ trigger.event.data.entity_id == "timer.bathroom_fan_motion" }}'
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.bathroom_fan_motion
      - conditions:
          - condition: template
            value_template: '{{ trigger.event.data.entity_id == "timer.bathroom_fan_bath" }}'
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.bathroom_fan_bath
      - conditions:
          - condition: template
            value_template: '{{ trigger.event.data.entity_id == "timer.bathroom_fan_shower" }}'
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.bathroom_fan_shower
    default: []
mode: single

Does not trigger, or the action doesn’t happen? Anything in the logs?

Could you post a screenshot of Developer Tools / States for the kitchen CO2 sensor? Like this, but for your sensor:

image

@samnewman86 : I will look into this. I am an “old time” automation user and should indeed look into the newer possibilities :slight_smile:

@Troon : The automation is reacting “weird” and that is also why I started this just in order to find out why.

I would expect the trigger to happen during the whole time the co2 level is above 700. In the log of the automation it indicates that it triggers : " Has been triggered by numeric state of sensor.tasmota_co2_keuken" but it has no real correlation with the values shown in the sensor.

Anyway…thanks a lot for your help guy’s

No, a numeric_state trigger fires when the value crosses a threshold [docs]. In your case it’ll fire only when going from below 700 to above; or from above 650 to below.

1 Like