MicroZigbee2MQTT is very light (YAML based) configuration setup for Zigbee2MQTT and allows you for creating simple scenes using supported Zigbee devices.
MicroZigbee2MQTT requires following components:
- MQTT broker (for example Mosquitto)
- Zigbee2MQTT
You can run MicroZigbee2MQTT as a Docker container and native Java application as well.
You cun run MicroZigbee2MQTT using Docker:
docker run -d -p 8080:8080 -v application.yml:/opt/application.yml --name microzigbee2mqtt coderion/microzigbee2mqtt:latest
Alternatively you can run application as a standard Java JAR:
MICRONAUT_CONFIG_FILES=application.yml java -jar zigbee2mqtt-*.jar
The whole configuration is included in file application.yml and should be provided during startup application (see above).
Below example of simple config with one scene "When you press the button the lamp turns on or off":
micronaut:
application:
name: microzigbee2mqtt
logger:
levels:
pl:
micronaut: INFO
mqtt: (1)
client:
client-id: ${random.uuid}
server-uri: tcp://localhost:1883
user-name:
password:
email: (2)
enabled: false
recipient: recipient@gmail.com
smtp:
host: smtp.gmail.com
port: 465
ssl: true
username: your-email@gmail.com
password: your-password
pushover: (3)
enabled: false
user: your-username
token: your-application-token
zigbee2mqtt: (4)
queue-prefix: zigbee2mqtt/d/
devices:
- name: salon/button
- name: salon/lamp
- name: salon/button4gang
scenes:
- name: button_enables_lamp
device: salon/button
property: action
value: single
triggers:
- device: salon/lamp
property: state
value: toggle
- name: button_enables_another_button
device: salon/button
property: action
value: double
triggers:
- device: salon/button4gang
property: action
value: 1_single
- do-not-disable: button_enables_lamp
- name: blink_lamp
cron: "0/15 * * * * ?"
triggers:
- device: salon/lamp
property: state
value: toggle
- name: button_disables_scene
device: salon/button4gang
property: action
value: 1_single
triggers:
- disable: button_enables_lamp
- name: button_enables_scene
device: salon/button4gang
property: action
value: 2_single
triggers:
- enable: button_enables_lamp
Section mqtt (1) defines address of your MQTT Broker (and optionally username and password if needed)
Section email (2) defines SMTP server settings to send e-mail notifications
Section pushover (3) defines Pushover settings to send push notifications
Section zigbee2mqtt (4) defines your scenes:
- queue-prefix - prefix added to device name to indicate MQTT topic name (it's highly recommended do not use " zigbee2mqtt/" which is default topic in Zigbee2MQTT and contains many internal system messages can cause errors in logs)
- devices - list of your zigbee devices (names are frindly name from Zigbee2MQTT configuration file) . Name can contain slashes ("/") for grouping devices.
- scenes - list of your scenes. Each scene includes:
- name - any human readable name describing your scene
- cron - CRON expression to trigger action periodically
- device - name of device (its friendly name) which start the scene
- property - name of property in MQTT message payload which should start the scene
- value - value in MQTT message payload which should start the scene
- notification - notification settings
- email - is e-mail notification enabled
- pushover - is push notification (via Pushover) enabled
- triggers - list of triggers (MQTT messages to publish) should be done if the scenes occures:
- device - name of device triggered in scene
- property - name of property in MQTT message payload which should be published during the scene
- value - value in MQTT message payload which should be published during the scene
- do-not-disable - name of scene that shouldn't be disabled in the nested triggers
- disable - name of scene to be disabled
- enable - name of scene to be enabled
In example above when the button is pressed (and hence in topic zigbee2mqtt/button is published message with
payload {"action": "single"}
) another message will be published to topic
zigbee2mqtt/lamp (with payload {"state": "toggle"}
) which turns the lamp on/off.
- /state (for example http://localhost:8080/state for your local application) - state of all devices updated each time MQTT message is published
- /state/battery - state of battery for each device providing property battery in MQTT message
- /state/voltage - state of voltage for each device providing property voltage in MQTT message
Roadmap for the nearest future include:
- store events in optional MongoDB database for future statistics
- define scene using sunrise & sunset time