shelly1L WIFI Relay
For distributed devices, it may be beneficial to go with radio controlled devices. To switch a thermostate, I decided for a shelly1L relay that is integrated via WIFI:
- Check, there is no jumper for operation at 240 V
- Connect power wires L, N
- Power shelly1L on
- Connect computer via WLAN to SSID: shelly1-xyz
- Enter URL in browser: 192.168.33.1
and select Internet & Security > WIFI - MODE - CLIENT
Enter name and password of your WLAN
Select Set static IP address
and set some address like 192.168.178.101
The Gateway is something like: 192.168.178.1 - Reconnect your computer to your WLAN and look for the new IP address in your router. You might want to set a static IP.
- Enter this new IP in your browser and continue configuration.
If you decided for password protection, you need to give the login in the URL like http://user:password@192.169.xxx.xxx. - If you click the virtual power switch, you should hear the click.
- configure Settings
POWER ON DEFAULT MODE: OFF
Button Type: Toggle Switch - configure Actions
OUTPUT SWITCHED ON URL: Enabled,
http://192.168.xxx.xxx/relay/0?turn=on
OUTPUT SWITCHED OFF URL: Enabled,
http://192.168.xxx.xxx/relay/0?turn=off
Python interface, simple
import time
import urllib.request
url = {}
url["on"] = "http://192.168.xxx.xxx/relay/0?turn=on"
url["off"] = "http://192.168.xxx.xxx/relay/0?turn=off"
next_call = time.time()
#toggle relay 5 times
for i in range(0,10):
if i % 2 ==1:
with urllib.request.urlopen(url["off"]) as response:
html = response.read()
else:
with urllib.request.urlopen(url["on"]) as response:
html = response.read()
print(i, html)
#wait 2 seconds to proceed
next_call = next_call+2;
time.sleep(next_call - time.time())