Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/localapi #1

Merged
merged 13 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- 'main'
- 'releases/**'
- 'feature/**'
paths:
- 'setup.py'

Expand Down
44 changes: 25 additions & 19 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
'''
Created on 01.11.2020

@author: joerg
'''
import time
from pytedee_async.TedeeClient import TedeeClient
from pytedee_async.Lock import Lock
from pytedee_async.TedeeClientException import TedeeClientException
from pytedee_async.helpers import *
"""Test run."""
import asyncio
import json

from pytedee_async import TedeeClient
from pytedee_async.lock import TedeeLock


async def main():
with open("config.json") as f:
with open("config.json", encoding="utf-8") as f:
data = json.load(f)
'''Tedee Credentials'''
personalToken = data["personalToken"]
personal_token = data["personalToken"]
ip = data["ip"]
local_token = data["localToken"]

client = await TedeeClient.create(personalToken)
print ("Token: " + str(client._personalToken))
client = await TedeeClient.create(personal_token, local_token, ip)
bridge = await client.get_local_bridge()
bridges = await client.get_bridges()
client = await TedeeClient.create(
personal_token, local_token, ip, bridge_id=bridges[0].bridge_id
)
locks = client.locks

locks_list = [lock.to_dict() for _, lock in client.locks_dict.items()]
print(locks_list)
json_locks = json.dumps(locks_list)
loaded = json.loads(json_locks)
for lock in loaded:
dec = TedeeLock(**lock)
for lock in locks:
print("----------------------------------------------")
print("Lock name: " + lock.name)
print("Lock id: " + str(lock.id))
print("Lock name: " + lock.lock_name)
print("Lock id: " + str(lock.lock_id))
print("Lock Battery: " + str(lock.battery_level))
await client.get_state()
print("Is Locked: " + str(client.is_locked(lock.id)))
print("Is Unlocked: " + str(client.is_unlocked(lock.id)))
# await client.register_webhook("http://test.local", headers=[{"Authorization": "Basic " + "test"}])
await client.sync()
# await client.lock(lock.id)
# await asyncio.sleep(5)
Expand All @@ -43,4 +49,4 @@ async def main():
# await client.pull(lock.id)


asyncio.run(main())
asyncio.run(main())
122 changes: 0 additions & 122 deletions pytedee_async/Lock.py

This file was deleted.

189 changes: 0 additions & 189 deletions pytedee_async/TedeeClient.py

This file was deleted.

Loading
Loading