Shelly
Appearance
Shelly Plug S
Web Gui Settings
- http://<IP>/
- Settings
- Device Name
- Power on default mode -> On
- Time Zone and Geolocation -> set GPS coordinates (for sunrise and sunset event triggers)
- Eco mode -> On
- Internet & Security
- Wifi Client Backup -> Off
- Restrict login -> set password
API
See API documentation at [1]
See my example code at https://github.com/entorb/shelly-api
Read settings
http://<IP>/settings
Shelly Plus Plug S
Web Gui Settings
- http://<IP>/
- Access Point -> Off
- Bluetooth -> Off
- Device info -> Device Name
- Location and Timezone -> set GPS coordinates (for sunrise and sunset event triggers) (Erlangen = 49.583333, 11.016667)
- Eco mode -> On
- Firmware -> Update
- Authentication -> Set Password
- MQTT
- Enable
- only "Generic status update over MQTT" needed
- set MQTT prefix and Username to devicename
- Credentials (provide password whenever changing settings)
- (only needed when sending switch commands via MQTT:) Enable MQTT Control
- not needed: Enable RPC over MQTT
- not needed: RPC status notifications over MQTT
- Home -> Settings -> LED -> Switch state, on=green, off=black, on=5%
API
See API documentation at [2]
Simple cURL example for password protected Shelly:
curl -s --digest -u admin:myPwd "http://192.168.178.123/rpc/Switch.Toggle?id=0" or curl -s --digest -u admin:myPwd "http://192.168.178.123/rpc/Switch.Set?id=0&on=true"
See my example code at https://github.com/entorb/shelly-api
Read Config
http://<IP>/rpc/PLUGS_UI.GetConfig
Disable LEDs (not working if Authentication is activated)
http://<IP>/rpc/PLUGS_UI.SetConfig?config={%22leds%22:{%22mode%22:%22off%22}}
MQTT
Switch on/off/toggle via MQTT
mosquitto_pub -u mqtt_user -P mqtt_pass -t "myPlugName/command/switch:0" -m "on" mosquitto_pub -u mqtt_user -P mqtt_pass -t "myPlugName/command/switch:0" -m "off" mosquitto_pub -u mqtt_user -P mqtt_pass -t "myPlugName/command/switch:0" -m "toggle"
InfluxDB and Graphana
see https://github.com/entorb/raspi-sensorics/blob/main/mqtt_influx.py