Any experienced guys want to double check my chicken coop automations?

I am trying to prepare my chicken coop for the winter and these are the automations I am currently unable to test until I do a little more work on it. Do they look right to you?

Turn fan on when humidity rises above 70%, off below 60%.

  - alias: "Humidity Control On"
    trigger:
      - platform: numeric_state
        entity_id: sensor.humidity
        above: 70
    action:
      - service: switch.turn_on
        data:
          entity_id:
            - switch.fan
  - alias: "Humidity Control Off"
    trigger:
      - platform: numeric_state
        entity_id: sensor.humidity
        below: 60
    action:
      - service: switch.turn_off
        data:
          entity_id:
            - switch.fan

Turn heat lamp on when temperature drops below 20F and off at 30F.

    - alias: "Heat Lamp ON"
      trigger:
         - platform: numeric_state
         entity_id: sensor.temperature
         below: 20
      action:
        - service: switch.turn_on
          data:
            entity_id:
              - switch.heat_lamp
    - alias: "Heat Lamp OFF"
      trigger:
         - platform: numeric_state
         entity_id: sensor.temperature
         above: 30
      action:
        - service: switch.turn_off
          data:
            entity_id:
              - switch.heat_lamp

Water Heater on when temperatures reach 35F, off when temperatures reach 45F.

    - alias: "Water Heater ON"
      trigger:
         - platform: numeric_state
         entity_id: sensor.temperature
         below: 35
      action:
        - service: switch.turn_on
          data:
            entity_id:
              - switch.water_heater
    - alias: "Heat Lamp OFF"
      trigger:
         - platform: numeric_state
         entity_id: sensor.temperature
         above: 45
      action:
        - service: switch.turn_off
          data:
            entity_id:
              - switch.water_heater

Seems fine.

But why aren’t you using a Generic Thermostat for the temperature control?

Your indentation is out of whack in a number of places. e.g. This:

      trigger:
         - platform: numeric_state
         entity_id: sensor.temperature
         below: 20

Should be:

  trigger:
    - platform: numeric_state
      entity_id: sensor.temperature
      below: 20

Thanks for this. Is there any advantage to using generic thermostat over my automation?

Typo on my part. Noted.

You can easily change the set points for the heat lamp or fan from the thermostat Lovelace cards if needed, rather than editing your automation. You also get current temperature, set point and state in one nice control and the ability to manually override operation.

Ah got it. I’ll give it a shot. These are pretty permanent set points (chicken coop, not my home) so I don’t think that will be necessary. For practice though, how does this look?

climate:
  - platform: generic_thermostat
    name: "Coop Heat Lamp"
    heater: switch.heat_lamp
    target_sensor: sensor.heat_lamp
    min_temp: 20
    max_temp: 30
    ac_mode: false
    target_temp: 25
climate:
  - platform: generic_thermostat
    name: "Coop Aquarium Heater"
    heater: switch.water_heater
    target_sensor: sensor.temperature
    min_temp: 35
    max_temp: 45
    ac_mode: false
    target_temp: 40

I’m a little confused as to minimum, target, and max temperature settings. Does this mean that the light will click on at 20, off at 30, and try to maintain around 25? How about minimum cycle duration? In my case, ie: heat lamp, there is really no reason to have a minimum cycle duration. I can understand an HVAC system not wanting to click on and off every 10 seconds but I don’t really see the point in this particular example.

max_temp: …not max_temp_ ok you edited that now put a space before the number.

The max and min are the range you can adjust the set point over.

The tolerance settings (along with the set point) control when it will be on or off. If you have a set point of 25 and a heat and cold tolerance both set to 5, it will turn on at 20 and off at 30.

As for the min cycle time, it’s optional. Leave it out if you dont need it.

How about “heater:” if I am using it for cooling? Is that what “ac_mode: true” is for? Thanks for your help. I am learning slowly.

Put the entity id of your switch in heater: and set ac_mode: to true for cooling.

Basically everything tom_I said. Note that you can also use the generic thermostat as a humidity control as well…if you alter your sensor to report your humidity % as F or C, then set up a generic thermostat using that sensor. As long as it doesn’t drive you insane seeing humidity displayed as a temperature. :slight_smile:

Thank you all. Think you can help me out with a few more?

# CHICKEN COOP WHITE LIGHT ON AT SUNSET

#  - alias: "Chicken Coop Supplemental Light ON at Sunset"
#    trigger:
#      - platform: sun
#        event: sunset
#        offset: "-00:30:00"
#    action:
#      - service: switch.turn_on
#        data:
#          entity_id:
#            - SUPPLEMENTAL_LIGHT.SWITCH
#  - alias: "Chicken Coop Supplemental Light OFF at 9:30PM"
#    trigger:
#      - platform: time
#        at: '21:30'
#    action:
#      - service: homeassistant.turn_off
#        data:
#          entity_id:
#            - SUPPLEMENTAL_LIGHT.SWITCH

^^ Here is my supplemental lighting automation. I have it currently set to turn on a half hour before sunset and off at 9:30PM. In order for me not to shock my chickens and provide a more natural sunset, how do I transition to dim the bulb over x amount of seconds? I have tried this:

#  - alias: "Chicken Coop Supplemental Light OFF at 9:30PM"
#    trigger:
#      - platform: time
#        at: '21:30'
#    action:
#      - service: homeassistant.turn_off
#        data:
#          entity_id:
#            - SUPPLEMENTAL_LIGHT.SWITCH
#          transition: 600

I am getting errors about proper indentation when I add the transition variable though. Any thoughts?

Entity ids are always lower case. If you are unsure look in the developer tools / states menu.

Thanks tom_l. That was just a placeholder. My actual automation right now is as follows:

automations.yaml:

# CHICKEN COOP WHITE LIGHT ON AT SUNSET

  - alias: "Chicken Coop Supplemental Light ON at Sunset"
    trigger:
      - platform: sun
        event: sunset
        offset: "-00:30:00"
    action:
      - service: light.turn_on
        entity_id: light.coop_supplemental_lighting
        data:
          brightness: 150
      
  - alias: "Chicken Coop Lights Off TEST"
    trigger:
      platform: time
      at: '21:00:00'
    action:
      - service: scene.turn_on
        entity_id: scene.chicken_coop_supplemental_lighting_off

scenes.yaml:

  - name: Chicken Coop Supplemental Lighting Off
    entities:
        light.coop_supplemental_lighting:
            state: off
            transition: 30

No matter what I do (whether I am using scenes, automations, et cetera), the best I can get is for the light to turn off without dimming. I am using a TP-Link Kasa KL110 wi-fi dimmable bulb. Thinking it’s not a problem with my coding at this point. Any suggestions?

you could search for the supported features of your lamp, my guess is that its not supported. but perhaps you could set is as:

    action:
      - service: light.turn_on
        entity_id: light.coop_supplemental_lighting
        data:
           brightness: 150
           transition: 30
    action:
      - service: light.turn_off
        entity_id: light.coop_supplemental_lighting
        data:
           transition: 30

Thanks. Any idea how I can find out if this is a supported feature? The light does respond to setting brightness and is marketed as dimmable. It’s a Kasa KL110