Different humidity sensors with different automations

Do you have a question?

In your previous post you stated “it works as intended”…

I was mentioning that I hope it works as intended . Not that it’s running yet.

There are a couple issues with the condition:

This may be on purpose, but it is only set to work on Wednesday… If you want the automation to work all the time, you need to fix that part.

The second issue is much more important. The current time will only be both `after sensor.sun_next_dusk and before sensor.sun_next_dawn for a few milliseconds… You should use either Numeric State conditions or templates Conditions instead.

Just FYI, you can use trigger ID’s more than once. That way you avoid having to have repetitive Options in the Choose action:

alias: Biru Blaze HFC WedNite 95%
description: "fan controls humidity of enclosure by set temps"
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.biru_blaze_sensor_humidity
    above: 95
    id: "Biru Blaze fan-on"
  - platform: homeassistant
    event: start
    id: "Biru Blaze fan-on"
  - platform: numeric_state
    entity_id:
      - sensor.biru_blaze_sensor_humidity
    below: 93
    id: "Biru Blaze fan-off"
condition:
  - alias: "Sun elevation is between dusk and dawn: overnight"
    condition:  numeric_state
    entity_id: sun.sun
    attribute: elevation
    below: -6
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "Biru Blaze fan-on"
        sequence:
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.biru_blaze_fan
      - conditions:
          - condition: trigger
            id:
              - "Biru Blaze fan-off"
        sequence:
          - service: switch.turn_off
            target:
              entity_id: switch.biru_blaze_fan
            data: {}
mode: single

The {} after data: is auto-populated by the automation editor, you do not need to do anything to it.

aaah yes you noticed the date. soo what this is simulating is the humidity levels of the spiders origin. so what i did was checked out the weather website for 10 days and created automations for during the day with the humidity of its location, then the same for the night. then i followed that by checking the humidity for each day so that the humidity for each day and night is its own automation

ok so like the trigger ID biru fan-on, use that for the homeassistant start instance. ok ill work on adjusting that…

so what are your thoughts on duplicating this yaml script and only tweaking it accordingly for each device sensor and fan ( basically not having to right this out over and over). or is the duplicate script function not to be trusted?

once again thank you for all the help. once this is ironed out and spiders are safe i will have another … idea im working on having to do with me desiging some things then coding. ultimate goal is to mimic environment for animals in a more fluid way with an automated system that takes account for different days and seasons . now i dont know how to use a weather API to generate the humidity temps but maybe one day thats the next big step.

As far as I know the Duplicate function should be working, but it’s not something I have needed to use in a while.

This isn’t necessary, it’s just a little easier to read. The way you had it with three trigger ID’s and three Options in the Choose will work.

Hmm I know this is probably a dumb question buuut , does home assistant use the state of the phones status to run automations ? Asking because I had everything running last night . And when I wake up all my humidity levels are way above where the triggers should activate ( 99% humidity when the trigger is set to turn fan on at above 70%).
Only thing I could thing of is my phone may be causing them to stop maybe when I have do not disturb on ( I’m hoping I’m dead wrong but I can’t figure out what would cause this).

No, your phone being in DND mode should not have a effect on the automations unless you have set that as a condition.

Post the automation that you are currently using. I know it seems repetitive to have to keep providing these, but small changes can create problems so it’s best if everyone is working from current information.


alias: Salem Ornamental HFC SatDay 88% state
description: "fan controls humidity of enclosure by set temps "
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.salem_ornamental_sensor_humidity
    above: 88
    id: "Salem Ornamental fan-on "
  - platform: homeassistant
    event: start
    id: "Home assistant start fan-on "
  - platform: numeric_state
    entity_id:
      - sensor.salem_ornamental_sensor_humidity
    below: 86
    id: "Salem Ornamental fan-off "
condition:
  - condition: time
    after: sensor.sun_next_dawn
    before: sensor.sun_next_dusk
    weekday:
      - sat
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "Salem Ornamental fan-on "
        sequence:
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.salem_ornamental_fan
      - conditions:
          - condition: trigger
            id:
              - "Salem Ornamental fan-off "
        sequence:
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.salem_ornamental_fan
      - conditions:
          - condition: trigger
            id:
              - "Home assistant start fan-on "
        sequence:
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.salem_ornamental_fan
mode: queued

How I had to start them this morning was, go to the UI and turn the fans physically on , once they achieve the humidity I had set then the automations begin to work ( turn off and on the fans with the specified parameters).

Also thank you all for really assisting me with this.

There are some issues…

  1. The condition change recommended in Post #23 was not made to this automation.
    If you want to keep the weekday specificity, you can, but it’s going to make debugging more annoying because you will have to check 2 automations to know what happened overnight.

  2. As explained in the guide linked in Post #6 and the Numeric State trigger docs, numeric state triggers only fire when they cross the threshold of the given value. Since your condition limits when the fans can run, occasionally the tank humidity will already be above the value when dusk comes. You need to account for that (as well as the converse situation where the fan may be running when dawn is passed) by adding triggers and mirroring them in the conditional logic.

alias: Salem Ornamental HFC SatDay 88% state
description: "fan controls humidity of enclosure by set temps"
trigger:
  - platform: homeassistant
    event: start
    id: start
  - platform: numeric_state
    entity_id: sensor.salem_ornamental_sensor_humidity
    above: 88
    id: "on"
  - platform: numeric_state
    entity_id: sun.sun
    attribute: elevation
    below: -6
    id: dusk
  - platform: numeric_state
    entity_id: sensor.salem_ornamental_sensor_humidity
    below: 86
    id: "off"
  - platform: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: -6
    id: dawn
condition:
  - condition: time
    weekday:
      - sat      
action:
  - choose:
      - alias: When to turn the fan on
        conditions:
          - or:
              - alias: Triggered by high humidity and between dusk and dawn
                and:
                  - condition: trigger
                    id: "on" 
                  - condition: numeric_state
                    entity_id: sun.sun
                    attribute: elevation
                    below: -6
              - alias: Dusk is reached and the humidity is aleady high
                and:
                  - condition: trigger
                    id: "dusk" 
                  - condition: numeric_state
                    entity_id: sensor.salem_ornamental_sensor_humidity
                    above: 88
              - alias: Home Assistant restarts, the humidity is high, and it's between dusk and dawn
                and:
                  - condition: trigger
                    id: "start"
                  - condition: numeric_state
                    entity_id: sun.sun
                    attribute: elevation
                    below: -6 
                  - condition: numeric_state
                    entity_id: sensor.salem_ornamental_sensor_humidity
                    above: 88 
        sequence:
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.salem_ornamental_fan
      - alias: When to turn the fan off
        conditions:
          - or:
              - alias: Triggered by low humidity and between dusk and dawn
                and:
                  - condition: trigger
                    id: "off" 
                  - condition: numeric_state
                    entity_id: sun.sun
                    attribute: elevation
                    below: -6
              - alias: Dawn is reached
                and:
                  - condition: trigger
                    id: "dawn"
              - alias: Home Assistant restarts, the humidity is low, and it's between dusk and dawn
                and:
                  - condition: trigger
                    id: "start"
                  - condition: numeric_state
                    entity_id: sun.sun
                    attribute: elevation
                    below: -6 
                  - condition: numeric_state
                    entity_id: sensor.salem_ornamental_sensor_humidity
                    below: 86
        sequence:
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.salem_ornamental_fan
mode: queued

If you really want to avoid repetitive automations, you should think about setting up a Generic Hygrostat for each of your tanks. Generic Hygrostat is basically a virtual dehumidifier, so the integration handles monitoring humidity and switching on and off and you can focus on automating when the setpoints need to change and when the whole thing needs to be enabled or diasbled.

haha thank you. This rabit hole I have entered is going to get interesting i see.
Ok so I followed instructions in reference to Generic Hygrostat and also found a youtube Create a Generic Thermostat control for simple temp .
i didnt have file editor or supervisor so i looked up how to install and have them running( reboot saved me when neither would start up).
I followed his steps in reference to creating a new folder within File editor then within that foulder I created a new file.

generic_hygrostat:
  - name: Salem Ornamental humidity control Sunday 88%
    dehumidifier: Switch.salem_ornamental_fan
    target_sensor: sensor.salem_ornamental_sensor_humidity
    min_humidity: 83
    max_humidity: 90
    target_humidity: 88
    dry_tolerance: 3
    wet_tolerance: 0
    device_class: "dehumidifier"
    min_cycle_duration:
      seconds: 5
    keep_alive:
      minutes: 3
    initial_state: true
    away_humidity: 35
    away_fixed: false
    sensor_stale_duration: 00:15:00
     time
    after: sensor.sun_next_dawn
    before: sensor.sun_next_dusk
    weekday:
       sun

currently watching Home Assistant 101: Splitting Your Configuration
to learn a bit more in this process

ok ladies and gentlemen, thank you for the input on all this. the splitting configurations for whatever reason hasnt worked for me and its time for me to get some sleep ( been up since 8 AM yesterday between work and this). ill keep you posted on the original automation setup since i legitimately went into a deep dive on trying to organize everyone so the configuration.yaml could be completed in a way how Home Assistant 101: Splitting Your Configuration video was setup up but it would not take and continue to send a Invalid config for ‘panel_custom’ at configuration.yaml, line 21: ‘intergration_custom’ is an invalid option for ‘panel_custom’, check: panel_custom->0->intergration_custom"
i know its me thats the issue ha so its time to get some wrest and wish for the best on the other automations until i can learn all the other complicated parts of HA.
have a great weekend and thank you .

First, as I have stated a few times, the Time condition you keep using will not work the way you want it to.

Second, those are not valid configuration variables for Generic Hygrostat. Anything that is not in this list is invalid for that specific integration.

Generic Hygrostat Config
generic_hygrostat:
  - name: Salem Ornamental
    dehumidifier: switch.salem_ornamental_fan
    target_sensor: sensor.salem_ornamental_sensor_humidity
    min_humidity: 83
    max_humidity: 90
    target_humidity: 88
    dry_tolerance: 3
    wet_tolerance: 0
    device_class: "dehumidifier"
    min_cycle_duration:
      seconds: 5
    keep_alive:
      minutes: 3
    initial_state: true
    away_humidity: 35
    away_fixed: false
    sensor_stale_duration: 00:15:00

The Generic Hygrostat configuration above will create a new entity with the entity ID, humidifier.salem_ornamental. You should only create 1 humidifier entity for each sensor-fan pair. Then, your automations will call services on those “humidifiers”.

The following is a basic example of how you could automate turning an entity from Generic Hygrostat “on” at dusk and “off” at dawn.

Generic Hygrostat: Dawn/Dusk
alias: Salem Ornamental HFC
trigger:
  - platform: numeric_state
    entity_id: sun.sun
    attribute: elevation
    below: -6
    id: dusk
  - platform: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: -6
    id: dawn
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: dusk
        sequence:
          - service: humidifier.turn_on
            data:
              entity_id: humidifier.salem_ornamental
      - conditions:
          - condition:
            id: dawn
        sequence:
          - service: humidifier.turn_off
            data:
              entity_id: humidifier.salem_ornamental
mode: single

The available services include being able to change the target humidity, so if you need different humidity values on different days or times of the year, that could be incorporated as well.

1 Like

You should try packages! They are in my opinion the best and easiest way to split the configuration. Easier than all other, like in the video. :slight_smile:

They are a more logical approach to the split, as you can use them much more flexible. In a nut shell, with packages you can sort your files by your logic, and not the logic your devices dictate.

1 Like

Morning fellas , just woke up after finally crashing for 12 hours of sleep ( I average 3 hours a day but one day out of the 6 my body just shuts down). I’ll look into it, I tried working on having the configuration.yaml look back at the folder but it just kept giving me errors. I have a clearer mind today so I’ll see if I achieve anything or just more confusion :sweat_smile:.

Also didgeridrew thank you for the details on how to write the yaml code on specifying sunrise and sunset. I’m going to copy and create all the codes that way for now . And once I can understand the generic-hygro I’ll switch over to that ( I did like being able to see it on the UI providing details of what’s happening ). I got stuck on adding more then just one so I had decided that would be something to look into on another date .

1 Like

I wanted to say thank you to all of your for giving me a hand on having this system working as needed to have these tanks working within spec. Excited for other things to work on but this specific automation is a huge win. I may have lost sleep for the past 3 weeks but now that it’s working I have gained a peace of mind. Thank you guys once again.

2 Likes