Skip to content

Commit e80a64e

Browse files
committed
Remove unused code from RGB/RGBW Adapters
1 parent df7f806 commit e80a64e

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

adapters/rgbw_adapter.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from adapters.base_adapter import Adapter
44
from devices.color_colortemp_light import RGBWLight
55

6+
67
class RGBWAdapter(Adapter):
78
def __init__(self, devices):
89
super().__init__(devices)
@@ -11,7 +12,6 @@ def __init__(self, devices):
1112
self.devices.append(self.dimmer)
1213

1314
def handleCommand(self, alias, device, device_data, command, level, color):
14-
1515
cmd = command.upper()
1616

1717
if cmd == 'ON' or cmd == 'OFF':
@@ -39,15 +39,15 @@ def handleCommand(self, alias, device, device_data, command, level, color):
3939
color_temp = colorObject['t']
4040
cwww = colorObject['cw'] + colorObject['ww']
4141
ttime = 1
42-
43-
#only use cwww to determine mode
42+
43+
# only use cwww to determine mode
4444
if cwww == 0:
4545
payload = json.dumps({
4646
"state": "ON",
47-
# Disabled the transition time for now because hue bulb/zigbee2mqtt will
48-
# publish (acknowledge) the new color value during the transition with
49-
# a value between start and end of the transition, not the actual target color
50-
# "transition" : ttime,
47+
# Disabled the transition time for now because hue bulb/zigbee2mqtt will
48+
# publish (acknowledge) the new color value during the transition with
49+
# a value between start and end of the transition, not the actual target color
50+
# "transition" : ttime,
5151
"brightness": int(level * 255 / 100),
5252
"color": {
5353
"r": red,
@@ -58,7 +58,7 @@ def handleCommand(self, alias, device, device_data, command, level, color):
5858
else:
5959
payload = json.dumps({
6060
"state": "ON",
61-
# "transition" : ttime,
61+
# "transition" : ttime,
6262
"color_temp": int((color_temp / 255 * 346) + 154),
6363
"brightness": int(level * 255 / 100)
6464
})

devices/base_colortemp_light.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ class BaseRGBWLight(Device):
77
#The specific device classes need to creat specific Domoticz devices and can create/override specific logics
88
"""base device class for a color controllable rgbw light bulb"""
99

10-
def __init__(self, devices, alias, value_keys):
11-
super().__init__(devices, alias, value_keys)
12-
1310
def get_color_value(self, message, mode):
1411
if mode == 1: #mode 1 us XY from zigbee
1512
if 'brightness' in message.raw:

devices/color_colortemp_light.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
import Domoticz
33
from devices.base_colortemp_light import BaseRGBWLight
44

5-
class RGBWLight(BaseRGBWLight):
6-
"""device class for a color controllable rgbw light bulb"""
7-
8-
def __init__(self, devices, alias, value_keys):
9-
super().__init__(devices, alias, value_keys)
105

6+
class RGBWLight(BaseRGBWLight):
117
def create_device(self, unit, device_id, device_name):
128
return Domoticz.Device(Unit=unit, DeviceID=device_id, Name=device_name, Type=241, Subtype=4, Switchtype=7).Create()

devices/color_light.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
import Domoticz
33
from devices.base_colortemp_light import BaseRGBWLight
44

5-
class ColorLight(BaseRGBWLight):
6-
"""device class for a color controllable light bulb"""
7-
8-
def __init__(self, devices, alias, value_keys):
9-
super().__init__(devices, alias, value_keys)
10-
self.value_keys = value_keys.split('_') #list of capabilities as returned form MQTT, separated by '_'
115

6+
class ColorLight(BaseRGBWLight):
127
def create_device(self, unit, device_id, device_name):
138
return Domoticz.Device(Unit=unit, DeviceID=device_id, Name=device_name, Type=241, Subtype=1, Switchtype=7).Create()

0 commit comments

Comments
 (0)