{"id":42742222,"url":"https://github.com/anonym-tsk/zigbee2mqtt-extensions","last_synced_at":"2026-01-29T19:00:53.929Z","repository":{"id":46190848,"uuid":"454458325","full_name":"Anonym-tsk/zigbee2mqtt-extensions","owner":"Anonym-tsk","description":"Create simple automations directly in zigbee2mqtt","archived":false,"fork":false,"pushed_at":"2025-01-09T10:32:31.000Z","size":624,"stargazers_count":57,"open_issues_count":6,"forks_count":9,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-09T11:30:52.718Z","etag":null,"topics":["iot","mqtt","zigbee","zigbee2mqtt"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Anonym-tsk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-01T16:16:42.000Z","updated_at":"2025-01-09T10:32:34.000Z","dependencies_parsed_at":"2025-01-09T11:36:07.732Z","dependency_job_id":null,"html_url":"https://github.com/Anonym-tsk/zigbee2mqtt-extensions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Anonym-tsk/zigbee2mqtt-extensions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anonym-tsk%2Fzigbee2mqtt-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anonym-tsk%2Fzigbee2mqtt-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anonym-tsk%2Fzigbee2mqtt-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anonym-tsk%2Fzigbee2mqtt-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anonym-tsk","download_url":"https://codeload.github.com/Anonym-tsk/zigbee2mqtt-extensions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anonym-tsk%2Fzigbee2mqtt-extensions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28882598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T16:41:59.663Z","status":"ssl_error","status_checked_at":"2026-01-29T16:39:39.641Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["iot","mqtt","zigbee","zigbee2mqtt"],"created_at":"2026-01-29T19:00:30.346Z","updated_at":"2026-01-29T19:00:53.913Z","avatar_url":"https://github.com/Anonym-tsk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zigbee2MQTT Extensions\n\n---\n\nEnjoy my work? [Help me out](https://yoomoney.ru/to/410019180291197) for a couple of :beers: or a :coffee:!\n\n[![coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://yoomoney.ru/to/410019180291197)\n\n---\n\n## What are extensions?\n\n[Read this article](https://www.zigbee2mqtt.io/advanced/more/user_extensions.html)\n\n## [automations-extension.js](dist/automations-extension.js)\n\n**Allows you to set up simple automations directly in z2m**\n\n_Example (add this into your z2m configuration.yaml):_\n\n```yaml\nautomations:\n  automation_by_action:\n    trigger:\n      platform: action\n      entity: Test Switch\n      action: single\n    condition:\n      platform: state\n      entity: Test Switch 2\n      state: ON\n    action:\n      entity: Test Plug\n      service: toggle\n\n  automation_by_state:\n    trigger:\n      platform: state\n      entity: Test Plug\n      state: ON\n    action:\n      entity: Test Plug 2\n      service: turn_on\n\n  automation_by_numeric_state:\n    trigger:\n      platform: numeric_state\n      entity: Test Plug\n      attribute: temperatire\n      above: 17\n      below: 26\n      for: 3\n    action:\n      entity: Test Plug\n      service: turn_on\n```\n\n_More complex example:_\n\n```yaml\nautomations:\n  automation_by_action:\n    trigger:\n      platform: action\n      entity:\n      - Test Switch\n      - Test Button\n      action:\n      - single\n      - double\n      - hold\n    condition:\n      - platform: state\n        entity: Test Switch 2\n        state: ON\n      - platform: numeric_state\n        entity: My Sensor\n        attribute: temperature\n        above: 25\n        below: 35\n    action:\n    - entity: Test Plug\n      service: toggle\n    - entity: Test Plug 2\n      service: toggle\n\n  automation_by_state:\n    trigger:\n      platform: state\n      entity:\n      - Test Plug\n      - Test Plug 2\n      state:\n      - ON\n      - OFF\n    action:\n    - entity: Test Light 1\n      service: turn_on\n    - entity: Test Light 2\n      service: turn_off\n```\n\n#### Split configuration\n\nYou can move automations to a separate file.\nCreate file named `automations.yaml` and write all your automations there:\n\n```yaml\n# configuration.yaml\n\nautomations: automations.yaml\n```\n\n```yaml\n# automations.yaml\n\nautomation_by_action:\n  trigger:\n    platform: action\n    entity: Test Switch\n    action: single\n  condition:\n    platform: state\n    entity: Test Switch 2\n    state: ON\n  action:\n    entity: Test Plug\n    service: toggle\n```\n\n\n#### State Trigger\n\nFires when state of given entities changes.\n\n| Item        | Type                                                               | Description                                                                                  |\n|-------------|--------------------------------------------------------------------|----------------------------------------------------------------------------------------------|\n| `platform`  | `string`                                                           | `state`                                                                                      |\n| `entity`    | `string` or `string[]`                                             | Name of entity (friendly name)                                                               |\n| `state`     | `string`, `string[]`, `number`, `number[]`, `boolean`, `boolean[]` | Depends on `attribute`. `ON`/`OFF` for `state`, `true`/`false` for `occupancy`               |\n| `attribute` | `string`                                                           | Optional (default `state`). `temperatire`, `humidity`, `pressure` and others device-specific |\n| `for`       | `number`                                                           | Number of seconds                                                                            |\n\n_Examples:_\n\n```yaml\ntrigger:\n  platform: state\n  entity:\n    - My Switch\n    - My Light\n  state: ON\n  for: 10\n```\n\n```yaml\ntrigger:\n  platform: state\n  entity: Motion Sensor\n  attribute: occupancy\n  state: true\n```\n\n\n#### Numeric State Trigger\n\nFires when numeric attribute of given entities changes. Parameters `above` or `below` (or both) should be set.\n\n| Item        | Type                   | Description                                                      |\n|-------------|------------------------|------------------------------------------------------------------|\n| `platform`  | `string`               | `numeric_state`                                                  |\n| `entity`    | `string` or `string[]` | Name of entity (friendly name)                                   |\n| `attribute` | `string`               | `temperatire`, `humidity`, `pressure` and others device-specific |\n| `above`     | `number`               | Triggers when value crosses a given threshold                    |\n| `below`     | `number`               | Triggers when value crosses a given threshold                    |\n| `for`       | `number`               | Number of seconds                                                |\n\n_Example:_\n\n```yaml\ntrigger:\n  platform: numeric_state\n  entity: My Sensor\n  attribute: temperature\n  above: 25\n  below: 35\n  for: 180\n```\n\n### Conditions\n\nConditions are an optional part of an automation rule and can be used to prevent an action from happening when triggered.\nWhen a condition does not return true, the automation will stop executing.\nConditions look very similar to triggers but are very different.\nA trigger will look at events happening in the system while a condition only looks at how the system looks right now.\nA trigger can observe that a switch is being turned on. A condition can only see if a switch is currently on or off.\n\n_Automation can have multiple conditions_\n\n#### State Condition\n\nTests if an entity is a specified state.\n\n| Item        | Type                           | Description                                                                                  |\n|-------------|--------------------------------|----------------------------------------------------------------------------------------------|\n| `platform`  | `string`                       | `state`                                                                                      |\n| `entity`    | `string`                       | Name of entity (friendly name)                                                               |\n| `state`     | `string`, `number`, `boolean`  | Depends on `attribute`. `ON`/`OFF` for `state`, `true`/`false` for `occupancy`               |\n| `attribute` | `string`                       | Optional (default `state`). `temperatire`, `humidity`, `pressure` and others device-specific |\n\n_Examples:_\n\n```yaml\ncondition:\n  platform: state\n  entity: My Switch\n  state: ON\n```\n\n```yaml\ncondition:\n  platform: state\n  entity: Motion Sensor\n  attribute: occupancy\n  state: false\n```\n\n\n#### Numeric State Condition\n\nThis type of condition attempts to parse the attribute of an entity as a number, and triggers if the value matches the thresholds.\n\nIf both `below` and `above` are specified, both tests have to pass.\n\n| Item        | Type     | Description                                                      |\n|-------------|----------|------------------------------------------------------------------|\n| `platform`  | `string` | `numeric_state`                                                  |\n| `entity`    | `string` | Name of entity (friendly name)                                   |\n| `attribute` | `string` | `temperatire`, `humidity`, `pressure` and others device-specific |\n| `above`     | `number` | Triggers when value crosses a given threshold                    |\n| `below`     | `number` | Triggers when value crosses a given threshold                    |\n\n_Example:_\n\n```yaml\ncondition:\n  platform: numeric_state\n  entity: My Sensor\n  attribute: temperature\n  above: 25\n  below: 35\n```\n\n\n#### Time Condition\n\nThe time condition can test if it is after a specified time, before a specified time or if it is a certain day of the week.\n\n| Item        | Type       | Description                                                              |\n|-------------|------------|--------------------------------------------------------------------------|\n| `platform`  | `string`   | `time`                                                                   |\n| `after`     | `string`   | Optional (time in `hh:mm:ss` format)                                     |\n| `before`    | `string`   | Optional (time in `hh:mm:ss` format)                                     |\n| `weekday`   | `string[]` | Optional (valid values: `mon`, `tue`, `wed`, `thu`, `fri`, `sat`, `sun`) |\n\nNote that if only `before` key is used, the condition will be `true` _from midnight_ until the specified time.\nIf only `after` key is used, the condition will be `true` from the specified time _until midnight_.\n\nTime condition windows can span across the midnight threshold if both `after` and `before` keys are used.\nIn the example below, the condition window is from 3pm to 2am.\n\n_Example:_\n\n```yaml\ncondition:\n  platform: time\n  after: '15:00:00'\n  before: '02:00:00'\n  weekday:\n    - mon\n    - wed\n    - fri\n```\n\n### Actions\n\nThe action of an automation rule is what is being executed when a rule fires.\n\n_Automation can have multiple actions_\n\n| Item      | Type               | Description                                 |\n|-----------|--------------------|---------------------------------------------|\n| `entity`  | `string`           | Name of entity (friendly name)              |\n| `service` | `string`           | `turn_on`, `turn_off`, `toggle` or `custom` |\n| `data`    | `{string: string}` | Only for `service: custom`, see below       |\n\n_Example:_\n\n```yaml\naction:\n  - entity: Test Plug\n    service: toggle\n  - entity: Test Switch\n    service: turn_on\n```\n\n#### Custom action\n\nYou can call any service. Data will be transferred directly to Z2M.\nFor example change brightness or turn on a relay with a custom name.\n\n_Example:_\n\n```yaml\naction:\n  - entity: Plug With Two Relays\n    service: custom\n    data:\n      state_l2: ON\n  - entity: Light Strip\n    service: custom\n    data:\n      state: ON\n      brightness: 127\n      transition: 2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanonym-tsk%2Fzigbee2mqtt-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanonym-tsk%2Fzigbee2mqtt-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanonym-tsk%2Fzigbee2mqtt-extensions/lists"}