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 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
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 Distribution
python-openhab-2.2.tar.gz
(6.0 kB
view details)
Built Distribution
File details
Details for the file python-openhab-2.2.tar.gz
.
File metadata
- Download URL: python-openhab-2.2.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cc456b91a58cce5e65275aa474c3942e5c67ecf4f2aee587d48c54193e14196 |
|
MD5 | 34d7718e61ec3eedcb5355ddf0139d6a |
|
BLAKE2b-256 | 64c2cca2fd36e6a5773b27130ca408527ce35eea85a84e8883ecaadce759b71b |
File details
Details for the file python_openhab-2.2-py2.py3-none-any.whl
.
File metadata
- Download URL: python_openhab-2.2-py2.py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9241fa57b45612fd02d17bc26fe7b9c579913f1433784a02e3833893ff8a9fbc |
|
MD5 | 44f43fbf29a884d34a86d107b348248d |
|
BLAKE2b-256 | 05556e6d321c1513d48fb6baf8da65c610c939bf83635355884afc5fd1f9992c |