diff --git a/hue-gui.ui b/hue-gui.ui
index f36de61..c87891f 100644
--- a/hue-gui.ui
+++ b/hue-gui.ui
@@ -2191,6 +2191,19 @@
true
+
+
+
+ 840
+ 50
+ 121
+ 21
+
+
+
+ Toggle Unit LED
+
+
diff --git a/hue_plus/hue.py b/hue_plus/hue.py
index 85a04d3..ffd156c 100755
--- a/hue_plus/hue.py
+++ b/hue_plus/hue.py
@@ -92,6 +92,9 @@ def main():
parser_power = subparsers.add_parser('power', help="Control power to the channels")
parser_power.add_argument("state", type=str, help="State (on/off)")
+ parser_unitled = subparsers.add_parser('unitled', help="Control power to the unit LED")
+ parser_unitled.add_argument("state", type=str, help="State (on/off)")
+
parser_profile = subparsers.add_parser('profile', help="Add or remove or apply profiles")
subparsers_profile = parser_profile.add_subparsers(help="The type of profile action", dest='profile_command')
@@ -136,6 +139,8 @@ def main():
custom(ser, args.gui, args.channel, args.colors, args.mode, args.speed)
elif args.command == 'power':
power(ser, args.channel, args.state)
+ elif args.command == 'unitled':
+ unitled(ser, args.state)
elif args.command == 'profile':
if args.profile_command == 'add':
profile_add(args.name)
@@ -539,6 +544,17 @@ def power(ser, channel, state):
else:
raise InvalidCommand("No such power state")
+def unitled(ser, state):
+ outputs = [70, 0, 192, 0, 0, 0, 0]
+ if state.lower() == 'on':
+ outputs[6] = 255
+ elif state.lower() == 'off':
+ outputs[5] = 255
+ else:
+ raise InvalidCommand("No such unit led state")
+ ser.write(bytearray(outputs))
+ ser.read()
+
def custom(ser, gui, channel, colors, mode, speed):
strips = [strips_info(ser, 1), strips_info(ser, 2)]
diff --git a/hue_plus/hue_gui.py b/hue_plus/hue_gui.py
index aa44f00..a2fd3a6 100644
--- a/hue_plus/hue_gui.py
+++ b/hue_plus/hue_gui.py
@@ -576,6 +576,9 @@ def setupUi(self, MainWindow):
self.label_6.setFont(font)
self.label_6.setWordWrap(True)
self.label_6.setObjectName("label_6")
+ self.unitLEDBtn = QtWidgets.QPushButton(self.centralwidget)
+ self.unitLEDBtn.setGeometry(QtCore.QRect(840, 50, 121, 21))
+ self.unitLEDBtn.setObjectName("unitLEDBtn")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
@@ -729,4 +732,5 @@ def retranslateUi(self, MainWindow):
self.label.setText(_translate("MainWindow", "Port:"))
self.portTxt.setText(_translate("MainWindow", "/dev/ttyACM0"))
self.label_6.setText(_translate("MainWindow", "Now with support for turning on and off at specific times, audio on Windows, a way to make your own modes, and more!"))
+ self.unitLEDBtn.setText(_translate("MainWindow", "Toggle Unit LED"))
diff --git a/hue_plus/hue_ui.py b/hue_plus/hue_ui.py
index 3146ce7..4e24a06 100755
--- a/hue_plus/hue_ui.py
+++ b/hue_plus/hue_ui.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-VERSION="1.4.1"
+VERSION="1.4.2"
import sys
from time import sleep
import os
@@ -125,6 +125,8 @@ def __init__(self):
self.animatedColors = []
+ self.unitLEDBtn.clicked.connect(self.toggleUnitLED)
+
self.fixedAdd.clicked.connect(self.fixedAddFunc)
self.fixedDelete.clicked.connect(self.fixedDeleteFunc)
self.breathingAdd.clicked.connect(self.breathingAddFunc)
@@ -192,6 +194,8 @@ def __init__(self):
self.audioThread = None
self.animatedThread = None
+ self.unitLED = 'on'
+
def closeEvent(self, event):
self.checkAudio()
event.accept()
@@ -247,6 +251,15 @@ def getColors(self, modeList):
return ['FF0000']
return colors
+ def toggleUnitLED(self):
+ if self.unitLED == 'on':
+ self.unitLED = 'off'
+ else:
+ self.unitLED = 'on'
+
+ with serial.Serial(self.portTxt.text(), 256000) as ser:
+ hue.unitled(ser, self.unitLED)
+
def timeDaemon(self):
pre = previous.list_profile()
if 'previous' in pre:
@@ -265,6 +278,7 @@ def timeDaemon(self):
with serial.Serial(self.portTxt.text(), 256000) as ser:
print("Turning off")
hue.power(ser, 0, 'off')
+ hue.unitled(ser, 'off')
self.doneOff = True
self.doneOn = False
except serial.serialutil.SerialException:
@@ -276,6 +290,7 @@ def timeDaemon(self):
with serial.Serial(self.portTxt.text(), 256000) as ser:
print("Turning on")
hue.profile_apply(ser, pre)
+ hue.unitled(ser, 'on')
self.doneOn = True
self.doneOff = False
except serial.serialutil.SerialException:
diff --git a/installer.cfg b/installer.cfg
index 65fb483..79a921b 100644
--- a/installer.cfg
+++ b/installer.cfg
@@ -1,6 +1,6 @@
[Application]
name=hue_plus
-version=1.4.1
+version=1.4.2
publisher=Gustav Hansen
# How to launch the app - this calls the 'main' function from the 'myapp' package:
entry_point=hue_plus.hue_ui:main
diff --git a/setup.py b/setup.py
index f8c2ad8..bb7d758 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@
import os
setup(name='hue_plus',
- version='1.4.1',
+ version='1.4.2',
description='A utility to control the NZXT Hue+ in Linux',
classifiers=[
'Development Status :: 5 - Production/Stable',
diff --git a/version b/version
index 347f583..9df886c 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-1.4.1
+1.4.2