aboutsummaryrefslogtreecommitdiff
path: root/examples/meter.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/meter.py')
-rw-r--r--examples/meter.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/meter.py b/examples/meter.py
new file mode 100644
index 0000000..757b4f6
--- /dev/null
+++ b/examples/meter.py
@@ -0,0 +1,17 @@
+import ShellyPy
+
+# try connecting to the Shelly device under that ip
+device = ShellyPy.Shelly("192.168.68.121")
+# WILL throw an exception if the device is not reachable, gives a bad response or requires a login
+
+deviceMeter = device.meter(0) #request meter information
+print(deviceMeter['power']) #print power information
+print(deviceMeter['overpower']) #print overpower information
+print(deviceMeter['is_valid']) #print is_valid information
+print(deviceMeter['timestamp']) #print timestamp information
+print(deviceMeter['counters']) #print counters information
+print(deviceMeter['total']) #print total information
+
+device.update()
+print(device)
+