feat(zigbee): add Zigbee Herdsman plugin for direct Zigbee device integration#512
feat(zigbee): add Zigbee Herdsman plugin for direct Zigbee device integration#512akadlec wants to merge 1 commit into
Conversation
d402e1f to
d0732fd
Compare
Self-contained Zigbee device integration via zigbee-herdsman library. Communicates directly with USB and network-attached Zigbee coordinators (CC2652, ConBee, SLZB-06/07, etc.) without external dependencies. Backend plugin (NestJS): - ZigbeeHerdsmanAdapterService wrapping zigbee-herdsman Controller - ZigbeeHerdsmanService with IManagedPluginService lifecycle - fromZigbee message processing with property value writes - Mapping preview and device adoption services - Device platform handler with toZigbee converter dispatch - Device connectivity monitoring with offline detection - REST controller with Swagger-annotated endpoints - Config validator supporting USB serial and TCP paths - Entities with Zigbee-specific columns and TypeORM migration - Fix: shelly-ng resetReconnectInterval type error - Fix: missing @influxdata/influxdb-client dependency Admin UI (Vue.js): - Plugin registration with config and device type elements - Config form, device add/edit forms, store schemas, locales https://claude.ai/code/session_014bjB9Cn1WKASNLBeCuSbom
c5c884a to
39c89a7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 39c89a7. Configure here.
| ); | ||
|
|
||
| public connected: boolean = false; | ||
| public disconnectedAt: number | null = null; |
There was a problem hiding this comment.
Removed delegate members still referenced elsewhere
High Severity
The disconnectedAt field and the pollStatus method were removed from ShellyDeviceDelegate, but delegates-manager.service.ts still references both (checkHealth reads delegate.disconnectedAt to decide whether to force reconnect, and pollAllDevices calls delegate.pollStatus(timeoutMs)). This breaks the type check and, at runtime, makes stale-disconnect detection and the periodic status poll non-functional, effectively disabling energy-counter refresh and stuck-socket recovery for Shelly NG devices.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 39c89a7. Configure here.


Summary
This PR introduces a comprehensive Zigbee Herdsman plugin that enables direct Zigbee device integration via the zigbee-herdsman library. The plugin provides self-contained Zigbee network management with device discovery, adoption, and real-time monitoring capabilities.
Key Changes
Backend Implementation
Core Services
ZigbeeHerdsmanAdapterService: Wraps zigbee-herdsman Controller with typed events and lifecycle management for serial communication with Zigbee coordinatorsZigbeeHerdsmanService: Main plugin service implementingIManagedPluginServiceinterface for plugin lifecycle and state managementZhDeviceAdoptionService: Handles device adoption workflow with automatic channel and property mappingZhMappingPreviewService: Generates device mapping previews before adoption with customizable expose overridesZhDeviceConnectivityService: Monitors device connectivity with configurable timeouts for mains and battery-powered devicesConfiguration & Models
ZigbeeHerdsmanConfigModel: Complete configuration model with serial port, network, discovery, and database settingsZigbeeHerdsmanDiscoveredDeviceModel: Response model for discovered devices with interview status and availability trackingControllers & DTOs
ZigbeeHerdsmanDiscoveredDevicesController: REST API endpoints for device discovery, permit join, mapping preview, and device adoptionConstants & Mappings
Database Entities
ZigbeeHerdsmanDeviceEntity: Extends base DeviceEntity with IEEE address and device typeZigbeeHerdsmanChannelEntity: Channel entity for Zigbee devicesZigbeeHerdsmanChannelPropertyEntity: Channel property entity for device propertiesPlatform Integration
ZigbeeHerdsmanDevicePlatform: ImplementsIDevicePlatforminterface for device command execution and property updatesException Handling
Admin UI Implementation
Configuration Form (
zigbee-herdsman-config-form.vue)Device Management Forms
Store & Schemas
Plugin Integration
app.module.ts) and admin (app.main.ts)Notable Implementation Details
https://claude.ai/code/session_014bjB9Cn1WKASNLBeCuSbom
Note
High Risk
Introduces a large new devices plugin with new REST endpoints, device-command execution logic, and a database migration adding columns to core device/channel-property tables. Also updates backend dependencies and touches existing Shelly reconnect behavior, increasing integration and runtime risk.
Overview
Adds a new Zigbee Herdsman devices plugin end-to-end (admin + backend), enabling direct coordinator-based Zigbee device discovery, mapping preview, adoption, permit-join control, and command execution via
zigbee-herdsman/zigbee-herdsman-converters.On the backend, registers the plugin module, adds new controller/DTOs/models/services/entities (including a device platform for sending
toZigbeecommands with retries), and introduces a TypeORM migration that extendsdevices_module_devicesanddevices_module_channels_propertieswith Zigbee-specific columns.On the admin side, wires the plugin into
app.main.ts, adds config/device add/edit forms with validation and i18n strings, and adds Zod schemas to match the new plugin config and device type. Also adjustsapps/backend/package.json(version bump + new Zigbee/serial dependencies) and refines Shelly NGforceReconnect()to terminate the socket and reset reconnect backoff.Reviewed by Cursor Bugbot for commit 39c89a7. Bugbot is set up for automated code reviews on this repo. Configure here.