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 switch 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.11.1.tar.gz
(8.4 kB
view hashes)
Built Distribution
Close
Hashes for python_openhab-2.11.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0ed51e99837870894ea691cae9bb8e41bac3f53f84a72c8f89516d1dd7d12f6 |
|
MD5 | c77d0089ec5f0c6b7ef77e55c6919d64 |
|
BLAKE2b-256 | e44dd133761f29f558f85f185d624079b3fbbddcba06065e8793a0dbee141d1d |