MCPcopy
hub / github.com/Koenkk/zigbee2mqtt

github.com/Koenkk/zigbee2mqtt @2.12.1 sqlite

repository ↗ · DeepWiki ↗ · release 2.12.1 ↗
696 symbols 2,235 edges 86 files 22 documented · 3%
README
<a href="https://github.com/koenkk/zigbee2mqtt">
    <img width="150" height="150" src="https://github.com/Koenkk/zigbee2mqtt/raw/2.12.1/images/logo.png">
</a>









    <a href="https://github.com/Koenkk/zigbee2mqtt/releases">
        <img src="https://img.shields.io/github/release/koenkk/zigbee2mqtt.svg">
    </a>
    <a href="https://www.npmjs.com/package/zigbee2mqtt">
        <img src="https://img.shields.io/npm/v/zigbee2mqtt">
    </a>
    <a href="https://github.com/Koenkk/zigbee2mqtt/actions/workflows/ci.yml">
        <img src="https://github.com/Koenkk/zigbee2mqtt/actions/workflows/ci.yml/badge.svg">
    </a>
    <a href="https://github.com/Koenkk/zigbee2mqtt/actions/workflows/github-code-scanning/codeql">
        <img src="https://github.com/Koenkk/zigbee2mqtt/actions/workflows/github-code-scanning/codeql/badge.svg">
    </a>
    <a href="https://discord.gg/dadfWYE">
        <img src="https://img.shields.io/discord/556563650429583360.svg">
    </a>
    <a href="https://github.com/Koenkk/zigbee2mqtt/stargazers">
        <img src="https://img.shields.io/github/stars/koenkk/zigbee2mqtt.svg">
    </a>
    <a href="https://www.paypal.me/koenkk">
        <img src="https://img.shields.io/badge/donate-PayPal-blue.svg">
    </a>



<h1>Zigbee2MQTT  🌉 🐝</h1>



    Allows you to use your Zigbee devices <b>without</b> the vendor's bridge or gateway.






    It bridges events and allows you to control your Zigbee devices via MQTT. In this way you can integrate your Zigbee devices with whatever smart home infrastructure you are using.

Getting started

The documentation provides you all the information needed to get up and running! Make sure you don't skip sections if this is your first visit, as there might be important details in there for you.

If you aren't familiar with Zigbee terminology make sure you read this to help you out.

Integrations

Zigbee2MQTT integrates well with (almost) every home automation solution because it uses MQTT. However the following integrations are worth mentioning:

Home Assistant

Home Assistant

Home Assistant OS using the official addon (other installations)

Homey

Homey

Integration implemented in the Homey App (documentation & support)

Domoticz

Domoticz

Integration implemented in Domoticz (documentation).

Gladys Assistant

Gladys Assistant

Integration implemented natively in Gladys Assistant (documentation).

ioBroker

ioBroker

Integration implemented in ioBroker (documentation).

Architecture

Architecture

Internal Architecture

Zigbee2MQTT is made up of three modules, each developed in its own Github project. Starting from the hardware (adapter) and moving up; zigbee-herdsman connects to your adapter to handle Zigbee communication and makes an API available to the higher levels of the stack. For e.g. Texas Instruments hardware, zigbee-herdsman uses the TI zStack monitoring and test API to communicate with the adapter. The module zigbee-herdsman-converters handles the mapping from individual device models to the Zigbee clusters they support. Zigbee clusters are the layers of the Zigbee protocol on top of the base protocol that define things like how lights, sensors and switches talk to each other over the Zigbee network. Finally, the Zigbee2MQTT module drives zigbee-herdsman and maps the zigbee messages to MQTT messages. Zigbee2MQTT also keeps track of the state of the system. It uses a database.db file to store this state; a text file with a JSON database of connected devices and their capabilities. Zigbee2MQTT provides several web-based interfaces (zigbee2mqtt-frontend, zigbee2mqtt-windfront) that allows monitoring and configuration.

Developing

Zigbee2MQTT uses TypeScript. Therefore after making changes to files in the lib/ directory you need to recompile Zigbee2MQTT. This can be done by executing pnpm run build. For faster development instead of running pnpm run build you can run pnpm run build:watch in another terminal session, this will recompile as you change files.

Before running any of the commands, you'll first need to run pnpm install --include=dev. Before submitting changes run pnpm run check:w then pnpm run test:coverage.

Supported devices

See Supported devices to check whether your device is supported. There is quite an extensive list, including devices from vendors like Xiaomi, Ikea, Philips, OSRAM and more.

If it's not listed in Supported devices, support can be added (fairly) easily, see How to support new devices.

Support & help

If you need assistance you can check opened issues. Feel free to help with Pull Requests when you were able to fix things or add new devices or just share the love on social media.

Extension points exported contracts — how you extend this code

EventBusMap (Interface)
(no doc)
lib/eventBus.ts
MqttPublishOptions (Interface)
(no doc)
lib/mqtt.ts
KeyValue (Interface)
(no doc)
lib/types/types.d.ts
SettingsMigration (Interface)
(no doc)
lib/util/settingsMigration.ts
ParsedMQTTMessage (Interface)
(no doc)
lib/extension/groups.ts
Bind (Interface)
(no doc)
lib/types/types.d.ts
SettingsAdd (Interface)
(no doc)
lib/util/settingsMigration.ts
UpdatePayload (Interface)
(no doc)
lib/extension/otaUpdate.ts

Core symbols most depended-on inside this repo

flushPromises
called by 647
test/mocks/utils.ts
mockClear
called by 414
test/mocks/zigbeeHerdsman.ts
set
called by 315
lib/state.ts
getEndpoint
called by 314
test/mocks/zigbeeHerdsman.ts
get
called by 214
lib/state.ts
start
called by 131
test/assets/external_extensions/cjs/exampleExtension.js
error
called by 75
lib/util/logger.ts
debug
called by 71
lib/util/logger.ts

Shape

Method 356
Function 227
Class 78
Interface 35

Languages

TypeScript100%

Modules by API surface

lib/eventBus.ts50 symbols
lib/extension/homeassistant.ts44 symbols
lib/extension/bridge.ts44 symbols
lib/util/utils.ts43 symbols
lib/zigbee.ts38 symbols
lib/util/settings.ts30 symbols
lib/util/settingsMigration.ts23 symbols
test/mocks/zigbeeHerdsman.ts21 symbols
lib/util/logger.ts21 symbols
lib/model/device.ts20 symbols
lib/extension/availability.ts19 symbols
test/controller.bench.ts18 symbols

Dependencies from manifests, versioned

@biomejs/biome2.5.0 · 1×
@types/finalhandler1.2.3 · 1×
@types/humanize-duration3.27.4 · 1×
@types/js-yaml4.0.9 · 1×
@types/node24.13.2 · 1×
@types/object-assign-deep0.4.3 · 1×
@types/readable-stream4.0.23 · 1×
@types/serve-static2.2.0 · 1×
@types/ws8.18.1 · 1×
@vitest/coverage-v83.1.1 · 1×
ajv8.20.0 · 1×
bind-decorator1.0.11 · 1×

For agents

$ claude mcp add zigbee2mqtt \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact