From 1de68527e66f0e82c59a2271dfeddfee81329326 Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Wed, 21 Jul 2021 01:48:29 +0200 Subject: [PATCH] Retry erzeuge in case graph connection is gone. --- controlpi_plugins/graph.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/controlpi_plugins/graph.py b/controlpi_plugins/graph.py index b1970ac..99b8283 100644 --- a/controlpi_plugins/graph.py +++ b/controlpi_plugins/graph.py @@ -24,12 +24,16 @@ class Graph(BasePlugin): if ('target' in message and message['target'] == self.name and 'command' in message and message['command'] == 'sync'): comessage_guid = await self._call('erzeuge', ['comessage']) - await self._call('verknuepfe', [comessage_guid, - self._coroot_guid]) - await self._call('setze', [comessage_guid, 'comessage_json', - json.dumps(self._states)]) - await self._call('setze', [comessage_guid, 'comessage_ready', - True]) + if not comessage_guid: + await self._open_connection() + comessage_guid = await self._call('erzeuge', ['comessage']) + if comessage_guid: + await self._call('verknuepfe', [comessage_guid, + self._coroot_guid]) + await self._call('setze', [comessage_guid, 'comessage_json', + json.dumps(self._states)]) + await self._call('setze', [comessage_guid, 'comessage_ready', + True]) if 'state' in message: if message['sender'] in self.conf['states']: self._states[message['sender']] = message['state'] -- 2.34.1