Skip to main content

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.

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
ng = Ngenic(token="YOUR-API-TOKEN")

tunes = ng.tunes()
for tune in tunes:
    print("Tune %s\nName: %s\nTune Name: %s" %
            (
                tune.uuid(),
                tune["name"],
                tune["tuneName"]
            )
    )

tune = ng.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(roomUuid="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"]
                )
        )

Reference

Ngenic Tune Public API

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ngenicpy-0.1.2b1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ngenicpy-0.1.2b1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file ngenicpy-0.1.2b1.tar.gz.

File metadata

  • Download URL: ngenicpy-0.1.2b1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.5rc1

File hashes

Hashes for ngenicpy-0.1.2b1.tar.gz
Algorithm Hash digest
SHA256 724b6100165379b9316c9d98f4e6e198693786726d8cfc891af13db866b791db
MD5 1faee6c7070a9a36dfca3802bbc81476
BLAKE2b-256 7bfbca214e2649af411b2e0e645c33a76c798d1e061d81b17e2b752681e6aad1

See more details on using hashes here.

File details

Details for the file ngenicpy-0.1.2b1-py3-none-any.whl.

File metadata

  • Download URL: ngenicpy-0.1.2b1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.5rc1

File hashes

Hashes for ngenicpy-0.1.2b1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b4956af65c91e34a9b4072f01b65519c50967b2fb76f881265df614752b34b5
MD5 8e4e138893445148703060c3fcbcbd0f
BLAKE2b-256 e7f6f7a126df9b8fa8e03182a2324bfa5ca5290370f90ce79c0a98f6378a053f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page