Smart Automatic Chicken Coop Door

I have been working on a Home Assistant integration for the Omlet Smart Chicken Coop Door - GitHub - krozgrov/ha-omlet-integration: Custom Home Assistant integration for Omlet devices, enabling monitoring and control of Autodoors and related devices. Includes features like battery level monitoring, door/light control, and real-time updates via API., it’s still a work in progress but I have a lot of the functionality working. Omlet has a great, well documented SDK! You can send commands like door (open/close) and light (on/off) and view all of the information availability from the API. Feedback appreciated, go easy its my first integration attempt. I want to be able to use the Sun2 integration to send the current sun rise and set times to the door. The light sensor works fine but with tree coverage it’s not always accurate. Cheers! Hope someone finds this useful!

3 Likes

I just wanted to say thank you! We’re using this on our new Chicken Coop Dashboard and it works perfectly.

1 Like

Hi Matthew,
I’ve certainly found this useful. I just replaced an ‘old’ Omlet door controller with the new wifi one. This integration you’ve made is great to make it really sing (so to speak).
I’ll be adding a second door to another part of the coop and I hope just adding it along side the existing one in the existing integration will be easy.
Thanks so much for the time and effort you’ve put into this - much appreciated - it’ll help keep our chooks safe at night and in the early morning.
Cheers
Stephen Jeffers

1 Like

My wife bought an Omlet door a while ago because we were preparing for chickens. It took a while but finally our first three chickens arrived this past week. I had checked the Omlet/Home Assistant situation before but nobody had done anything yet. Thinking I’d have to integrate things myself, I decided to give it another Google search and found your integration. I tried it and as far as I can tell, it works very well. My wife will be very happy with this. Will definitely buy you a coffee.

1 Like

Thanks for the kind words and coffee!!!

Thank you very much for this integration, Matthew!

I made an automation that sets the door’s open time to 15 minutes before sunrise and the door’s close time to 30 minutes after sunset. The automation is triggered every Monday and Thursday at 12:00h.
The automation also sets the door’s “Deep Sleep” time 5 minutes after the closing time and 5 minutes before the opening time.

Thought this might be helpful for folks that are looking to get the door to open and close based on sunset/sunrise times.

(Obviously, the door’s setting needs to be set to “Time” in the app. Also, the “Sun” integration needs to be installed in Home Assistant.)

alias: Set open and close time chicken coop
description: ""
triggers:
  - trigger: time
    at: "12:00:00"
    weekday:
      - mon
      - thu
conditions: []
actions:
  - action: time.set_value
    target:
      entity_id:
        - time.chicken_coop_open_time
    data:
      time: >-
        {{ as_timestamp(states.sun.sun.attributes.next_rising | as_datetime -
        timedelta(minutes=15)) | timestamp_custom('%H:%M') }} 
  - action: time.set_value
    target:
      entity_id:
        - time.chicken_coop_overnight_sleep_end_time
    data:
      time: >-
        {{ as_timestamp(states.sun.sun.attributes.next_rising | as_datetime -
        timedelta(minutes=20)) | timestamp_custom('%H:%M') }}
  - action: time.set_value
    target:
      entity_id: time.chicken_coop_close_time
    data:
      time: >-
        {{ as_timestamp(states.sun.sun.attributes.next_setting | as_datetime +
        timedelta(minutes=30)) | timestamp_custom('%H:%M') }}
  - action: time.set_value
    target:
      entity_id:
        - time.chicken_coop_overnight_sleep_start_time
    data:
      time: >-
        {{ as_timestamp(states.sun.sun.attributes.next_setting | as_datetime +
        timedelta(minutes=35)) | timestamp_custom('%H:%M') }} 
mode: single

1 Like

I released an update today that included support for webhooks among other improvements. It’s that so many people are enjoying this integration! Cheers!!!

Hello, thank you for creating this integration!

I have just installed Home Assistant and integrating our two Omlet coops is the first “real” thing I have tried in HA. My intent is to be able to automate changing door open and closing times based upon the sunrise and sunset for my location.

Am I correct that this is not yet possible with this integration at this time because the door open and shut times are “diagnostic” and thus not assignable within HA?

Also, is the YAML automation two posts up something that can work with this integration?

Thank you and sorry for the beginner questions.

Hi @alpinel - you can ABSOLUTELY do this with this integration. The door open and shut function can be called by using Actions in your automation. What I do is update the schedule everynight to follow the sunrise / sunset time. Here is my YAML.

alias: Chicken Coop - Master Control
description: Handles battery alerts, nesting box notifications, and door schedules.
triggers:
  - entity_id:
      - sensor.temperature_humidity_sensor_lite_4_battery_state
    id: low_battery
    trigger: state
    to: Low
  - type: not_opened
    device_id: 17ee1897a72173cd750eaa100ba06a12
    entity_id: 165bd7f75c9219ea5ae81db2b0b9ebb2
    domain: binary_sensor
    id: nesting_box_closed
    trigger: device
  - event: sunset
    offset: "-00:15:00"
    id: nesting_box_still_open
    trigger: sun
  - event: sunrise
    offset: "01:00:00"
    id: nesting_box_reminder
    trigger: sun
  - at: "00:05:00"
    id: update_schedule
    trigger: time
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: low_battery
        sequence:
          - data:
              title: Chicken Coop - Low Battery
              message: Temperature Sensor battery is low
            action: notify.mobile_app_spacesloth15pro
          - data:
              title: Chicken Coop - Low Battery
              message: Temperature Sensor battery is low
            action: notify.mobile_app_poopphone17promax
      - conditions:
          - condition: trigger
            id: nesting_box_closed
          - condition: state
            entity_id: input_boolean.nesting_box_lights_changed
            state: "on"
        sequence:
          - target:
              entity_id: scene.before_red
            action: scene.turn_on
            data: {}
          - target:
              entity_id: input_boolean.nesting_box_lights_changed
            action: input_boolean.turn_off
            data: {}
          - data:
              title: Chicken Coop - Nesting Box
              message: The nesting box is now closed
            action: notify.mobile_app_spacesloth15pro
          - data:
              title: Chicken Coop - Nesting Box
              message: The nesting box is now closed
            action: notify.mobile_app_poopphone17promax
      - conditions:
          - condition: trigger
            id: nesting_box_still_open
          - condition: device
            type: is_open
            device_id: 17ee1897a72173cd750eaa100ba06a12
            entity_id: 165bd7f75c9219ea5ae81db2b0b9ebb2
            domain: binary_sensor
        sequence:
          - data:
              scene_id: before_red
              snapshot_entities:
                - light.wall_light_back_yard_2
                - light.hot_tub_lights
            action: scene.create
          - target:
              device_id:
                - 1960320fe2aacd33be1d9119e8da2093
                - b507769e01276f582761178c16a7d522
            data:
              rgb_color:
                - 97
                - 24
                - 124
              brightness_pct: 100
            action: light.turn_on
          - target:
              entity_id: input_boolean.nesting_box_lights_changed
            action: input_boolean.turn_on
            data: {}
          - data:
              title: Chicken Coop - Nesting Box
              message: The nesting box is still open
            action: notify.mobile_app_spacesloth15pro
          - data:
              title: Chicken Coop - Nesting Box
              message: The nesting box is still open
            action: notify.mobile_app_poopphone17promax
      - conditions:
          - condition: trigger
            id: nesting_box_reminder
          - condition: device
            type: is_not_open
            device_id: 17ee1897a72173cd750eaa100ba06a12
            entity_id: 165bd7f75c9219ea5ae81db2b0b9ebb2
            domain: binary_sensor
        sequence:
          - data:
              title: Chicken Coop - Nesting Box
              message: Nesting Box is still closed, the girls want to lay eggs!
            action: notify.mobile_app_spacesloth15pro
          - data:
              title: Chicken Coop - Nesting Box
              message: Nesting Box is still closed, the girls want to lay eggs!
            action: notify.mobile_app_poopphone17promax
      - conditions:
          - condition: trigger
            id: update_schedule
        sequence:
          - target:
              device_id:
                - 97191a38686dabe828e147c7028df45f
                - 6e4f8bf80778efc66dabca31a3c87d9e
            data:
              door_mode: time
              open_time: >-
                {{ states('sensor.sun_next_rising') | as_datetime | as_timestamp
                | timestamp_custom('%H:%M', true) }}
              close_time: >-
                {{ (states('sensor.sun_next_setting') | as_datetime +
                timedelta(minutes=30)) | as_timestamp |
                timestamp_custom('%H:%M', true) }}
            action: omlet_smart_coop.update_door_schedule
mode: single
1 Like

Thank you for the quick and thorough response. I have tried to reduce your above code to just cover updating the door open and close times based upon sunrise and sunset.

Below is what I am attempting to save in HA’s YAML editor in the automation section. I keep getting the error message(or a close variation ther of):

Message malformed: extra keys not allowed @ data[‘actions’][0][‘conditions’]

I have tried some things, sometimes creating other error messages, but I cannot get rid of the above.

I would appreciate any suggestions you might have. Thank you!

alias: Chicken Coop - Master Control
description: Handles door schedules.
triggers:
  - at: "00:05:00"
    id: update_schedule
    trigger: time
actions:
  - choose:
          - conditions:
            - condition: trigger
              id: update_schedule
            sequence:
              - target:
                  device_id:
                    - 5686113784f3d222e4e5439f2f940f42
                  data:
                    door_mode: time
                    open_time: >-
                      {{ (states('sensor.sun_next_rising') | as_datetime + timedelta(minutes=5)) | as_timestamp | timestamp_custom('%H:%M', true) }}
                    close_time: >-
                      {{ (states('sensor.sun_next_setting') | as_datetime + timedelta(minutes=-5)) | as_timestamp | timestamp_custom('%H:%M', true) }}
                action: omlet_smart_coop.update_door_schedule
mode: single

That error usually means there is an indentation problem in your YAML. Try this or I would suggest using the GUI for automation.

alias: Chicken Coop - Master Control
description: Handles door schedules.
trigger:
  - platform: time
    at: "00:05:00"
    id: update_schedule

action:
  - choose:
      - conditions:
          - condition: trigger
            id: update_schedule
        sequence:
          - service: omlet_smart_coop.update_door_schedule
            data:
              door_mode: time
              open_time: >-
                {{ (states('sensor.sun_next_rising') | as_datetime + timedelta(minutes=5)) | as_timestamp | timestamp_custom('%H:%M', true) }}
              close_time: >-
                {{ (states('sensor.sun_next_setting') | as_datetime + timedelta(minutes=-5)) | as_timestamp | timestamp_custom('%H:%M', true) }}
            target:
              device_id: 5686113784f3d222e4e5439f2f940f42

mode: single

That worked, thank you. Rookie mistake. :slight_smile: My past programming experience was in languages where formatting is generally cosmetic only.

This just successfully updated the open/close times of one of my coops.

Thanks again!

Anytime! YAML is super sensitive to indentation. Just a FYI, the integration also fully supports the Omlet Smart Fan!

Thanks Again!

Great stuff @krozgrov much appreciated.