-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from jlusiardi/pypi
Publish module on PyPi
- Loading branch information
Showing
26 changed files
with
1,950 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os.path | ||
|
||
from homekit import HomeKitServer | ||
|
||
from homekit.model import Accessory, LightBulbService | ||
|
||
|
||
def light_switched(newval): | ||
print('=======> light switched: {x}'.format(x=newval)) | ||
|
||
|
||
if __name__ == '__main__': | ||
try: | ||
httpd = HomeKitServer(os.path.expanduser('~/.homekit/demoserver.json')) | ||
|
||
accessory = Accessory('Testlicht') | ||
lightBulbService = LightBulbService() | ||
lightBulbService.set_on_callback(light_switched) | ||
accessory.services.append(lightBulbService) | ||
httpd.accessories.add_accessory(accessory) | ||
|
||
print(httpd.accessories.__str__()) | ||
|
||
httpd.publish_device() | ||
print('published device and start serving') | ||
httpd.serve_forever() | ||
except KeyboardInterrupt: | ||
print('unpublish device') | ||
httpd.unpublish_device() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
import homekit.feature_flags | ||
import homekit.categories | ||
import homekit.characteristics | ||
import homekit.services | ||
import homekit.model.categories | ||
import homekit.model.services | ||
import homekit.statuscodes | ||
import homekit.zeroconf | ||
from homekit.tlv import TLV | ||
from homekit.srp import SrpClient | ||
from homekit.chacha20poly1305 import chacha20_aead_encrypt, chacha20_aead_decrypt | ||
from homekit.protocol import perform_pair_setup, get_session_keys | ||
from homekit.secure_http import SecureHttp | ||
from homekit.server import HomeKitServer | ||
from homekit.srp import SrpClient | ||
from homekit.tlv import TLV | ||
from homekit.tools import load_pairing, save_pairing | ||
from homekit.protocol import perform_pair_setup, get_session_keys | ||
|
||
# Init lookup objects | ||
FeatureFlags = homekit.feature_flags.FeatureFlags | ||
Categories = homekit.categories.Categories | ||
StatusCodes = homekit.statuscodes.StatusCodes | ||
CharacteristicsTypes = homekit.characteristics.CharacteristicsTypes | ||
ServicesTypes = homekit.services.ServicesTypes | ||
Categories = homekit.model.categories.Categories | ||
HapStatusCodes = homekit.statuscodes.HapStatusCodes | ||
HttpStatusCodes = homekit.statuscodes.HttpStatusCodes | ||
CharacteristicsTypes = homekit.model.CharacteristicsTypes | ||
ServicesTypes = homekit.model.services.ServicesTypes | ||
|
||
discover_homekit_devices = homekit.zeroconf.discover_homekit_devices | ||
find_device_ip_and_port = homekit.zeroconf.find_device_ip_and_port |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from homekit.model.characteristics import CharacteristicsTypes | ||
from homekit.model.mixin import ToDictMixin, get_id | ||
from homekit.model.services import AcessoryInformationService, LightBulbService, OutletService, FanService, \ | ||
ThermostatService | ||
from homekit.model.categories import Categories | ||
|
||
|
||
class Accessory(ToDictMixin): | ||
def __init__(self, name): | ||
self.aid = get_id() | ||
self.services = [ | ||
AcessoryInformationService(name) | ||
] | ||
|
||
def get_name(self): | ||
for service in self.services: | ||
if isinstance(service, AcessoryInformationService): | ||
return service.get_name() | ||
return None | ||
|
||
|
||
class Accessories(ToDictMixin): | ||
def __init__(self): | ||
self.accessories = [] | ||
|
||
def add_accessory(self, acessory: Accessory): | ||
self.accessories.append(acessory) |
File renamed without changes.
Oops, something went wrong.