Convert to use poetry & pyproject.toml for dep & build management (#54)

* Convert to use poetry and pyproject.toml, update README

* add some resources for contributors

* minor adjustments

* ci: separate tests from linting, run using poetry

* add pytest-mock to dev requirements

* combine running tests and reporting to codecov

* generate both xml and html coverage reports

* add codecov to dev dependencies
This commit is contained in:
Teemu R
2020-05-12 12:11:47 +02:00
committed by GitHub
parent c6d76836d7
commit ed57563e8b
19 changed files with 296 additions and 312 deletions

View File

@@ -23,7 +23,7 @@ TPLINK_KELVIN = {
class SmartBulb(SmartDevice):
"""Representation of a TP-Link Smart Bulb.
Usage example when used as library:
Usage example:
```python
p = SmartBulb("192.168.1.105")
await p.update()
@@ -33,6 +33,7 @@ class SmartBulb(SmartDevice):
# change state of bulb
await p.turn_on()
assert p.is_on
await p.turn_off()
# query and print current state of plug
@@ -40,12 +41,11 @@ class SmartBulb(SmartDevice):
# check whether the bulb supports color changes
if p.is_color:
# set the color to an HSV tuple
await p.set_hsv(180, 100, 100)
# get the current HSV value
print(p.hsv)
print("we got color!")
# set the color to an HSV tuple
await p.set_hsv(180, 100, 100)
# get the current HSV value
print(p.hsv)
# check whether the bulb supports setting color temperature
if p.is_variable_color_temp:
@@ -57,12 +57,11 @@ class SmartBulb(SmartDevice):
# check whether the bulb is dimmable
if p.is_dimmable:
# set the bulb to 50% brightness
await p.set_brightness(50)
# set the bulb to 50% brightness
await p.set_brightness(50)
# check the current brightness
print(p.brightness)
# check the current brightness
print(p.brightness)
```
Errors reported by the device are raised as SmartDeviceExceptions,