|
import asyncio |
|
import os |
|
import sys |
|
|
|
from bradford_white_connect_client import BradfordWhiteConnectClient |
|
|
|
|
|
async def main(): |
|
email = os.environ.get("BW_EMAIL") |
|
password = os.environ.get("BW_PASSWORD") |
|
|
|
if not email or not password: |
|
print("Set BW_EMAIL and BW_PASSWORD environment variables.") |
|
sys.exit(1) |
|
|
|
client = BradfordWhiteConnectClient(email=email, password=password) |
|
|
|
try: |
|
devices = await client.get_devices() |
|
print(f"Found {len(devices)} water heater(s)\n") |
|
|
|
for device in devices: |
|
print(f"=== {device.product_name} ===") |
|
print(f" Model: {device.model}") |
|
print(f" OEM Model: {device.oem_model}") |
|
print(f" DSN: {device.dsn}") |
|
print(f" MAC: {device.mac}") |
|
print(f" LAN IP: {device.lan_ip}") |
|
print(f" SW Version: {device.sw_version}") |
|
print(f" Template ID: {device.template_id}") |
|
print(f" Device Type: {device.device_type}") |
|
print(f" Connection: {device.connection_status}") |
|
print(f" Connected At: {device.connected_at}") |
|
print(f" Location: {device.locality}") |
|
print(f" Coordinates: ({device.lat}, {device.lng})") |
|
print(f" Dealer: {device.dealer}") |
|
print(f" LAN Enabled: {device.lan_enabled}") |
|
print(f" Has Properties: {device.has_properties}") |
|
print() |
|
|
|
if device.has_properties: |
|
properties = await client.get_device_properties(device) |
|
print(f" Properties ({len(properties)}):") |
|
for pw in properties: |
|
p = pw.property |
|
print(f" {p.display_name:30s} ({p.name}) = {p.value}") |
|
print() |
|
|
|
finally: |
|
await client.session.close() |
|
|
|
|
|
asyncio.run(main()) |