Remove solaredge_local duplicate code (#25941)
* Removed duplicate code * Update sensor.py Splitted exceptions into two seperate ones * Update sensor.py * Update sensor.py * Update sensor.py Fixed linting errors * Update sensor.pypull/26383/head
parent
ad51615718
commit
105461edb5
|
@ -149,25 +149,19 @@ class SolarEdgeData:
|
|||
try:
|
||||
response = self.api.get_status()
|
||||
_LOGGER.debug("response from SolarEdge: %s", response)
|
||||
except (ConnectTimeout):
|
||||
_LOGGER.error("Connection timeout, skipping update")
|
||||
return
|
||||
except (HTTPError):
|
||||
_LOGGER.error("Could not retrieve data, skipping update")
|
||||
return
|
||||
|
||||
try:
|
||||
self.data["energyTotal"] = response.energy.total
|
||||
self.data["energyThisYear"] = response.energy.thisYear
|
||||
self.data["energyThisMonth"] = response.energy.thisMonth
|
||||
self.data["energyToday"] = response.energy.today
|
||||
self.data["currentPower"] = response.powerWatt
|
||||
|
||||
_LOGGER.debug("Updated SolarEdge overview data: %s", self.data)
|
||||
except AttributeError:
|
||||
_LOGGER.error("Missing details data in solaredge response")
|
||||
_LOGGER.debug("Response is: %s", response)
|
||||
return
|
||||
except (ConnectTimeout, HTTPError):
|
||||
_LOGGER.error("Could not retrieve data, skipping update")
|
||||
return
|
||||
|
||||
self.data["energyTotal"] = response.energy.total
|
||||
self.data["energyThisYear"] = response.energy.thisYear
|
||||
self.data["energyThisMonth"] = response.energy.thisMonth
|
||||
self.data["energyToday"] = response.energy.today
|
||||
self.data["currentPower"] = response.powerWatt
|
||||
_LOGGER.debug("Updated SolarEdge overview data: %s", self.data)
|
||||
_LOGGER.error("Missing details data in SolarEdge response")
|
||||
|
|
Loading…
Reference in New Issue