Skip to content

Commit 8321e03

Browse files
committed
Update sample code
Sample code was using super-old API and was not working.
1 parent 812833c commit 8321e03

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sample/sample.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
from maxcube.cube import MaxCube
24
from maxcube.device import (
35
MAX_DEVICE_MODE_AUTOMATIC,
@@ -8,7 +10,7 @@
810
MAX_WINDOW_SHUTTER,
911
)
1012

11-
cube = MaxCube("192.168.0.20", 62910)
13+
cube = MaxCube(os.environ.get("MAXCUBE_IP", "192.168.0.20"), 62910)
1214

1315
print("Serial: %s" % (cube.serial))
1416
for room in cube.rooms:
@@ -63,7 +65,7 @@
6365

6466
for device in cube.devices:
6567
print(device)
66-
if cube.is_wallthermostat(device) or cube.is_thermostat(device):
68+
if device.is_wallthermostat() or device.is_thermostat():
6769
print("Setting temp")
6870
cube.set_target_temperature(device, 8)
6971
else:
@@ -73,7 +75,7 @@
7375

7476
for device in cube.devices:
7577
print(device)
76-
if cube.is_wallthermostat(device):
78+
if device.is_wallthermostat():
7779
print("Setting mode")
7880
cube.set_mode(device, MAX_DEVICE_MODE_MANUAL)
7981
else:

0 commit comments

Comments
 (0)