home assistant

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/

Inovelli, Home Assistant & Z-WaveJS Mega tutorial

In this post, I want to cover how to use the Inovelli Red Dimmer (LZW31-SN) with Home Assistant. This will cover how to integrate the dimmer and then how to use it in real-world scenarios Setup In my setup I’m using Home Assistant OS on a Raspberry Pi with an Aeotech Gen 5 ZWave stick (ZW090) with the Inovelli Red Dimmer (LZW31-SN). I have installed the ZWave-JS add-on. I am going to also to use S2 security with the dimmer. Once you have your dimmer paired to your Zwave network, we can start configuring automations. Note: These automations will ONLY work with the setup I have described. Before we begin, the LZW31-SN dimmer has three buttons: The Down Button (001) The Up Button (002) The Config Button (003) We will use these button ID’s when listening for events. Turning on the light and dimming it Turning the light(s) connected to the dimmer are no different to any other light in Home Assistant. - 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: light.turn_on data: entity_id: light.sfo_inovelli_closet_dimmer brightness: 24 The brightness parameter is optional, but gives you extra control to set a brightness the bulb. 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 determine how to configure the parameter. Nathan Fiscus’s Inovelli Notification calculator makes this easy. On the Notifications tab, you pick a color, brightness level, duration and effect and the utility will provide you a parameter value. In my example, I have picked the following parameters: Color: 168 (Dark Blue) Brightness: 10 Duration: Infinity Effect: Slow Blink The utility gives me a value of 83823268 which I then set by using the zwave_js.bulk_set_partial_config_parameters service as per the below example: - 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: zwave_js.bulk_set_partial_config_parameters data: parameter: '16' value: 83823268 target: device_id: cf4aec1a83be9405e11def461cad69b0 To turn off the effect, I am going to press the config button (003) 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. This gives a value of 16714408. - alias: "[Inovelli] Turn off LED effect example" id: 'inovelli_turn_off_led_effect_example' trigger: - platform: event event_type: zwave_js_value_notification event_data: property_key: "003" value: "KeyPressed" device_id: cf4aec1a83be9405e11def461cad69b0 action: - service: zwave_js.bulk_set_partial_config_parameters data: parameter: '16' value: 16714408 target: device_id: cf4aec1a83be9405e11def461cad69b0 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 Up button (003) is held down, it will trigger a notification to be posted to Slack. - alias: "[Test] Scene Example" id: 'scene_example' trigger: - platform: event event_type: zwave_js_value_notification event_data: property_key: "002" value: "KeyHeldDown" device_id: cf4aec1a83be9405e11def461cad69b0 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. So, I want to program all dimmers to respond in an identical manner. Fortunately, this is achievable in a 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 Down button (001) is pressed once, it will turn off the corresponding bulbs and reset the LED strip color to white. - alias: "[Inovelli] 1x press down" id: 'inovelli_1x_press_down' trigger: - platform: event event_type: zwave_js_value_notification event_data: property_key: "001" value: "KeyPressed" action: - service: light.turn_off data: device_id: '{{ trigger.event.data.device_id }}' - service: zwave_js.bulk_set_partial_config_parameters data: parameter: '13' value: 255 target: device_id: '{{ trigger.event.data.device_id }}' 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 and then sets it back to 100% just after sunrise. - 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: - service: zwave_js.bulk_set_partial_config_parameters data: parameter: '15' value: 10 target: entity_id: - group.inovelli_lights - alias: "[Inovelli] Change LED brightness at 11pm" id: 'inovelli_change_led_brightness_at_11pm' trigger: - platform: time at: '23:00:00' action: - service: zwave_js.bulk_set_partial_config_parameters data: # command_class: '112' parameter: '15' value: 1 target: entity_id: - group.inovelli_lights Conclusion I hope this guide was helpful to get started with Inovelli Dimmer’s. The flexability of the dimmer makes it a great companion for the smart home. The reasonable price of $44/ dimmer also makes it a worthwhile investment. References https://support.inovelli.com/portal/en/kb/articles/compatible-bulbs-gen-2-dimmers https://nathanfiscus.github.io/inovelli-notification-calc/ https://nathanfiscus.github.io/inovelli-led-strip-toolbox/