Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Commit

Permalink
v0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sdesalve committed Sep 17, 2021
1 parent f82bb3b commit 3402751
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/zcsazzurro/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"after_dependencies": ["rest"],
"codeowners": ["@sdesalve"],
"iot_class": "cloud_polling",
"version": "0.0.2"
"version": "0.0.4"
}
66 changes: 65 additions & 1 deletion custom_components/zcsazzurro/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,69 @@ 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": 0,
"energyCharging": 0,
"energyDischarging": 0,
"energyExporting": 0,
"energyImporting": 0,
"energyConsuming": 0,
"energyAutoconsuming": 0
},
"current": {
"energyGenerating": 0,
"powerGenerating": 0,
"batteryCycletime": 0,
"batterySoC": 0,
"powerCharging": 0,
"powerDischarging": 0,
"powerExporting": 0,
"powerImporting": 0,
"powerConsuming": 0,
"powerAutoconsuming": 0,
"energyCharging": 0,
"energyDischarging": 0,
"energyExporting": 0,
"energyImporting": 0,
"energyConsuming": 0,
"energyAutoconsuming": 0,
},
}
else:
return {
"lastUpdated": False,
"thing.find": False,
"total": {
"energyGenerating": 0,
"energyCharging": 0,
"energyDischarging": 0,
"energyExporting": 0,
"energyImporting": 0,
"energyConsuming": 0,
"energyAutoconsuming": 0
},
"current": {
"energyGenerating": 0,
"powerGenerating": 0,
"batteryCycletime": 0,
"batterySoC": 0,
"powerCharging": 0,
"powerDischarging": 0,
"powerExporting": 0,
"powerImporting": 0,
"powerConsuming": 0,
"powerAutoconsuming": 0,
"energyCharging": 0,
"energyDischarging": 0,
"energyExporting": 0,
"energyImporting": 0,
"energyConsuming": 0,
"energyAutoconsuming": 0,
},
}

async def async_update(self):
"""Get the latest data from the ZCSAzzurro API and updates the state."""
Expand All @@ -341,7 +404,8 @@ 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
Expand Down

0 comments on commit 3402751

Please sign in to comment.