Automate based on multiple conditions

I’m not quite getting multiple conditions and given some of these take a lot of time to test (waiting for temperatures to rise, or other state changes) I’m struggling to successfully test and get working a simple automation to turn off my dryer.

I am using conditions of:

  • temp reaches a set high
  • humidity reaches a set low
  • dewpoint reaches a set low
  • dryer has been on at least 1 minute

I am making sure the dryer is on for a set period to at least give the sensor (which is at the dryer exhaust and susceptible to the natural environment) some time to adjust to the internals of the dryer.

My first attempt was to set the trigger as the dryer turning off and the fact none of the other conditions were met, it kept going (as intended) but then the automation never fires again.

I tried changing the mode to restart and queue, but that didn’t do it.

In the end what I did was to set everything as a trigger AND a condition, so that any one of the triggers activated the test against the conditions and if they are all met, the dryer is turned off.

I have seen others create scripts and variables and multiple sets of instructions, but I felt there must be a simpler approach.

I think what I have here now is right, but any improvements would be appreciated.

I’m waiting for this load to finish, but I think I have finally got it right.

alias: Turn the Dryer off
description: ''
trigger:
  - type: temperature
    platform: device
    entity_id: sensor.laundryth833_am2301_temperature
    domain: sensor
    above: 40
  - type: humidity
    platform: device
    entity_id: sensor.laundryth833_am2301_humidity
    domain: sensor
    below: 30
  - type: value
    platform: device
    entity_id: sensor.laundryth833_am2301_dewpoint
    domain: sensor
    below: 25
  - platform: device
    type: turned_on
    entity_id: switch.laundryth833_laundry
    domain: switch
    for:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
condition:
  - condition: device
    type: is_on
    entity_id: switch.laundryth833_laundry
    domain: switch
    for:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - type: is_value
    condition: device
    entity_id: sensor.laundryth833_am2301_dewpoint
    domain: sensor
    below: 20
  - type: is_humidity
    condition: device
    entity_id: sensor.laundryth833_am2301_humidity
    domain: sensor
    below: 30
  - type: is_temperature
    condition: device
    entity_id: sensor.laundryth833_am2301_temperature
    domain: sensor
    above: 45
action:
  - type: turn_off
    entity_id: switch.laundryth833_laundry
    domain: switch
mode: restart

In reading this now as submitting it, I suppose the trigger could just be a timed event and a first condition is that the dryer is on? I don’t really want the test to be checking if the dryer wasn’t on to begin with.

If there is no set sequence that those items could occur in then the only way you can accomplish what you want is to do it the way you are now.

tho you could probably get rid of the “on for at least 1 minute” trigger since the other conditions being true will likely not all happen if the dryer has been on for less than a minute. So it should be unnecessary to trigger on that. But you know the dryer better than I do so if you think you need it it won’t hurt to leave it in.