Skip to main content

python library for accessing the openHAB REST API

Project description

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 switch 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.11.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

python_openhab-2.11.2-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python-openhab-2.11.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

File hashes

Hashes for python-openhab-2.11.2.tar.gz
Algorithm Hash digest
SHA256 85becc1b111d1a2a4edd70de50cab38318e70b72e6f8916c16a228631b821dc9
MD5 4706d57e0896a5078758ce77eea36b7d
BLAKE2b-256 db0af0b1d73d9006c1706230701724786a7aa0fb9e4b4695f944a046a37a6fde

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_openhab-2.11.2-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

File hashes

Hashes for python_openhab-2.11.2-py3-none-any.whl
Algorithm Hash digest
SHA256 894b3457937d24c093350f2026f43d9ee30b80940b97388d0899acdcbba6dab5
MD5 7d2f89bd1e9650d6309b5f79ebe3d7de
BLAKE2b-256 b860253603c9ea948cbf838e889fe9ba430014f6b4e65ad60df3792bc861b8c0

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