Skip to content

Commit dc5e367

Browse files
committed
v2.0.1
a beautiful pypi release
1 parent 63b2fb6 commit dc5e367

File tree

6 files changed

+54
-11
lines changed

6 files changed

+54
-11
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
:target: https://badge.fury.io/py/sunix-ledstrip-controller-client
33

44
sunix-ledstrip-controller-client |pypi_version|
5-
================================
5+
================================================
66

77
A python 3.4+ library for controlling the Sunix® RGB / RGBWWCW WiFi LED Strip controller.
88

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
construct
2+
typing;python_version<"3.5"

setup.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import setup, find_packages
44

5-
VERSION_NUMBER = "2.0.0"
5+
VERSION_NUMBER = "2.0.1"
66

77
GIT_BRANCH = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"])
88
GIT_BRANCH = GIT_BRANCH.decode() # convert to standard string
@@ -22,14 +22,44 @@
2222
DEVELOPMENT_STATUS = "Development Status :: 2 - Pre-Alpha"
2323
VERSION_NAME = "%s-%s" % (VERSION_NUMBER, GIT_BRANCH)
2424

25+
26+
def readme_type() -> str:
27+
import os
28+
if os.path.exists("README.rst"):
29+
return "text/x-rst"
30+
if os.path.exists("README.md"):
31+
return "text/markdown"
32+
33+
34+
def readme() -> [str]:
35+
with open('README.rst') as f:
36+
return f.read()
37+
38+
39+
def install_requirements() -> [str]:
40+
return read_requirements_file("requirements.txt")
41+
42+
43+
def test_requirements() -> [str]:
44+
return read_requirements_file("test_requirements.txt")
45+
46+
47+
def read_requirements_file(file_name: str):
48+
with open(file_name, encoding='utf-8') as f:
49+
requirements_file = f.readlines()
50+
return [r.strip() for r in requirements_file]
51+
52+
2553
setup(
2654
name='sunix_ledstrip_controller_client',
2755
version=VERSION_NAME,
2856
description='A library for controlling the Sunix RGB / RGBWWCW WiFi LED Strip controller',
57+
long_description=readme(),
58+
long_description_content_type=readme_type(),
2959
license='GPLv3+',
3060
author='Markus Ressel',
3161
author_email='mail@markusressel.de',
32-
url='https://www.markusressel.de',
62+
url='https://github.com/markusressel/sunix-ledstrip-controller-client',
3363
packages=find_packages(),
3464
classifiers=[
3565
DEVELOPMENT_STATUS,
@@ -40,8 +70,6 @@
4070
'Programming Language :: Python :: 3.6',
4171
'Programming Language :: Python :: 3.7'
4272
],
43-
install_requires=[
44-
'construct',
45-
'typing;python_version<"3.5"'
46-
]
73+
install_requires=install_requirements(),
74+
tests_require=test_requirements()
4775
)

sunix_ledstrip_controller_client/controller.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,22 @@ def extract_timer_pattern(data: dict, idx: int) -> datetime:
271271

272272
timers = []
273273
for idx in range(1, 7):
274+
enabled = Timer.STATE_ENABLED == timers_data["is_active_%d" % idx]
275+
274276
time = extract_timer_time(timers_data, idx)
275277
pattern = extract_timer_pattern(timers_data, idx)
276278

279+
red = timers_data["red_%d" % idx]
280+
green = timers_data["green_%d" % idx]
281+
blue = timers_data["blue_%d" % idx]
282+
277283
timer = Timer(
278-
enabled=timers_data["is_active_%d" % idx],
284+
enabled=enabled,
279285
execution_time=time,
280286
pattern=pattern,
281-
red=timers_data["red_%d" % idx],
282-
green=timers_data["green_%d" % idx],
283-
blue=timers_data["blue_%d" % idx],
287+
red=red,
288+
green=green,
289+
blue=blue,
284290
)
285291

286292
timers.append(timer)

sunix_ledstrip_controller_client/timer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ class Timer:
77
Representation of a single timer configuration
88
"""
99

10+
STATE_ENABLED = 0xf0
11+
STATE_DISABLED = 0x00
12+
1013
def __init__(self, enabled: bool,
1114
execution_time: datetime, pattern: any,
1215
red: int, green: int, blue: int):
@@ -61,6 +64,10 @@ class Weekday(Enum):
6164

6265

6366
class Mode(Enum):
67+
"""
68+
Constants for specific action modes of a timer
69+
"""
70+
6471
TurnOn = 0xf0
6572
TurnOff = 0x00
6673
Color = 0x61

test_requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)