Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.

Files for ngenicpy, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size ngenicpy-0.1.1-py3-none-any.whl (9.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size ngenicpy-0.1.1.tar.gz (5.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page