def load_mgr_from_file(mgr: openzwavemqtt.OZWManager, file_path): with open(file_path, "rt") as fp: for line in fp: topic, payload = line.strip().split(",", 1) try: mgr.receive_message(topic, payload) except ValueError: raise ExitException( f"Unable to process message on topic {topic} as JSON: {payload}" )
def load_mgr_from_file(mgr: openzwavemqtt.OZWManager, file_path: str) -> None: """Load manager from file.""" with open(file_path, "rt", encoding="utf-8") as fp: for line in fp: topic, payload = line.strip().split(",", 1) try: mgr.receive_message(topic, payload) except ValueError as err: raise ExitException( f"Unable to process message on topic {topic} as JSON: {payload}" ) from err