OpenHAB calling external scripts from openHAB

HABApp runs on python3 natively and can call functions from your script without any changes.
Or you can use the built in scheduler:

import HABApp

class MyRule(HABApp.Rule):

    def __init__(self):
        super().__init__()
        self.run_minutely(self.run_every_min)

    def run_every_min(self):
        self.execute_subprocess(self.proc_finished, 'path_to_executable', 'arg1', capture_output=True)
        
    def proc_finished(self, info: HABApp.rule.FinishedProcessInfo):
        print(info.returncode)
        print(info.stdout)

1 Like