python library for accessing the openHAB REST API
Project description
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
Release history Release notifications | RSS feed
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
File details
Details for the file python_openhab-2.5-py3-none-any.whl
.
File metadata
- Download URL: python_openhab-2.5-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f664d8160d0fa38cd3bf6698657f1321193ac6226ce1e3be44b0adfa053c0e8 |
|
MD5 | 2a1dbb554cf2425bdc62fbecf6b42b55 |
|
BLAKE2b-256 | cabbf51195fb37177a95ef0fe85edc4c8f068f73b3f67e4c1c01b53ee3fb7297 |