Skip to content

Commit b69e1d5

Browse files
authored
WWSTCERT-8802 Inovelli: adding support for vzm30 (zigbee on/off) and adding supported button events to all de… (#2537)
* adding support for vzm30 and adding supported button events to all devices * removing some preferences. update test unit * fix linter errors for test files * better naming for drivers * updating supportedValues for devices that may have been included with the old driver * fixing linter errors * fixing linter errors * fixing linter errors
1 parent 32fe776 commit b69e1d5

File tree

15 files changed

+1779
-142
lines changed

15 files changed

+1779
-142
lines changed

drivers/SmartThings/zigbee-switch/fingerprints.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,6 +2359,11 @@ zigbeeManufacturer:
23592359
model: NEXENTRO Dimming Actuator
23602360
deviceProfileName: on-off-level
23612361
# Inovelli
2362+
- id: "Inovelli/VZM30-SN"
2363+
deviceLabel: "Inovelli On/Off Blue Series"
2364+
manufacturer: Inovelli
2365+
model: VZM30-SN
2366+
deviceProfileName: inovelli-vzm30-sn
23622367
- id: "Inovelli/VZM31-SN"
23632368
deviceLabel: "Inovelli 2-in-1 Blue Series"
23642369
manufacturer: Inovelli
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
name: inovelli-vzm30-sn
2+
components:
3+
- id: main
4+
capabilities:
5+
- id: switch
6+
version: 1
7+
- id: switchLevel
8+
version: 1
9+
- id: temperatureMeasurement
10+
version: 1
11+
- id: relativeHumidityMeasurement
12+
version: 1
13+
- id: powerMeter
14+
version: 1
15+
- id: energyMeter
16+
version: 1
17+
- id: refresh
18+
version: 1
19+
- id: firmwareUpdate
20+
version: 1
21+
categories:
22+
- name: Switch
23+
- id: button1
24+
label: Down Button
25+
capabilities:
26+
- id: button
27+
version: 1
28+
categories:
29+
- name: RemoteController
30+
- id: button2
31+
label: Up Button
32+
capabilities:
33+
- id: button
34+
version: 1
35+
categories:
36+
- name: RemoteController
37+
- id: button3
38+
label: Config Button
39+
capabilities:
40+
- id: button
41+
version: 1
42+
categories:
43+
- name: RemoteController
44+
preferences:
45+
- name: "notificationChild"
46+
title: "Add Child Device - Notification"
47+
description: "Create Separate Child Device for Notification Control"
48+
required: false
49+
preferenceType: boolean
50+
definition:
51+
default: false
52+
- name: "notificationType"
53+
title: "Notification Effect"
54+
description: "This is the notification effect used by the notification child device"
55+
required: false
56+
preferenceType: enumeration
57+
definition:
58+
options:
59+
"255": "Clear"
60+
"1": "Solid"
61+
"2": "Fast Blink"
62+
"3": "Slow Blink"
63+
"4": "Pulse"
64+
"5": "Chase"
65+
"6": "Open/Close"
66+
"7": "Small-to-Big"
67+
"8": "Aurora"
68+
"9": "Slow Falling"
69+
"10": "Medium Falling"
70+
"11": "Fast Falling"
71+
"12": "Slow Rising"
72+
"13": "Medium Rising"
73+
"14": "Fast Rising"
74+
"15": "Medium Blink"
75+
"16": "Slow Chase"
76+
"17": "Fast Chase"
77+
"18": "Fast Siren"
78+
"19": "Slow Siren"
79+
default: 1
80+
- name: "parameter258"
81+
title: "258. Switch Mode"
82+
description: "Use as a Dimmer or an On/Off switch"
83+
required: false
84+
preferenceType: enumeration
85+
definition:
86+
options:
87+
"0": "Dimmer"
88+
"1": "On/Off (default)"
89+
default: 1
90+
- name: "parameter22"
91+
title: "22. Aux Switch Type"
92+
description: "Set the Aux switch type. Smart Bulb Mode does not work in Dumb 3-Way Switch mode."
93+
required: false
94+
preferenceType: enumeration
95+
definition:
96+
options:
97+
"0": "None"
98+
"1": "3-Way Aux Switch (default)"
99+
default: 1
100+
- name: "parameter52"
101+
title: "52. Smart Bulb Mode"
102+
description: "For use with Smart Bulbs that need constant power and are controlled via commands rather than power. Smart Bulb Mode does not work in Dumb 3-Way Switch mode."
103+
required: false
104+
preferenceType: enumeration
105+
definition:
106+
options:
107+
"0": "Disabled (default)"
108+
"1": "Smart Bulb Mode"
109+
default: 0
110+
- name: "parameter1"
111+
title: "1. Dimming Speed (Remote)"
112+
description: "This changes the speed that the light dims up when controlled from the hub. A setting of '0' turns the light immediately on. Increasing the value slows down the transition speed. Value is multiplied by 100ms.
113+
Default=25 (2500ms or 2.5s)"
114+
required: false
115+
preferenceType: number
116+
definition:
117+
minimum: 0
118+
maximum: 126
119+
default: 25
120+
- name: "parameter2"
121+
title: "2. Dimming Speed (Local)"
122+
description: "This changes the speed that the light dims up when controlled at the switch. A setting of '0' turns the light immediately on. Increasing the value slows down the transition speed. Value is multiplied by 100ms.
123+
(i.e 25 = 2500ms or 2.5s) Default=127 (Sync with parameter 1)"
124+
required: false
125+
preferenceType: number
126+
definition:
127+
minimum: 0
128+
maximum: 127
129+
default: 127
130+
- name: "parameter3"
131+
title: "3. Ramp Rate (Remote)"
132+
description: "This changes the speed that the light turns on when controlled from the hub. A setting of '0' turns the light immediately on. Increasing the value slows down the transition speed. Value is multiplied by 100ms.
133+
(i.e 25 = 2500ms or 2.5s) Default=0"
134+
required: false
135+
preferenceType: number
136+
definition:
137+
minimum: 0
138+
maximum: 127
139+
default: 0
140+
- name: "parameter4"
141+
title: "4. Ramp Rate (Local)"
142+
description: "This changes the speed that the light turns on when controlled at the switch. A setting of '0' turns the light immediately on. Increasing the value slows down the transition speed. Value is multiplied by 100ms.
143+
(i.e 25 = 2500ms or 2.5s) Default=127 (Sync with parameter 3)"
144+
required: false
145+
preferenceType: number
146+
definition:
147+
minimum: 0
148+
maximum: 127
149+
default: 127
150+
- name: "parameter11"
151+
title: "11. Invert Switch"
152+
description: "Inverts the orientation of the switch. Useful when the switch is installed upside down. Essentially up becomes down and down becomes up."
153+
required: false
154+
preferenceType: enumeration
155+
definition:
156+
options:
157+
"0": "No (default)"
158+
"1": "Yes"
159+
default: 0
160+
- name: "parameter15"
161+
title: "15. Level After Power Restored"
162+
description: "The level the switch will return to when power is restored after power failure.
163+
0=Off
164+
1-100=Set Level
165+
101=Use previous level."
166+
required: false
167+
preferenceType: number
168+
definition:
169+
minimum: 0
170+
maximum: 101
171+
default: 101
172+
- name: "parameter95"
173+
title: "95. LED Indicator Color (w/On)"
174+
description: "Set the color of the Full LED Indicator when the load is on."
175+
required: false
176+
preferenceType: enumeration
177+
definition:
178+
options:
179+
"0": "Red"
180+
"7": "Orange"
181+
"28": "Lemon"
182+
"64": "Lime"
183+
"85": "Green"
184+
"106": "Teal"
185+
"127": "Cyan"
186+
"148": "Aqua"
187+
"170": "Blue (default)"
188+
"190": "Violet"
189+
"212": "Magenta"
190+
"234": "Pink"
191+
"255": "White"
192+
default: 170
193+
- name: "parameter96"
194+
title: "96. LED Indicator Color (w/Off)"
195+
description: "Set the color of the Full LED Indicator when the load is off."
196+
required: false
197+
preferenceType: enumeration
198+
definition:
199+
options:
200+
"0": "Red"
201+
"7": "Orange"
202+
"28": "Lemon"
203+
"64": "Lime"
204+
"85": "Green"
205+
"106": "Teal"
206+
"127": "Cyan"
207+
"148": "Aqua"
208+
"170": "Blue (default)"
209+
"190": "Violet"
210+
"212": "Magenta"
211+
"234": "Pink"
212+
"255": "White"
213+
default: 170
214+
- name: "parameter97"
215+
title: "97. LED Indicator Intensity (w/On)"
216+
description: "Set the intensity of the Full LED Indicator when the load is on."
217+
required: false
218+
preferenceType: number
219+
definition:
220+
minimum: 0
221+
maximum: 100
222+
default: 50
223+
- name: "parameter98"
224+
title: "98. LED Indicator Intensity (w/Off)"
225+
description: "Set the intensity of the Full LED Indicator when the load is off."
226+
required: false
227+
preferenceType: number
228+
definition:
229+
minimum: 0
230+
maximum: 100
231+
default: 5

drivers/SmartThings/zigbee-switch/src/init.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ local zigbee_switch_driver_template = {
6666
capabilities.energyMeter,
6767
capabilities.motionSensor,
6868
capabilities.illuminanceMeasurement,
69+
capabilities.relativeHumidityMeasurement,
70+
capabilities.temperatureMeasurement,
6971
},
7072
sub_drivers = {
7173
lazy_load_if_possible("non_zigbee_devices"),

drivers/SmartThings/zigbee-switch/src/inovelli/can_handle.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
return function(opts, driver, device)
66
local INOVELLI_FINGERPRINTS = {
7+
{ mfr = "Inovelli", model = "VZM30-SN" },
78
{ mfr = "Inovelli", model = "VZM31-SN" },
89
{ mfr = "Inovelli", model = "VZM32-SN" }
910
}

drivers/SmartThings/zigbee-switch/src/inovelli/common.lua

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,27 @@
44
local clusters = require "st.zigbee.zcl.clusters"
55
local device_management = require "st.zigbee.device_management"
66
local OTAUpgrade = require("st.zigbee.zcl.clusters").OTAUpgrade
7+
local zigbee_constants = require "st.zigbee.constants"
8+
local capabilities = require "st.capabilities"
79

810
local M = {}
911

12+
M.supported_button_values = {
13+
["button1"] = {"pushed","held","down_hold","pushed_2x","pushed_3x","pushed_4x","pushed_5x"},
14+
["button2"] = {"pushed","held","down_hold","pushed_2x","pushed_3x","pushed_4x","pushed_5x"},
15+
["button3"] = {"pushed","held","down_hold","pushed_2x","pushed_3x","pushed_4x","pushed_5x"}
16+
}
17+
18+
-- Utility function to check if device is VZM32-SN
19+
function M.is_vzm32(device)
20+
return device:get_model() == "VZM32-SN"
21+
end
22+
23+
-- Utility function to check if device is VZM32-SN
24+
function M.is_vzm30(device)
25+
return device:get_model() == "VZM30-SN"
26+
end
27+
1028
-- Sends a generic configure for Inovelli devices (all models):
1129
-- - device:configure
1230
-- - send OTA ImageNotify
@@ -25,10 +43,31 @@ function M.base_device_configure(driver, device, private_cluster_id, mfg_code)
2543
device:send(device_management.build_bind_request(device, private_cluster_id, driver.environment_info.hub_zigbee_eui, 2))
2644

2745
-- Read divisors/multipliers for power/energy reporting
28-
device:send(clusters.SimpleMetering.attributes.Divisor:read(device))
46+
-- Set default divisor to 1000 for VZM32-SN and VZM30-SN. In initial firmware the divisor is incorrectly set to 100.
47+
if M.is_vzm32(device) or M.is_vzm30(device) then
48+
device:set_field(zigbee_constants.SIMPLE_METERING_DIVISOR_KEY, 1000, {persist = true})
49+
else
50+
device:send(clusters.SimpleMetering.attributes.Divisor:read(device))
51+
end
2952
device:send(clusters.SimpleMetering.attributes.Multiplier:read(device))
3053
device:send(clusters.ElectricalMeasurement.attributes.ACPowerDivisor:read(device))
3154
device:send(clusters.ElectricalMeasurement.attributes.ACPowerMultiplier:read(device))
55+
56+
for _, component in pairs(device.profile.components) do
57+
if component.id ~= "main" then
58+
device:emit_component_event(
59+
component,
60+
capabilities.button.supportedButtonValues(
61+
M.supported_button_values[component.id],
62+
{ visibility = { displayed = false } }
63+
)
64+
)
65+
device:emit_component_event(
66+
component,
67+
capabilities.button.numberOfButtons({value = 1}, { visibility = { displayed = false } })
68+
)
69+
end
70+
end
3271
end
3372

3473
return M

0 commit comments

Comments
 (0)