Python package for simple access to Ngenic Tune API.
Project description
Ngenic Tune Python API Wrapper
This python package simplifies access to the Ngenic Tune API. It can be used for viewing or edit your Tune configuration.
Both sync and async APIs are provided - async APIs are prefixed with async_.
NOTE: This API wrapper is not yet finished, and only implements a subset of all the APIs. The interface may very well change.
Prerequisite
Obtain an API token
An API token may be obtained here: https://developer.ngenic.se/
Installation
$ pip install ngenicpy
Example
import json
from ngenicpy import Ngenic
# try/finally
try:
ngenic = Ngenic(token="YOUR-API-TOKEN")
except NgenicException as e:
print(str(e))
finally:
ngenic.close()
# as context manager
with Ngenic(token="YOUR-API-TOKEN") as ngenic:
tunes = ngenic.tunes()
for tune in tunes:
print("Tune %s\nName: %s\nTune Name: %s" %
(
tune.uuid(),
tune["name"],
tune["tuneName"]
)
)
tune = ngenic.tune("TUNE-UUID")
rooms = tune.rooms()
for room in rooms:
print("Room %s\nName: %s\nTarget Temperature: %d" %
(
room.uuid(),
room["name"],
room["targetTemperature"]
)
)
# Update a room
room = tune.room(room_uuid="ROOM-UUID")
room["name"] = "Livingroom"
room.update()
nodes = tune.nodes()
for node in nodes:
node_status = node.status()
print("Node %s\nType: %s" %
(
node.uuid(),
node.get_type()
)
)
if node_status:
print("Battery: %s\nRadio Signal: %s" %
(
str(node_status.battery_percentage()),
str(node_status.radio_signal_percentage())
)
)
measurements = node.measurements()
for measurement in measurements:
print("%s: %d" %
(
measurement.get_type(),
measurement["value"]
)
)
Async example
import json
from ngenicpy import Ngenic
async with AsyncNgenic(token="YOUR-API-TOKEN") as ngenic:
tunes = await ngenic.async_tunes()
for tune in tunes:
print("Tune %s\nName: %s\nTune Name: %s" %
(
tune.uuid(),
tune["name"],
tune["tuneName"]
)
)
Reference
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
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 ngenicpy-0.5.2.tar.gz.
File metadata
- Download URL: ngenicpy-0.5.2.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e6cf8e016d3ebacebdb54e8bbfe48a670fd8f628046e0a909076df62d575b77
|
|
| MD5 |
38c15af2e7cbb50feb282c64339128ca
|
|
| BLAKE2b-256 |
07ecf44efc376a31ddc4dc01a49cdb5aa5109709564d928a5860de8da770f357
|
Provenance
The following attestation bundles were made for ngenicpy-0.5.2.tar.gz:
Publisher:
publish.yml on dotnetdummy/ngenicpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ngenicpy-0.5.2.tar.gz -
Subject digest:
0e6cf8e016d3ebacebdb54e8bbfe48a670fd8f628046e0a909076df62d575b77 - Sigstore transparency entry: 203318597
- Sigstore integration time:
-
Permalink:
dotnetdummy/ngenicpy@aaf51ef602fa26af8e36683624fcdffd451a7e72 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/dotnetdummy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aaf51ef602fa26af8e36683624fcdffd451a7e72 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ngenicpy-0.5.2-py3-none-any.whl.
File metadata
- Download URL: ngenicpy-0.5.2-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8af8925489eb3371a2122ecfa4ca8a1a9087f8a79f31a9efd5e8800a6f4f18f0
|
|
| MD5 |
f3c0afa43af35cd8bf9a8d4598c0279b
|
|
| BLAKE2b-256 |
0fac115e7be0ad203afa5d9a8a7e78782ed1c34b611c09d34560db5abe20c45d
|
Provenance
The following attestation bundles were made for ngenicpy-0.5.2-py3-none-any.whl:
Publisher:
publish.yml on dotnetdummy/ngenicpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ngenicpy-0.5.2-py3-none-any.whl -
Subject digest:
8af8925489eb3371a2122ecfa4ca8a1a9087f8a79f31a9efd5e8800a6f4f18f0 - Sigstore transparency entry: 203318602
- Sigstore integration time:
-
Permalink:
dotnetdummy/ngenicpy@aaf51ef602fa26af8e36683624fcdffd451a7e72 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/dotnetdummy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aaf51ef602fa26af8e36683624fcdffd451a7e72 -
Trigger Event:
release
-
Statement type: