Skip to content

python library for accessing the openHAB REST API

License

Notifications You must be signed in to change notification settings

tu-dortmund/python-openhab

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 >= 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:https://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')

About

python library for accessing the openHAB REST API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%