z2m

Inovelli Blue, Home Assistant & Zigbee (Zigbee2MQTT) Mega tutorial

In this post, I want to cover how to use the new Zigbee Inovelli Blue 2-1 Dimmer (VZM31-SN) with Home Assistant. This will cover how to integrate the dimmer and then how to use it in real-world scenarios Environment In my setup I’m using Home Assistant OS on a Home Assistant Blue (Odroid-N2) with a Sonoff Zigbee 3.0 USB Dongle (ZBdongle-P) with the Inovelli Blue 2-1 Dimmer (VZM31-SN). I have installed the Zigbee2MQTT add-on in Home Assistant using this guide on Youtube. Zigbee2MQTT Converter At the time of writing this (late October), I am verion 1.28.0-1 of the Zigbee2MQTT Home Assistant add-on. The included converter does not fully support the VZM31-SN dimmer, however Nathan Fiscus has kindly come to the rescue and made some timely bug fixes (Note: These will be available in the next release of Zigbee2MQTT which I believe will be in early November 2022). You will need to copy the contents of https://raw.githubusercontent.com/Koenkk/zigbee-herdsman-converters/master/devices/inovelli.js into /config/zigbee2mqtt/inovelli.js on your Home Assistant instance. However you’ll need to rewrite the first few lines to look like this: const fz = require('zigbee-herdsman-converters/converters/fromZigbee'); const tz = require('zigbee-herdsman-converters/converters/toZigbee'); const exposes = require('zigbee-herdsman-converters/lib/exposes'); const globalStore = require('zigbee-herdsman-converters/lib/store'); const reporting = require('zigbee-herdsman-converters/lib/reporting'); const ota = require('zigbee-herdsman-converters/lib/ota'); const utils = require('zigbee-herdsman-converters/lib/utils'); Once you’ve completed editing the the inovelli.js file, you’ll need to edit /config/zigbee2mqtt/configuration.yaml and add this line at the bottom of the file: external_converters: - inovelli.js Then restart the zigbee2mqtt service. Initial pairing When I installed the dimmer, it started pulsing Blue and I clicked on Permit join (All) in Zigbee2MQTT to get the dimmer to pair with the coordinator. There are a number of issues reported in the Inovelli Forums about the radio performance of this model of dimmer. I did end up connecting a 9ft USB extension cable to my Zigbee dongle which resolved any issues I was having. Naming devices Zigbee2MQTT provides a default ‘friendly name’ for each device based on its device-id. I have renamed all of my devices in Zigbee2MQTT to by actually friendly. So for example, the dimmer near by bedroom stairs is called SFO-MBED-INOVELLI-STAIRS-DIMMER. Parameters and Events The VZM31-SN dimmer has an extensive set of parameters (properties) that can be set. You can see a list of the parameters in the Inovelli VZM31-SN manual. Similarly, you can configure automation triggers based on a set of button presses (up/ down/ config) on the switch. The list of event types are as follows: config_single config_double config_triple config_quadruple config_quintuple config_release config_held down_single down_double down_triple down_quadruple down_quintuple down_release down_held up_single up_release up_held up_double up_triple up_quadruple up_quintuple Automations Now lets get to the good stuff Turning on the light and dimming it - alias: '[Inovelli] Turn on light to 24% brightness' id: 'inovelli_turn_on_light_to_24_brightness' trigger: - platform: state entity_id: binary_sensor.inovelli_example from: 'off' to: 'on' action: - service: mqtt.publish data: topic: zigbee2mqtt/SFO-MBED-INOVELLI-STAIRS-DIMMER/set payload: '{ "state": "ON", "brightness": 61}' The brightness parameter is optional, but gives you extra control to set a brightness the bulb. The brightness parameter can be set between 0 (off) to 254 (100% on). 61 is approximately 24%. Turn on LED strip effect In this example, we are going to turn on the LED effect strip of the dimmer. Firstly, we need to pick what the effect will look like. Again you can see options by looking in Zigbee2MQTT UI or looking at the Inovelli VZM31-SN manual. Color: 168 (Dark Blue) Brightness: 10 Duration: Infinity Effect: Slow Blink - alias: "[Inovelli] LED effect example" id: 'inovelli_led_effect_example' trigger: - platform: state entity_id: binary_sensor.inovelli_example from: "off" to: "on" action: - service: mqtt.publish data: topic: zigbee2mqtt/SFO-MBED-INOVELLI-STAIRS-DIMMER/set payload: '{"led_effect":{"color":168,"duration":255,"effect":"slow_blink","level":100}}' To turn off the effect, I am going to press the config button on the switch to trigger the cancellation of the effect. To disable the effect, I am going to set the following: Color: 168 (Dark Blue) Brightness: 10 Duration: Infinity Effect: Off The color/ brightness/ duration values could be set to anything, the only one that matters is effect. - alias: "[Inovelli] Turn off LED effect example" id: 'inovelli_turn_off_led_effect_example' trigger: - platform: mqtt topic: zigbee2mqtt/SFO-MBED-INOVELLI-STAIRS-DIMMER/action payload: config_single action: - service: mqtt.publish data: topic: zigbee2mqtt/SFO-MBED-INOVELLI-STAIRS-DIMMER/set qos: "0" payload: '{"led_effect":{"effect":"off"}}' Triggering an automation using the switch In this example, I am going to use the buttons on the dimmer to trigger an automation in Home Assistant. In this example when the Down button is held down, it will trigger a notification to be posted to Slack. - alias: "[Test] Scene Example" id: 'scene_example' trigger: - platform: mqtt topic: zigbee2mqtt/SFO-MBED-INOVELLI-STAIRS-DIMMER/action payload: down_held action: - service: notify.slack data: message: "Test notification" target: "#homeassistant_alerts" Programming multiple dimmers I own multiple dimmers, but I want to have identical button automations and not have to write a set of auctions for each device.. So, I want to program all dimmers to respond in an identical manner. Fortunately, this is achievable in a relatively simple manner. In this case, we create triggers that do not apply to a specific device_id, but the corresponding action will be applied to the dimmer in which the button was pressed. In this example, when the Up button is pressed three times on any of my Zigbee dimmers, it will turn on the corresponding bulb to 50%. This is achieved by using a wildcard match on the topic name (using the + operator) and then performing some string manipulation of the triggering topic to build a topic name for the mqtt.publish action. - alias: "[Inovelli] 3x press up" id: 'inovelli_3x_press_up' trigger: - platform: mqtt topic: zigbee2mqtt/+/action # e.g. zigbee2mqtt/SFO-MBED-INOVELLI-STAIRS-DIMMER/action payload: up_triple action: - service: mqtt.publish data: topic: zigbee2mqtt/{{ trigger.topic.split('/')[1]}}/set # becomes zigbee2mqtt/SFO-MBED-INOVELLI-STAIRS-DIMMER/set payload: '{"state": "ON", "brightness": 128}' Changing the brightness of an evening One thing I noticed after installing multiple dimmers was that the brightness is too high on the strip of an evening. To correct that, I created an automation that lowers the brightness at 11pm to 1% and then sets it back to 100% just after sunrise. For this example, I want to execute it across multiple dimmers. - alias: "[Inovelli] Change LED brightness at sunrise" id: 'inovelli_change_led_brightness_at_sunrise' trigger: platform: template value_template: "{{ states.sun.sun.attributes.elevation > 5 }}" action: - repeat: for_each: - SFO-MBED-INOVELLI-BACKBED-DIMMER - SFO-MBED-INOVELLI-STAIRS-DIMMER sequence: - service: mqtt.publish data: topic: zigbee2mqtt/{{repeat.item}}/set qos: "0" payload: '{"ledIntensityWhenOff": 100}' - alias: "[Inovelli] Change LED brightness at 11pm" id: 'inovelli_change_led_brightness_at_11pm' trigger: - platform: time at: '23:00:00' action: - repeat: for_each: - SFO-MBED-INOVELLI-BACKBED-DIMMER - SFO-MBED-INOVELLI-STAIRS-DIMMER sequence: - service: mqtt.publish data: topic: zigbee2mqtt/{{repeat.item}}/set qos: "0" payload: '{"ledIntensityWhenOff": 1}' Conclusion This tutorial should be enough to help you get started with Zigbee2MQTT automations with your new Inovelli Blue dimmers. Please message me @michaelkkehoe on Twitter if you have any questions. References https://community.inovelli.com/t/resources-blue-series-smart-2-1-switch-on-off-dimmer-manual/10349#parameter-list-18) https://raw.githubusercontent.com/Koenkk/zigbee-herdsman-converters/master/devices/inovelli.js https://nathanfiscus.github.io/inovelli-notification-calc/ https://nathanfiscus.github.io/inovelli-led-strip-toolbox/