openhabian 3.2.0 - Release Build
I do use homekit_python (GitHub - jlusiardi/homekit_python: A python implementation to work as both HomeKit controller and accessory.) to control some homekit devices within openHAB. Commands are sent by executeCommandLine(). Here an example:
executeCommandLine(Duration.ofSeconds(10), "python3", "-m", "homekit.put_characteristic", "-f", "/home/openhabian/velux", "-a", "velux", "-c", ident, targetPosition)
This all works perfectly fine. However, instead of polling for changes I would like to get notified of any changes by an event. homekit_python does provide an option to register for events but I have no clue how to get these events into openHAB to be able to trigger rules.
Out of homekit_python documentation (GitHub - jlusiardi/homekit_python: A python implementation to work as both HomeKit controller and accessory.):
get_events
This tool will register with an accessory and listen to the events send back from it.
Usage
python3 -m homekit.get_events -f ${PAIRINGDATAFILE} -a ${ALIAS} -c ${Characteristics} \ [--adapter ${ADAPTER}] [--log ${LOGLEVEL}]
The option
-f
specifies the file that contains the pairing data.The option
-a
specifies the alias for the device.The option
-c
specifies the characteristics to change. The format is<aid>.<cid>
. This option can be repeated to listen to multiple characteristics with one call.…
For example, you can listen to characteristics 1.8 (on characteristic), 1.22 (1 REALTIME_ENERGY) and 1.23 (2 CURRENT_HOUR_DATA) of the Koogeek P1EU Plug with:
python3 -m homekit.get_events -f koogeek.json -a koogeek -c 1.8 -c 1.22 -c 1.23
This results in
event for 1.8: True event for 1.22: 6.0 event for 1.23: 0.01666 event for 1.22: 17.0 event for 1.23: 0.06388 event for 1.23: 0.11111 event for 1.22: 18.0 event for 1.23: 0.16111 event for 1.8: False
Executing this command in a terminal does show the events properly.
Is there an option to listen on these events and trigger any actions within openHAB?
Any help is highly appreciated.