Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/entorb/shelly-api
Example Python code for accessing the API of (password-protected) Shelly devices
https://github.com/entorb/shelly-api
api python python3 rfc7616 shelly shelly-plug-s shelly-plugs
Last synced: about 1 month ago
JSON representation
Example Python code for accessing the API of (password-protected) Shelly devices
- Host: GitHub
- URL: https://github.com/entorb/shelly-api
- Owner: entorb
- License: gpl-3.0
- Created: 2023-10-04T05:30:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-28T12:38:49.000Z (6 months ago)
- Last Synced: 2024-06-28T14:03:09.527Z (6 months ago)
- Topics: api, python, python3, rfc7616, shelly, shelly-plug-s, shelly-plugs
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shelly-api
Example Python (3.12) code for accessing the API of (password-protected) Shelly devices.
Written for Shelly Plug S and Plus Plug S according to [API gen1 spec](https://shelly-api-docs.shelly.cloud/gen1/#shelly-plug-plugs-meter-0) and [API gen2 spec](https://shelly-api-docs.shelly.cloud/gen2/General/Authentication).
Motivation: Shelly Plug S does not support local MQTT connection in parallel to cloud connection. Hence, I needed to retrieve the data (for my local InfluxDB and Grafana) via API instead.
Note: Password protection/authentication is activated in my devices, hence needed here as well.
* `credentials.py` set Shelly IP and login credentials
* `read_api_v1.py` example code for Shelly Plug S using API gen1
* `read_api_v2.py` example code for Shelly Plus Plug S using API gen2## Features
* [x] access Shelly Plug S API gen1 via basic authentication
* [x] access Shelly Plus Plug S API gen2 via digest authentication / [RFC7616](https://datatracker.ietf.org/doc/html/rfc7616)
* [x] read meter power and energy data