-
Notifications
You must be signed in to change notification settings - Fork 18
Examples
Malene Trab edited this page Apr 16, 2024
·
2 revisions
from pyworxcloud import WorxCloud
cloud = WorxCloud("your@email", "password", "worx")
# Initialize connection
try:
cloud.authenticate()
except AuthorizationError:
# If invalid credentials are used, or something happend during
# authorize, then exit
exit(0)
# Connect to device with index 0 (devices are enumerated 0, 1, 2 ...)
# and do not verify SSL (False)
cloud.connect()
# Do your stuff
# Disconnect from the API
cloud.disconnect()
This can be done in 2 ways
from pyworxcloud import WorxCloud
from pprint import pprint
with WorxCloud("your@email","password","worx") as cloud:
for _, device in cloud.devices.items():
cloud.update(device.serial_number)
pprint(vars(device))
from pyworxcloud import WorxCloud
from pprint import pprint
cloud = WorxCloud("your@email", "password", "worx")
# Initialize connection
try:
cloud.authenticate()
except AuthorizationError:
# If invalid credentials are used, or something happend during
# authorize, then exit
exit(0)
# Connect to device with index 0 (devices are enumerated 0, 1, 2 ...)
# and do not verify SSL (False)
cloud.connect()
# Read latest states received from the device
for _, device in cloud.devices.items():
cloud.update(device.serial_number)
# Print all vars and attributes of the cloud object
pprint(vars(device))
# Disconnect from the API
cloud.disconnect()