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 2.7.x / 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

python_openhab-2.4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for python_openhab-2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 26cb20d57a92e939c3109cb6616315164c19201ce56e31fb34f198001a20962d
MD5 700fde61c6ee72717664a83826c5b833
BLAKE2b-256 d3e17bc4ab3294d37190094e86f4c5f7a494f918c13d55e818b6fefe18e407cc

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