From 32dd7e88fb686caa4c687c8c2a71e54f48cdc769 Mon Sep 17 00:00:00 2001 From: sdesalve Date: Wed, 29 Sep 2021 20:07:04 +0200 Subject: [PATCH] 0.0.7 --- custom_components/zcsazzurro/sensor.py | 69 +------------------------- 1 file changed, 1 insertion(+), 68 deletions(-) diff --git a/custom_components/zcsazzurro/sensor.py b/custom_components/zcsazzurro/sensor.py index 45c9303..9628237 100644 --- a/custom_components/zcsazzurro/sensor.py +++ b/custom_components/zcsazzurro/sensor.py @@ -34,7 +34,7 @@ DEFAULT_NAME = "ZCSAzzurro" DEFAULT_VERIFY_SSL = False -SCAN_INTERVAL = timedelta(minutes=1) +SCAN_INTERVAL = timedelta(minutes=2) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( { @@ -315,69 +315,6 @@ def extra_state_attributes(self): } except TypeError: _LOGGER.error("Error cannot find all required keys: %s", self.dssoutput) - return { - "lastUpdated": False, - "thing.find": False, - "total": { - "energyGenerating": -1, - "energyCharging": -1, - "energyDischarging": -1, - "energyExporting": -1, - "energyImporting": -1, - "energyConsuming": -1, - "energyAutoconsuming": -1 - }, - "current": { - "energyGenerating": -1, - "powerGenerating": -1, - "batteryCycletime": -1, - "batterySoC": -1, - "powerCharging": -1, - "powerDischarging": -1, - "powerExporting": -1, - "powerImporting": -1, - "powerConsuming": -1, - "powerAutoconsuming": -1, - "energyCharging": -1, - "energyDischarging": -1, - "energyExporting": -1, - "energyImporting": -1, - "energyConsuming": -1, - "energyAutoconsuming": -1, - }, - } - else: - return { - "lastUpdated": False, - "thing.find": False, - "total": { - "energyGenerating": -1, - "energyCharging": -1, - "energyDischarging": -1, - "energyExporting": -1, - "energyImporting": -1, - "energyConsuming": -1, - "energyAutoconsuming": -1 - }, - "current": { - "energyGenerating": -1, - "powerGenerating": -1, - "batteryCycletime": -1, - "batterySoC": -1, - "powerCharging": -1, - "powerDischarging": -1, - "powerExporting": -1, - "powerImporting": -1, - "powerConsuming": -1, - "powerAutoconsuming": -1, - "energyCharging": -1, - "energyDischarging": -1, - "energyExporting": -1, - "energyImporting": -1, - "energyConsuming": -1, - "energyAutoconsuming": -1, - }, - } async def async_update(self): """Get the latest data from the ZCSAzzurro API and updates the state.""" @@ -404,10 +341,6 @@ def _async_update_from_rest_data(self): _LOGGER.debug("Erroneous JSON: %s", json_dict) else: _LOGGER.warning("Empty reply found when expecting JSON data") - self.dssoutput = None - self._state = False except TypeError: - self.dssoutput = None - self._state = False _LOGGER.error("Unable to fetch data from ZCSAzzurro. Response: %s", self.rest.data)