Package to integrate with Flume Sensor
Project description
PyFlume
Authenticates to Flume API, returns a list of devices and allows you to pull the latest sensor results over a period of time.
Configuration
You can find your Client ID and Client Secret under "API Access" on the settings page.
Configuration Variables
username:
description: Your flume user id.
required: true
type: string
password:
description: Your flume password.
required: true
type: string
client_id:
description: Your flume Client ID.
required: true
type: string
client_secret:
description: Your flume Client Secret.
required: true
type: string
Examples
import pyflume
from datetime import timedelta
from requests import Session
import logging
logging.basicConfig(filename="flume.log",level=logging.DEBUG)
KEY_DEVICE_TYPE = "type"
KEY_DEVICE_ID = "id"
FLUME_TYPE_SENSOR = 2
username="<username>"
password="<password>"
client_id="<client_id>"
client_secret="<client_secret>"
SCAN_INTERVAL = timedelta(minutes=60)
auth = pyflume.FlumeAuth(
username, password, client_id, client_secret, http_session=Session()
)
flume_devices = pyflume.FlumeDeviceList(auth)
devices = flume_devices.get_devices()
print("DEVICE LIST")
print(devices)
print("DEVICE ID")
for device in flume_devices.device_list:
if device[KEY_DEVICE_TYPE] == FLUME_TYPE_SENSOR:
print(device[KEY_DEVICE_ID])
device_id = device[KEY_DEVICE_ID]
device_timezone = device['location']['tz']
flume = pyflume.FlumeData(
auth,
device_id,
device_timezone,
SCAN_INTERVAL,
http_session=Session(),
)
flume_notifications = pyflume.FlumeNotificationList(auth, read="true")
print("NOTIFICATION LIST")
print(flume_notifications.notification_list)
## Force Update
flume.update_force()
print("AUTH HEADER")
print(auth.authorization_header)
print("QUERY PAYLOAD")
print(pyflume._generate_api_query_payload(SCAN_INTERVAL, device_timezone))
print("FLUME VALUES")
print(flume.values)
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
PyFlume-0.6.4.tar.gz
(7.5 kB
view details)
Built Distribution
File details
Details for the file PyFlume-0.6.4.tar.gz
.
File metadata
- Download URL: PyFlume-0.6.4.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f92c8949d5c77ee6c8141ecf055929527da3d66d2a4269bd16a524b8fca03dc5 |
|
MD5 | fb5a6e8c2a0e6dbc9982fdd80266b500 |
|
BLAKE2b-256 | 69f344498ee84142e78354bdc6d1487d22b0aeac0c25864c1421d92f1fbe5917 |
File details
Details for the file PyFlume-0.6.4-py3-none-any.whl
.
File metadata
- Download URL: PyFlume-0.6.4-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1a0291d735674e64658235f1bcfcbec7bd19db2611f472ee8f5b2795d877107 |
|
MD5 | 3a6cba5ac2eb7e9ea01ac0fe42c928a8 |
|
BLAKE2b-256 | d701a64de782708bf1838482069b15de31143ae5bbf12304085ab4c6fc0abe8a |