aboutsummaryrefslogtreecommitdiff
path: root/examples/relay.py
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-07-09 19:37:37 +0200
committerJan200101 <sentrycraft123@gmail.com>2023-07-09 19:37:37 +0200
commitb966f6e4705a813dad13b242e9592e699566d9c9 (patch)
treefba1a57bf3ed01b7826487c98f000ae9f111cf20 /examples/relay.py
downloadShellyPy-b966f6e4705a813dad13b242e9592e699566d9c9.tar.gz
ShellyPy-b966f6e4705a813dad13b242e9592e699566d9c9.zip
Squash rewriterewrite
Diffstat (limited to 'examples/relay.py')
-rw-r--r--examples/relay.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/relay.py b/examples/relay.py
new file mode 100644
index 0000000..36bbe45
--- /dev/null
+++ b/examples/relay.py
@@ -0,0 +1,15 @@
+import ShellyPy
+
+device = ShellyPy.api.Device.connect("192.0.0.20")
+
+# turn all relays off
+device.relays.off()
+
+# turn all relays on
+device.relays.on()
+
+# toggle all relays
+device.relays.toggle()
+
+# return relay 0 on
+device.relays[0].on()