Update wolf_smartset to 0.1.6 (#40668)

* Bump wolf_smartset version. Support not fully fetched data

* Fix black and pylint errors

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

* Remove dot from exception message.

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
Adam Król 2020-09-27 21:02:29 +02:00 committed by GitHub
parent 52b745b8a9
commit ef751c0961
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 16 deletions

View File

@ -2,7 +2,7 @@
from datetime import timedelta
import logging
from httpcore import ConnectError
from httpcore import ConnectError, ConnectTimeout
from wolf_smartset.token_auth import InvalidAuth
from wolf_smartset.wolf_client import WolfClient
@ -99,7 +99,7 @@ async def fetch_parameters(client: WolfClient, gateway_id: int, device_id: int):
try:
fetched_parameters = await client.fetch_parameters(gateway_id, device_id)
return [param for param in fetched_parameters if param.name != "Reglertyp"]
except ConnectError as exception:
except (ConnectError, ConnectTimeout) as exception:
raise UpdateFailed(f"Error communicating with API: {exception}") from exception
except InvalidAuth as exception:
raise UpdateFailed("Invalid authentication during update.") from exception
raise UpdateFailed("Invalid authentication during update") from exception

View File

@ -3,6 +3,6 @@
"name": "Wolf SmartSet Service",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/wolflink",
"requirements": ["wolf_smartset==0.1.4"],
"requirements": ["wolf_smartset==0.1.6"],
"codeowners": ["@adamkrol93"]
}

View File

@ -11,13 +11,6 @@ from wolf_smartset.models import (
Temperature,
)
from homeassistant.components.wolflink.const import (
COORDINATOR,
DEVICE_ID,
DOMAIN,
PARAMETERS,
STATES,
)
from homeassistant.const import (
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE,
@ -27,6 +20,8 @@ from homeassistant.const import (
)
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import COORDINATOR, DEVICE_ID, DOMAIN, PARAMETERS, STATES
_LOGGER = logging.getLogger(__name__)
@ -63,6 +58,7 @@ class WolfLinkSensor(CoordinatorEntity):
super().__init__(coordinator)
self.wolf_object = wolf_object
self.device_id = device_id
self._state = None
@property
def name(self):
@ -71,8 +67,10 @@ class WolfLinkSensor(CoordinatorEntity):
@property
def state(self):
"""Return the state."""
return self.coordinator.data[self.wolf_object.value_id]
"""Return the state. Wolf Client is returning only changed values so we need to store old value here."""
if self.wolf_object.value_id in self.coordinator.data:
self._state = self.coordinator.data[self.wolf_object.value_id]
return self._state
@property
def device_state_attributes(self):
@ -151,7 +149,7 @@ class WolfLinkState(WolfLinkSensor):
@property
def state(self):
"""Return the state converting with supported values."""
state = self.coordinator.data[self.wolf_object.value_id]
state = super().state
resolved_state = [
item for item in self.wolf_object.items if item.value == int(state)
]

View File

@ -2262,7 +2262,7 @@ withings-api==2.1.6
wled==0.4.4
# homeassistant.components.wolflink
wolf_smartset==0.1.4
wolf_smartset==0.1.6
# homeassistant.components.xbee
xbee-helper==0.0.7

View File

@ -1055,7 +1055,7 @@ withings-api==2.1.6
wled==0.4.4
# homeassistant.components.wolflink
wolf_smartset==0.1.4
wolf_smartset==0.1.6
# homeassistant.components.bluesound
# homeassistant.components.rest