-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""List defined zones.""" | ||
import asyncio | ||
import aiohttp | ||
|
||
from my_token import MY_TOKEN | ||
|
||
from myuplink.auth import Auth | ||
from myuplink import MyUplinkAPI | ||
|
||
PARAMETERS = ["40004", "40940", "40005"] | ||
|
||
|
||
async def main(): | ||
"""Connect and print test data.""" | ||
async with aiohttp.ClientSession() as session: | ||
auth = Auth( | ||
session, | ||
"https://api.myuplink.com", | ||
MY_TOKEN, | ||
) | ||
api = MyUplinkAPI(auth) | ||
|
||
systems = await api.async_get_systems() | ||
for system in systems: | ||
print(f"System id: {system.id}") | ||
print(f"System name: {system.name}") | ||
|
||
print(f"No of devices in system: {len(system.devices)}") | ||
for sys_device in system.devices: | ||
device = await api.async_get_device(sys_device.deviceId) | ||
print(device.id) | ||
print(device.productName) | ||
print(device.productSerialNumber) | ||
print(device.firmwareCurrent) | ||
print(device.firmwareDesired) | ||
print(device.connectionState) | ||
|
||
points = await api.async_get_device_points( | ||
sys_device.deviceId, points=PARAMETERS | ||
) | ||
for point in points: | ||
print( | ||
f"{point.parameter_id} | {point.parameter_name} | {point.value}" | ||
) | ||
print() | ||
|
||
|
||
asyncio.run(main()) |
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