Skip to content

Commit 4ddb7db

Browse files
authored
Merge pull request #71 from ShellyUSA/DanielWinks
Daniel winks
2 parents c1b8d68 + e5c168c commit 4ddb7db

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

PackageManifests/ShellyWebhookDrivers/packageManifest.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"packageName": "Shelly Webhook/Websocket Drivers",
33
"author": "ShellyUSA, Daniel Winks",
4-
"version": "2.10.0",
4+
"version": "2.11.0",
55
"releaseNotes": "Add support for Shelly 1, Shelly RGBW (Gen1), Shelly RGBW White Mode (Gen1), Shelly Plus Wall Dimmer, Shelly Pro 1PM, Pro 2, Pro Dimmer 1PM, Pro Dimmer 2PM",
66
"minimumHEVersion": "2.3.7.114",
77
"dateReleased": "2024-02-10",
@@ -190,6 +190,13 @@
190190
"location": "https://raw.githubusercontent.com/ShellyUSA/Hubitat-Drivers/master/WebhookWebsocket/ShellyDimmer2.groovy",
191191
"required": false
192192
},
193+
{
194+
"id": "6d73fc2f-43fc-44ae-9a1b-a27452597088",
195+
"name": "Shelly Duo WW CW",
196+
"namespace": "ShellyUSA",
197+
"location": "https://raw.githubusercontent.com/ShellyUSA/Hubitat-Drivers/master/WebhookWebsocket/ShellyDuoWWCW.groovy",
198+
"required": false
199+
},
193200
{
194201
"id": "2b2d10f3-c078-406f-aacf-936936d41a1d",
195202
"name": "Shelly Flood",

ShellyDriverLibrary/ShellyUSA.ShellyUSA_Driver_Library.groovy

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Boolean hasCapabilityBattery() { return device.hasCapability('Battery') == true
7777
Boolean hasCapabilityColorControl() { return device.hasCapability('ColorControl') == true }
7878
Boolean hasCapabilityColorMode() { return device.hasCapability('ColorMode') == true }
7979
Boolean hasCapabilityColorTemperature() { return device.hasCapability('ColorTemperature') == true }
80+
Boolean hasCapabilityWhiteLevel() { return device.hasAttribute('whiteLevel') == true }
8081
Boolean hasCapabilityLight() { return device.hasCapability('Light') == true }
8182
Boolean hasCapabilitySwitch() { return device.hasCapability('Switch') == true }
8283
Boolean hasCapabilityPresence() { return device.hasCapability('PresenceSensor') == true }
@@ -1125,6 +1126,12 @@ void setWhiteLevelAttribute(Integer whiteLevel, ChildDeviceWrapper child = null)
11251126
else {sendDeviceEvent([name: 'whiteLevel', value: whiteLevel, unit: '%'])}
11261127
}
11271128

1129+
@CompileStatic
1130+
void setColorTemperatureAttribute(Integer colorTemperature, ChildDeviceWrapper child = null) {
1131+
if(child != null) {sendChildDeviceEvent([name: 'colorTemperature', value: colorTemperature, unit: '°K'], child)}
1132+
else {sendDeviceEvent([name: 'colorTemperature', value: colorTemperature, unit: '°K'])}
1133+
}
1134+
11281135
void setColorModeAttribute(String colorMode) {
11291136
if(colorMode in ['CT', 'RGB', 'EFFECTS']) {
11301137
sendDeviceEvent([name: 'colorMode', value: colorMode])
@@ -3780,10 +3787,14 @@ void processGen1LightStatus(Map json, Integer index = 0) {
37803787
Boolean isOn = json?.ison as Boolean
37813788
if(isOn != null) {setSwitchState(isOn)}
37823789
Integer whiteLevel = json?.white as Integer
3783-
if(whiteLevel != null) {
3790+
if(whiteLevel != null && hasCapabilityWhiteLevel() == true) {
37843791
whiteLevel = (Integer)(whiteLevel/255)
37853792
setWhiteLevelAttribute(whiteLevel)
37863793
}
3794+
Integer colorTemp = json?.temp as Integer
3795+
if(colorTemp != null && hasCapabilityColorTemperature() == true) {
3796+
setColorTemperatureAttribute(colorTemp)
3797+
}
37873798
}
37883799

37893800
@CompileStatic
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include ShellyUSA.ShellyUSA_Driver_Library
2+
3+
metadata {
4+
definition (name: 'Shelly Duo WW CW', namespace: 'ShellyUSA', author: 'Daniel Winks', importUrl: '') {
5+
capability 'Initialize'
6+
capability 'Configuration'
7+
capability 'Refresh'
8+
capability 'Switch'
9+
capability 'SwitchLevel' //level - NUMBER, unit:%
10+
capability 'Bulb'
11+
capability 'Light'
12+
capability 'ColorTemperature' //colorName - STRING colorTemperature - NUMBER, unit:°K
13+
}
14+
}
15+
16+
@Field static Boolean GEN1 = true
17+
@Field static Integer COOLTEMP = 6500
18+
@Field static Integer WARMTEMP = 2700
19+
@Field static Boolean NOCHILDREN = true
20+
@Field static List<String> ACTIONS_TO_CREATE = [
21+
'out_on_url',
22+
'out_off_url',
23+
]

0 commit comments

Comments
 (0)