Update pyfronius to 0.7.0 (#57279)

* update to pyfronius 0.7.0

* exception handling

* exception handling
This commit is contained in:
Matthias Alphart 2021-10-11 04:37:44 +02:00 committed by GitHub
parent e148939b78
commit c0a3c7a4b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 11 deletions

View file

@ -2,7 +2,7 @@
"domain": "fronius", "domain": "fronius",
"name": "Fronius", "name": "Fronius",
"documentation": "https://www.home-assistant.io/integrations/fronius", "documentation": "https://www.home-assistant.io/integrations/fronius",
"requirements": ["pyfronius==0.6.0"], "requirements": ["pyfronius==0.7.0"],
"codeowners": ["@nielstron"], "codeowners": ["@nielstron"],
"iot_class": "local_polling" "iot_class": "local_polling"
} }

View file

@ -6,7 +6,7 @@ from datetime import timedelta
import logging import logging
from typing import Any from typing import Any
from pyfronius import Fronius from pyfronius import Fronius, FroniusError
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
@ -205,19 +205,13 @@ class FroniusAdapter:
"""Retrieve and update latest state.""" """Retrieve and update latest state."""
try: try:
values = await self._update() values = await self._update()
except ConnectionError: except FroniusError as err:
# fronius devices are often powered by self-produced solar energy # fronius devices are often powered by self-produced solar energy
# and henced turned off at night. # and henced turned off at night.
# Therefore we will not print multiple errors when connection fails # Therefore we will not print multiple errors when connection fails
if self._available: if self._available:
self._available = False self._available = False
_LOGGER.error("Failed to update: connection error") _LOGGER.error("Failed to update: %s", err)
return
except ValueError:
_LOGGER.error(
"Failed to update: invalid response returned."
"Maybe the configured device is not supported"
)
return return
self._available = True # reset connection failure self._available = True # reset connection failure

View file

@ -1495,7 +1495,7 @@ pyfreedompro==1.1.0
pyfritzhome==0.6.2 pyfritzhome==0.6.2
# homeassistant.components.fronius # homeassistant.components.fronius
pyfronius==0.6.0 pyfronius==0.7.0
# homeassistant.components.ifttt # homeassistant.components.ifttt
pyfttt==0.3 pyfttt==0.3