diff --git a/hbd/server/hbdclass.py b/hbd/server/hbdclass.py index 7f7ea53..b5e190b 100644 --- a/hbd/server/hbdclass.py +++ b/hbd/server/hbdclass.py @@ -304,6 +304,14 @@ class Host: self.managers: list = [] # usernames with manager role self.monitors: list = [] # usernames with monitor role + def __getstate__(self): + """Prepare Host for pickling by excluding non-serializable timer objects.""" + state = self.__dict__.copy() + # asyncio TimerHandles (and their lambda callbacks) can't be pickled. + # They're recreated when the next PLG arrives after unpickling. + state['plugin_timers'] = {} + return state + def statedict(self): d = {} d["raw_name"] = self.name