A python API wrapper for Smappee
Project description
# Smappy
API wrapper for Smappee
See https://smappee.atlassian.net/wiki/display/DEVAPI/API+Methods
## Create a new connection by supplying your Smappee client id and secret
`s = smappy.Smappee(client_id, client_secret)`
## Authenticate using a Smappee username and password
`s.authenticate(username, password)`
Re-authentication using the refresh token is done automatically when the access token has expired.
## API Requests
7 API requests are supported. The methods return the parsed JSON response as a dict.
### Get Service Locations
`s.get_service_locations()`
### Get Service Location Info
`s.get_service_location_info(service_location_id)`
### Get Consumption
- `s.get_consumption(service_location_id, start, end, aggregation)`
- `s.get_sensor_consumption(service_location_id, sensor_id, start, end, aggregation)`
Start & End accept epoch (in milliseconds), datetime and pandas timestamps
Aggregation: 1 = 5 min values (only available for the last 14 days), 2 = hourly values, 3 = daily values, 4 = monthly values, 5 = quarterly values
### Get Events
`s.get_events(service_location_id, appliance_id, start, end, max_number)`
### Actuators
NOTE: These methods are untested, so please provide feeback if you are using them, successfully or otherwise.
- `s.actuator_on(self, service_location_id, actuator_id, duration)`
- `s.actuator_off(self, service_location_id, actuator_id, duration)`
duration = 300,900,1800 or 3600 , specifying the time in seconds the actuator
should be turned on or off. Any other value results in turning on or off for an
undetermined period of time.
## Consumption as Pandas DataFrame
Get consumption values in a Pandas Data Frame
- To get total Electricity consumption and Solar production, use:
`s.get_consumption_dataframe(service_location_id, start, end, aggregation, localize)`
- To get consumption for a specific sensor, include a sensor id:
`s.get_consumption_dataframe(service_location_id, start, end, aggregation, localize, sensor_id)`
Use the localize flag to get localized timestamps.
# Simple Smappee
If you have no client id, client secret, refresh token etc, for instance if everything concerning oAuth is handed off
to a different process like a web layer. This object only uses a given access token. It has no means of refreshing it
when it expires, in which case the requests will raise errors.
`ss = SimpleSmappee(access_token)`
It has the same methods as the normal Smappee class, except authorization and re-authorization will not work.
# Future
Future development may include:
Request error catching and handling.
API wrapper for Smappee
See https://smappee.atlassian.net/wiki/display/DEVAPI/API+Methods
## Create a new connection by supplying your Smappee client id and secret
`s = smappy.Smappee(client_id, client_secret)`
## Authenticate using a Smappee username and password
`s.authenticate(username, password)`
Re-authentication using the refresh token is done automatically when the access token has expired.
## API Requests
7 API requests are supported. The methods return the parsed JSON response as a dict.
### Get Service Locations
`s.get_service_locations()`
### Get Service Location Info
`s.get_service_location_info(service_location_id)`
### Get Consumption
- `s.get_consumption(service_location_id, start, end, aggregation)`
- `s.get_sensor_consumption(service_location_id, sensor_id, start, end, aggregation)`
Start & End accept epoch (in milliseconds), datetime and pandas timestamps
Aggregation: 1 = 5 min values (only available for the last 14 days), 2 = hourly values, 3 = daily values, 4 = monthly values, 5 = quarterly values
### Get Events
`s.get_events(service_location_id, appliance_id, start, end, max_number)`
### Actuators
NOTE: These methods are untested, so please provide feeback if you are using them, successfully or otherwise.
- `s.actuator_on(self, service_location_id, actuator_id, duration)`
- `s.actuator_off(self, service_location_id, actuator_id, duration)`
duration = 300,900,1800 or 3600 , specifying the time in seconds the actuator
should be turned on or off. Any other value results in turning on or off for an
undetermined period of time.
## Consumption as Pandas DataFrame
Get consumption values in a Pandas Data Frame
- To get total Electricity consumption and Solar production, use:
`s.get_consumption_dataframe(service_location_id, start, end, aggregation, localize)`
- To get consumption for a specific sensor, include a sensor id:
`s.get_consumption_dataframe(service_location_id, start, end, aggregation, localize, sensor_id)`
Use the localize flag to get localized timestamps.
# Simple Smappee
If you have no client id, client secret, refresh token etc, for instance if everything concerning oAuth is handed off
to a different process like a web layer. This object only uses a given access token. It has no means of refreshing it
when it expires, in which case the requests will raise errors.
`ss = SimpleSmappee(access_token)`
It has the same methods as the normal Smappee class, except authorization and re-authorization will not work.
# Future
Future development may include:
Request error catching and handling.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
smappy-0.2.9.tar.gz
(7.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smappy-0.2.9.tar.gz.
File metadata
- Download URL: smappy-0.2.9.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0912a3d81dba93a7614ba03d5f2a2c9a3aa3ef6b136de2a039f2ba6b818a25fb
|
|
| MD5 |
fea1f5a81869bd7c66da830213cd2e87
|
|
| BLAKE2b-256 |
068c15bca80f61c7c0fd4266dc800642c0af214867f0af62c63693a370d42e70
|
File details
Details for the file smappy-0.2.9-py3-none-any.whl.
File metadata
- Download URL: smappy-0.2.9-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b25631716beb6e036298d91f82e02cf9eb3f9959b2bf518561daf4349378c1f
|
|
| MD5 |
18f490ee9fc01c91fea2374bb390534a
|
|
| BLAKE2b-256 |
eaeec46c1a15737036dc61ede73910f8c8e6e6d9c7a6a9ff090a217c13ca8752
|