Skip to main content

PJHomematic

PJHomematic is an abstarction of the Homematic JSON-API.

The package interfaces on different depths to the homematic API

  • High level API
    • Homematic - The API classes and methods are created dynamically to be called directly
  • Low level API
    • hmrpc - An interface to the Homematic JSON-API with session handling
    • jsonrpc - An implementation of the JSON-RPC protocol

The package is tested against the recent RaspberryMatic version only (currently 3.71). If you find out it is working great with some other platforms please drop me a message or create an issue if you experience problems.

Installation

The installation requires a python installation (>= 3.9).

# python3 -m pip install PJHomematic

If you want to be able to export the device list as Excel file via homematic.list_devices (see below) install the extra dependencies (openpyxl)

# python3 -m pip install PJHomematic[extra]

Usage

To retreive a list of all devices (columns: Name, Type, Address, Subsection, Room, Level) you should run

# python3 -m homematic.list_devices IP-ADDRESS USERNAME PASSWORD

If openpyxl is available the list is written to an excel file. Otherwise it is printed tab separated to the console.

API usage

The following chapters describing the usage of the different API level for the same job.

The JSON-API documentation can be retrieved via

from pprint import pp
from homematic import Homematic

hm = Homematic('http://10.1.1.1', username='user', password='pwd')
pp(hm.api_doc)
hm.logout()

High level API - Homematic class

Example of access via the high level API

from homematic import Homematic

hm = Homematic('http://10.1.1.1', username='user', password='pwd')
print(hm.system.listMethods())
hm.logout()

Low level API - hmrpc module

Example of access via the low level API

from homematic import hmrpc

hmrc = hmrpc.HMRPCClient('http://10.1.1.1', username='user', password='pwd')
print(hmrc.call('system.listMethods'))
hmrc.logout()

Low level API - jsonrpc module

Example of access via the low level API with manual session management

from homematic import jsonrpc

jrc = jsonrpc.JSONRPCClient('http://10.1.1.1/api/homematic.cgi')
session = jrc.call('Session.login', username='user', password='pwd')
print(jrc.call('system.listMethods'))
jrc.call('Session.logout', _session_id_=session)

Problems with https

If you expierence problems with https consider to use a proper CA signed certifcate instead of the default selfsigned cert.

If you are using windows you probably have to install python-certifi-win32 to use your local certificate store

If you need support do not hesitate to ask.

Source Code

The source code is available at GitHub

Copyright

PJHomematic © 2023 by Andreas Schawo is licensed under CC BY-SA 4.0

Homematic and Homematic IP are trademarks of eQ-3 AG

Release files for PJHomematic 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PJHomematic 0.1
File Size Uploaded
PJHomematic-0.1.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PJHomematic 0.1
File Interpreter ABI Platform
PJHomematic-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / PJHomematic-0.1.tar.gz

Download URL PJHomematic-0.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d6cf21b775d5957dc5f37c57a4c4b7c14ec40c3e714339639f02744e5b38de52
BLAKE2b-256 checksum
How to use checksums
2420128d0320e1a79a49fac5765ff44d1f733521208291a59fc4243aa306df17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.2

Release files / PJHomematic-0.1-py3-none-any.whl

Download URL PJHomematic-0.1-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53fc709a05f99b9ab922b4f4cf1542546ffa96baf251da5de7edb46ab5b63b40
BLAKE2b-256 checksum
How to use checksums
15355fe6c85ffa76d11015599af231b189603f3392d8e780fe9edff240303224
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page