Skip to main content

python library for accessing the openHAB REST API

Project description

Code Health Documentation Code issues

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

Note on openHAB1:

Make sure to use the 1.x branch for openHAB1.x!

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.2.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

python_openhab-2.2-py2.py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 2 Python 3

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