Humidity fan only during hours

Again thanks for reading, and sorry its another humidty/fan question.I know there is so many questions regarding switching on a fan based on humidity. But i thought i had it sorted. I want it to turn on between 10am and 11pm when the humidity is above 70%. But i think whats happening is the trigger point is being reached during the off hours so is not activating during the day. I also have an automation to turn it off when it reaches 65% and another to turn it off at 11pm. I am sure there is even away to have all this in a single automation.

- id: '1588596611878'
  alias: High humidity on
  description: Turn on extractor fan when humidity is Above 70%
  trigger:
  - above: 70
    device_id: 46d9144c7a2445508f9b65bde1bcf9d7
    domain: sensor
    entity_id: sensor.tasmota_fan_am2301_humidity
    platform: device
    type: humidity
  condition:
  - after: '10:00'
    before: '23:00'
    condition: time
  action:
  - device_id: 46d9144c7a2445508f9b65bde1bcf9d7
    domain: switch
    entity_id: switch.tasmota_fan
    type: turn_on

You should put all your criteria as triggers AND conditions. Just repeat your triggers in the conditions. I hope I am making sense ;:slight_smile:

I wasn’t able to use the before after criteria in the trigger so i just made the trigger off and moved all the criteria to conditions. Do you think that will work.

- id: '1588596611878'
  alias: High humidity on
  description: Turn on extractor fan when humidity is Above 70%
  trigger:
  - device_id: 46d9144c7a2445508f9b65bde1bcf9d7
    domain: switch
    entity_id: switch.tasmota_fan
    platform: device
    type: turned_off
  condition:
  - after: '10:00'
    before: '23:00'
    condition: time
  - above: 70
    condition: device
    device_id: 46d9144c7a2445508f9b65bde1bcf9d7
    domain: sensor
    entity_id: sensor.tasmota_fan_am2301_humidity
    type: is_humidity
  action:
  - device_id: 46d9144c7a2445508f9b65bde1bcf9d7
    domain: switch
    entity_id: switch.tasmota_fan
    type: turn_on

The automation triggers will be activated when they pass the defined treshold. E.g. when the humidity changes from 69 to 70. So when the humidity is already at 71 and the time reaches 10AM, it will not be triggered. So you are correct, the trigger point is being reached during the off hours.

So you can define multiple triggers:

  • humidity is > 70%;
  • time is after 10AM;

Then in your conditions:

  • humidity is > 70%;
  • time is after 10 AM;
  • time is before 11 PM;

The triggers will be processed as ORs (humidity is > 70 or time is after 10AM). The conditions will be processed as ANDs (humidity is >70 and time is after 10AM and time is before 11PM).

I am very unfamiliar with the output the GUI Automation Builder creates. So I’m unable to provide you with a YAML-code example off the bat. I’m hoping you can fix it yourself with this input?

I think your first example is the best starting point, start from there and add a trigger ‘time > 10AM’.

Believe it should be Trigger time equals 10am (10:00:00)

This will then trigger BOTH when it’s 10am AND when humidity goes from 69-70

Conditions are correct, but I’d change to time is after 09:59:58. Shouldn’t be an issue as it is, but I like to be ‘safe’ an ensure the condition time = trigger time doesn’t do anything unintended…

2 Likes

seems to all be good with this setup

- id: '1588596611878'
  alias: High humidity on
  description: Turn on extractor fan when humidity is Above 70%
  trigger:
  - above: 70
    device_id: 46d9144c7a2445508f9b65bde1bcf9d7
    domain: sensor
    entity_id: sensor.tasmota_fan_am2301_humidity
    platform: device
    type: humidity
  - at: '10:00'
    platform: time
  condition:
  - after: '09:59:58'
    before: '23:00'
    condition: time
  - above: 70
    condition: device
    device_id: 46d9144c7a2445508f9b65bde1bcf9d7
    domain: sensor
    entity_id: sensor.tasmota_fan_am2301_humidity
    type: is_humidity
  action:
  - device_id: 46d9144c7a2445508f9b65bde1bcf9d7
    domain: switch
    entity_id: switch.tasmota_fan
    type: turn_on
2 Likes