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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: python-openhab-2.11.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 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.0.tar.gz
Algorithm Hash digest
SHA256 75a2c39843d2ec356fc5c08e3ec7709002d1ac3a45615ad6a2fdab258b2cfa98
MD5 f2251e8e3e727e262b8dcf7c963dfd6c
BLAKE2b-256 820b672a16d1d558bbfccebdb3d07e637a5908d909ebe45d318a5e53fb1dbf88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_openhab-2.11.0-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22156760e4e8e7a62c05b41e2516c154c356c2820f631ad7a1fd89944f572c8d
MD5 06e51e4fdc6c077a2efe7b962e346dfc
BLAKE2b-256 e52fb687de95700f3d2b80c312f0b5c2f596d7549024dca6288164c36d687089

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