From f6447e0e8824dc34f1e0acf3edde8c7b301d71b1 Mon Sep 17 00:00:00 2001 From: DaveL17 Date: Wed, 4 Oct 2023 09:31:52 -0500 Subject: [PATCH] Fixes a bug where devices displaying an `IOError` state incorrectly report as being online. Updates wiki regarding IOErrors. --- GhostXML.indigoPlugin/Contents/Info.plist | 2 +- .../Contents/Server Plugin/plugin.py | 12 +++++++++++- _changelog.md | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/GhostXML.indigoPlugin/Contents/Info.plist b/GhostXML.indigoPlugin/Contents/Info.plist index 020b76f..641955a 100755 --- a/GhostXML.indigoPlugin/Contents/Info.plist +++ b/GhostXML.indigoPlugin/Contents/Info.plist @@ -3,7 +3,7 @@ PluginVersion - 2022.3.2 + 2022.3.3 ServerApiVersion 3.2 IwsApiVersion diff --git a/GhostXML.indigoPlugin/Contents/Server Plugin/plugin.py b/GhostXML.indigoPlugin/Contents/Server Plugin/plugin.py index 00c6b8b..5294e20 100644 --- a/GhostXML.indigoPlugin/Contents/Server Plugin/plugin.py +++ b/GhostXML.indigoPlugin/Contents/Server Plugin/plugin.py @@ -1294,10 +1294,20 @@ def refresh_data_for_dev(self, dev=None): dev.updateStateOnServer('deviceIsOnline', value=False, uiValue='Error') dev.updateStateImageOnServer(indigo.kStateImageSel.SensorTripped) self.bad_calls += 1 - elif dev.states.get("Response", "") == "No data to return.": + # 2023-10-04 DaveL17 - update to include XML parse error. + elif dev.states.get("Response", "") in ["No data to return.", "Parse error. Check XML source."]: dev.updateStateOnServer('deviceIsOnline', value=False, uiValue='Error') dev.updateStateImageOnServer(indigo.kStateImageSel.SensorTripped) self.bad_calls += 1 + # TODO: the following block can be deleted if the above block continues to run without errors. + # elif dev.states.get("Response", "") == "No data to return.": + # dev.updateStateOnServer('deviceIsOnline', value=False, uiValue='Error') + # dev.updateStateImageOnServer(indigo.kStateImageSel.SensorTripped) + # self.bad_calls += 1 + # elif dev.states.get("Response", "") == "Parse error. Check XML source.": + # dev.updateStateOnServer('deviceIsOnline', value=False, uiValue='Error') + # dev.updateStateImageOnServer(indigo.kStateImageSel.SensorTripped) + # self.bad_calls += 1 else: dev.updateStateOnServer('deviceIsOnline', value=True, uiValue="Updated") self.logger.info(f"{dev.name} updated.") diff --git a/_changelog.md b/_changelog.md index ae7e9a6..17cd799 100644 --- a/_changelog.md +++ b/_changelog.md @@ -1,3 +1,6 @@ +### v2022.3.3 +- Fixes a bug where devices displaying an `IOError` state incorrectly report as being online. + ### v2022.3.2 - Bumps version number.