diff --git a/.gitignore b/.gitignore index 3baa7616..044e9585 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,4 @@ ENV/ /.idea/homekit_python.iml *.json MANIFEST +Tests.md \ No newline at end of file diff --git a/Tests.md b/Tests.md index a2743e3d..e3ae17fa 100644 --- a/Tests.md +++ b/Tests.md @@ -4,4 +4,18 @@ ```bash python3 -m unittest -v +``` + +# Test pair & unpair + +# Bluetooth LE +```bash +PYTHONPATH=. python3 homekit/pair_ble.py -f ble.json -a DW1 -m e2:a3:cb:26:77:61 -p 893-01-591;\ +PYTHONPATH=. python3 homekit/unpair.py -f ble.json -a DW1 +``` + +# IP +```bash +PYTHONPATH=. python3 homekit/pair.py -f controller.json -a esp -d EC:73:A0:BD:97:22 -p 111-11-111;\ +PYTHONPATH=. python3 homekit/unpair.py -f controller.json -a esp ``` \ No newline at end of file diff --git a/doc/overview.puml b/doc/overview.puml index 84671fb3..85292831 100644 --- a/doc/overview.puml +++ b/doc/overview.puml @@ -107,7 +107,9 @@ package homekit { } } -class homekit.Pairing { +class homekit.AbstractPairing { + + close() + + list_accessories_and_characteristics() + get_accessories() + get_characteristics(characteristics[], include_meta, include_perms, include_type, include_events) + get_events(characteristics[], callback_fun, max_events=-1, max_seconds=-1) @@ -120,17 +122,43 @@ class homekit.Controller { + __init__(self, data) + get_pairings() + load_data(filename) - + perform_pairing(alias, accessory_id, pin) + + perform_pairing(alias, id, pin, type='IP') + remove_pairing(alias) + save_data(filename) + {static}discover(max_seconds) - + {static}identify(accessory_id) + + {static}identify(id, type='IP') } +package homekit { +note as n3 + The type marks whether the + transport is IP or Bluetooth LE. + Depending on the type the id + is either the device ID for IP + Accessories or the MAC for + Bluetooth LE Accessories. +end note +} + +n3 .right. homekit.Controller + + +class homekit.IpPairing { +} + +class homekit.BlePairing { +} + +homekit.IpPairing -up-|> homekit.AbstractPairing + +homekit.BlePairing -up-|> homekit.AbstractPairing + +homekit.AbstractPairing "*" <-down- "1" homekit.Controller -homekit.Pairing "*" <-down- "1" homekit.Controller +homekit.BleSession <-left- homekit.BlePairing +homekit.IpSession <-right- homekit.IpPairing class homekit.discover <<(E,#FF7700) executable>> { + timeout @@ -201,7 +229,7 @@ hide <> circle @enduml -class homekit.Session { +class homekit.IpSession { + {static} create_from_pairing_data(data) + {static} create_from_file(file) + get(self, url) diff --git a/setup.cfg b/setup.cfg index 5c495268..89b359ad 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,3 +3,11 @@ description-file = README.md [run] source = homekit + +[flake8] +max-line-length = 120 +statistics = True +; F401 module imported but unused +; F403 ‘from module import *’ used; unable to detect undefined names +; F405 name may be undefined, or defined from star imports: module +ignore=F401,F403,F405 diff --git a/setup.py b/setup.py index cf0ec42f..e02c2525 100644 --- a/setup.py +++ b/setup.py @@ -25,12 +25,12 @@ packages=['homekit', 'homekit.crypto', 'homekit.http_impl', 'homekit.model', 'homekit.model.services', 'homekit.model.characteristics', 'homekit.protocol', 'homekit.zeroconf_impl'], - version='0.12.0', + version='0.12.1', description='Python code to interface HomeKit Accessories and Controllers', author='Joachim Lusiardi', author_email='pypi@lusiardi.de', url='https://github.com/jlusiardi/homekit_python', - download_url='https://github.com/jlusiardi/homekit_python/archive/0.12.0.tar.gz', + download_url='https://github.com/jlusiardi/homekit_python/archive/0.12.1.tar.gz', keywords=['HomeKit'], classifiers=[ 'License :: OSI Approved :: Apache Software License',