Skip to main content

python library for accessing the openHAB REST API

Project description

Code Health Codacy badge Documentation Status pypi version

python library for accessing the openHAB REST API

This library allows for easily accessing the openHAB REST API. A number of features are implemented but not all, this is work in progress.

Requirements

  • python >= 3.5

  • python :: dateutil

  • python :: requests

  • python :: typing

Note on openHAB1:

The current version is focused on OpenHAB 2.x; OpenHAB 1.x might still work, though this is not tested. If you require older OpenHAB support, please use an older version of this library.

Installation

Install the latest version using pip:

pip install python-openhab

Example

Example usage of the library:

from openhab import openHAB

base_url = 'http://localhost:8080/rest'
openhab = openHAB(base_url)

# fetch all items
items = openhab.fetch_all_items()

sunset = items.get('Sunset')
print(sunset.state)

# fetch a single item
item = openhab.get_item('light_switch')

# turn a swith on
item.on()

# send a state update (this only update the state)
item.state = 'OFF'

# send a command
item.command('ON')

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

python-openhab-2.9.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

python_openhab-2.9-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file python-openhab-2.9.tar.gz.

File metadata

  • Download URL: python-openhab-2.9.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2rc1

File hashes

Hashes for python-openhab-2.9.tar.gz
Algorithm Hash digest
SHA256 879b3b47d35b2d348f05f889cf11d757dfbbadd6920a220734eecaceb5e9a5a5
MD5 86e0ac5d218047757a77079ddfd38926
BLAKE2b-256 2be6bff5ca8f67febc7a2a572b2f7cbaeb19cee95dcecb0235be40d56f6f7875

See more details on using hashes here.

File details

Details for the file python_openhab-2.9-py3-none-any.whl.

File metadata

  • Download URL: python_openhab-2.9-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2rc1

File hashes

Hashes for python_openhab-2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 30a23d29e39102bfe269d46da02d82499e9f7a3eb2d048039c26d7b69b1465ae
MD5 b0badaaba34667a4f73707d6ff47962b
BLAKE2b-256 76030157b39cd67b4fb5a03d86514af28bf98c00d8000f32376a72279dd2c5d3

See more details on using hashes here.

Supported by

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