{"id":20548590,"url":"https://github.com/benleb/ad-automoli","last_synced_at":"2025-04-14T10:53:43.501Z","repository":{"id":35429824,"uuid":"200470972","full_name":"benleb/ad-automoli","owner":"benleb","description":"💡 Fully automatic light management based on conditions like motion, illuminance, humidity, and other clever features","archived":false,"fork":false,"pushed_at":"2023-09-12T14:57:04.000Z","size":622,"stargazers_count":111,"open_issues_count":25,"forks_count":30,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-28T00:11:11.231Z","etag":null,"topics":["app","appdaemon","appdaemon-apps","auto-discovery","automoli","docker","hacs","home-assistant","hue","humidity","lights","motion-sensors","python","room","scenes"],"latest_commit_sha":null,"homepage":"https://github.com/benleb/ad-automoli","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benleb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"benleb"}},"created_at":"2019-08-04T08:57:24.000Z","updated_at":"2025-03-14T14:55:46.000Z","dependencies_parsed_at":"2022-08-17T21:31:12.156Z","dependency_job_id":null,"html_url":"https://github.com/benleb/ad-automoli","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benleb%2Fad-automoli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benleb%2Fad-automoli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benleb%2Fad-automoli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benleb%2Fad-automoli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benleb","download_url":"https://codeload.github.com/benleb/ad-automoli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248868772,"owners_count":21174757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app","appdaemon","appdaemon-apps","auto-discovery","automoli","docker","hacs","home-assistant","hue","humidity","lights","motion-sensors","python","room","scenes"],"created_at":"2024-11-16T02:13:57.689Z","updated_at":"2025-04-14T10:53:43.482Z","avatar_url":"https://github.com/benleb.png","language":"Python","funding_links":["https://github.com/sponsors/benleb"],"categories":[],"sub_categories":[],"readme":"# [![automoli](https://socialify.git.ci/benleb/ad-automoli/image?description=1\u0026font=KoHo\u0026forks=1\u0026language=1\u0026logo=https%3A%2F%2Femojipedia-us.s3.dualstack.us-west-1.amazonaws.com%2Fthumbs%2F240%2Fapple%2F237%2Felectric-light-bulb_1f4a1.png\u0026owner=1\u0026pulls=1\u0026stargazers=1\u0026theme=Light)](https://github.com/benleb/ad-automoli)\n\n\u003c!-- # AutoMoLi - **Auto**matic **Mo**tion **Li**ghts --\u003e\n\n\u003c!-- [![python_badge](https://img.shields.io/static/v1?label=python\u0026message=3.8%20|%203.9\u0026color=blue\u0026style=flat)](https://www.python.org) [![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/hacs/integration) --\u003e\n\nFully *automatic light management* based on motion as [AppDaemon](https://github.com/home-assistant/appdaemon) app.  \n\n🕓 multiple **daytimes** to define different scenes for morning, noon, ...  \n💡 supports **Hue** (for Hue Rooms/Groups) \u0026 **Home Assistant** scenes  \n🔌 switches **lights** and **plugs** (with lights)  \n☀️ supports **illumination sensors** to switch the light just if needed  \n💦 supports **humidity sensors** as blocker (the \"*shower case*\")  \n🔍 **automatic** discovery of **lights** and **sensors**  \n⛰️ **stable** and **tested** by many people with different homes  \n\n## Getting Started\n\n### Docker Image (`amd64`, `arm` and `arm64`)\n\nYou can try [**AutoMoLi**](https://github.com/benleb/ad-automoli) via [Docker](https://hub.docker.com/r/benleb/automoli) without installing anything! The Image is the default [AppDaemon](https://github.com/AppDaemon/appdaemon) one with AutoMoLi and a simple default configuration added. See the [AppDaemon Docker Tutorial](https://appdaemon.readthedocs.io/en/latest/DOCKER_TUTORIAL.html) on how to use it in general.  \n\n[**AutoMoLi**](https://github.com/benleb/ad-automoli) expects motion sensors and lights including a `room` name. The exact patterns are listed in [Auto-Discovery of Lights and Sensors](https://github.com/benleb/ad-automoli#auto-discovery-of-lights-and-sensors) You can set a `room` with the **AUTOMOLI_ROOM** variable in the Docker *run* command.\n\n```bash\ndocker run --rm --interactive --tty --name AutoMoLi \\\n--env HA_URL=\"\u003cHA URL\u003e\" \\\n--env TOKEN=\"\u003cHA Token\u003e\" \\\n--env AUTOMOLI_ROOM=\"bathroom\" \\\n--ports 5050:5050 \\\nbenleb/automoli:latest\n```\n\nPort 5050 is opened to give access to the AppDaemon Admin-UI at \u003chttp://127.0.0.1:5050\u003e\n\n#### Example\n\nTo test AutoMoLi in your **Esszimmer** (german for dining room), use `... --env AUTOMOLI_ROOM=\"esszimmer\" ...` in the Docker *run* command.\n\n* AppDaemon will show you its config file on startup: ![cfg](https://raw.githubusercontent.com/benleb/ad-automoli/master/.github/cfg.png)\n\n* If everything works, AutoMoLi will show you the configuration it has parsed, including the discovered sensors: ![cfg-loaded](https://raw.githubusercontent.com/benleb/ad-automoli/master/.github/cfg_loaded.png)\n\n* This is how it looks when AutoMoLi manages your lights: ![running](https://raw.githubusercontent.com/benleb/ad-automoli/master/.github/run.png)\n\n## Installation\n\nUse [HACS](https://github.com/hacs/integration) or [download](https://github.com/benleb/ad-automoli/releases) the `automoli` directory from inside the `apps` directory here to your local `apps` directory, then add the configuration to enable the `automoli` module.\n\n### Example App Configuration\n\nAdd your configuration to appdaemon/apps/apps.yaml, an example with two rooms is below.\n\n```yaml\nlivingroom:\n  module: automoli\n  class: AutoMoLi\n  room: livingroom\n  disable_switch_entities:\n    - input_boolean.automoli\n    - input_boolean.disable_my_house\n  delay: 600\n  daytimes:\n      # This rule \"morning\" uses a scene, the scene.livingroom_morning Home Assistant scene will be used\n    - { starttime: \"sunrise\", name: morning, light: \"scene.livingroom_morning\" }\n\n    - { starttime: \"07:30\", name: day, light: \"scene.livingroom_working\" }\n\n      # This rule\"evening\" uses a percentage brightness value, and the lights specified in lights: below will be set to 90%\n    - { starttime: \"sunset-01:00\", name: evening, light: 90 }\n\n    - { starttime: \"22:30\", name: night, light: 20 }\n\n      # This rule has the lights set to 0, so they will no turn on during this time period\n    - { starttime: \"23:30\", name: more_night, light: 0 }\n\n  # If you are using an illuminance sensor you can set the lowest value here that blocks the lights turning on if its already light enough\n  illuminance: sensor.illuminance_livingroom\n  illuminance_threshold: 100\n\n  # You can specify a light group or list of lights here\n  lights:\n    - light.livingroom\n\n  # You can specify a list of motion sensors here\n  motion:\n    - binary_sensor.motion_sensor_153d000224f421\n    - binary_sensor.motion_sensor_128d4101b95fb7\n\n  # See below for info on humidity\n  humidity:\n    - sensor.humidity_128d4101b95fb7\n\n\nbathroom:\n  module: automoli\n  class: AutoMoLi\n  room: bathroom\n  delay: 180\n  motion_state_on: \"on\"\n  motion_state_off: \"off\"\n  daytimes:\n    - { starttime: \"05:30\", name: morning, light: 45 }\n    - { starttime: \"07:30\", name: day, light: \"scene.bathroom_day\" }\n    - { starttime: \"20:30\", name: evening, light: 100 }\n    - { starttime: \"sunset+01:00\", name: night, light: 0 }\n\n  # As this is a bathroom there could be the case that when taking a bath or shower, motion is not detected and the lights turn off, which isnt helpful, so the following settings allow you to use a humidity sensor and humidity threshold to prevent this by detecting the humidity from the shower and blocking the lights turning off.\n  humidity:\n    - sensor.humidity_128d4101b95fb7\n  humidity_threshold: 75\n\n  lights:\n    - light.bathroom\n    - switch.plug_68fe8b4c9fa1\n  motion:\n    - binary_sensor.motion_sensor_158d033224e141\n```\n\n## Auto-Discovery of Lights and Sensors\n\n[**AutoMoLi**](https://github.com/benleb/ad-automoli) is built around **rooms**. Every room or area in your home is represented as a seperate app in [AppDaemon](https://github.com/AppDaemon/appdaemon) with separat light setting. In your configuration you will have **one config block** for every **room**, see example configuration.  \nFor the auto-discovery of your lights and sensors to work, AutoMoLi expects motion sensors and lights including a **room** name (can also be something else than a real room) like below:\n\n* *sensor.illumination_`room`*\n* *binary_sensor.motion_sensor_`room`*\n* *binary_sensor.motion_sensor_`room`_something*\n* *light.`room`*\n\nAutoMoLi will detect them automatically. Manually configured entities will take precedence, but **need** to follow the naming scheme above.\n\n## Configuration Options\n\nkey | optional | type | default | description\n-- | -- | -- | -- | --\n`module` | False | string | automoli | The module name of the app.\n`class` | False | string | AutoMoLi | The name of the Class.\n`room` | False | string | | The \"room\" used to find matching sensors/light\n`disable_switch_entities` | True | list/string | | One or more Home Assistant Entities as switch for AutoMoLi. If the state of **any** entity is *off*, AutoMoLi is *deactivated*. (Use an *input_boolean* for example)\n`only_own_events` | True | bool | | Track if automoli switched this light on. If not, an existing timer will be deleted and the state will not change\n`disable_switch_states` | True | list/string | [\"off\"] | Custom states for `disable_switch_entities`. If the state of **any** entity is *in this list*, AutoMoLi is *deactivated*. Can be used to disable with `media_players` in `playing` state for example.\n`disable_hue_groups` | False | boolean | | Disable the use of Hue Groups/Scenes\n`delay` | True | integer | 150 | Seconds without motion until lights will switched off. Can be disabled (lights stay always on) with `0`\n~~`motion_event`~~ | ~~True~~ | ~~string~~ | | **replaced by `motion_state_on/off`**\n`daytimes` | True | list | *see code* | Different daytimes with light settings (see below)\n`transition_on_daytime_switch` | True | bool | False | directly activate a daytime on its start time (instead to just set it as active daytime used if lights are switched from off to on)\n`lights` | True | list/string | *auto detect* | Light entities\n`motion` | True | list/string | *auto detect* | Motion sensor entities\n`illuminance` | True | list/string |  | Illuminance sensor entities\n`illuminance_threshold` | True | integer |  | If illuminance is *above* this value, lights will *not switched on*\n`humidity` | True | list/string |  | Humidity sensor entities\n`humidity_threshold` | True | integer |  | If humidity is *above* this value, lights will *not switched off*\n`motion_state_on` | True | integer | | If using motion sensors which don't send events if already activated, like Xiaomi do, add this to your config with \"on\". This will listen to state changes instead\n`motion_state_off` | True | integer | | If using motion sensors which don't send events if already activated, like Xiaomi do, add this to your config with \"off\". This will listen to the state changes instead.\n`debug_log` | True | bool | false | Activate debug logging (for this room)\n\n### daytimes\n\nkey | optional | type | default | description\n-- | -- | -- | -- | --\n`starttime` | False | string | | Time this daytime starts or sunrise|sunset [+|- HH:MM]\n`name` | False | string | | A name for this daytime\n`delay` | True | integer | 150 | Seconds without motion until lights will switched off. Can be disabled (lights stay always on) with `0`. Setting this will overwrite the global `delay` setting for this daytime.\n`light` | False | integer/string | | Light setting (percent integer value (0-100) in or scene entity\n\n---\n\n\u003c!-- ## Used by\n\nFeel free to add you project! --\u003e\n\n\u003c!-- ## Acknowledgments --\u003e\n\n## Meta\n\n**Ben Lebherz**: *automation lover ⚙️ developer \u0026 maintainer* - [@benleb](https://github.com/benleb) | [@ben_leb](https://twitter.com/ben_leb)\n\n\u003c!-- See also the list of [contributors](CONTRIBUTORS) who participated in this project. --\u003e\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenleb%2Fad-automoli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenleb%2Fad-automoli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenleb%2Fad-automoli/lists"}