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",
"name": "Fronius",
"documentation": "https://www.home-assistant.io/integrations/fronius",
"requirements": ["pyfronius==0.6.0"],
"requirements": ["pyfronius==0.7.0"],
"codeowners": ["@nielstron"],
"iot_class": "local_polling"
}

View file

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

View file

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