mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Adjust type hints in alpha-vantage sensor entity (#76988)
This commit is contained in:
parent
7a45739104
commit
009a573324
@ -128,7 +128,7 @@ class AlphaVantageSensor(SensorEntity):
|
|||||||
self._attr_native_unit_of_measurement = symbol.get(CONF_CURRENCY, self._symbol)
|
self._attr_native_unit_of_measurement = symbol.get(CONF_CURRENCY, self._symbol)
|
||||||
self._attr_icon = ICONS.get(symbol.get(CONF_CURRENCY, "USD"))
|
self._attr_icon = ICONS.get(symbol.get(CONF_CURRENCY, "USD"))
|
||||||
|
|
||||||
def update(self):
|
def update(self) -> None:
|
||||||
"""Get the latest data and updates the states."""
|
"""Get the latest data and updates the states."""
|
||||||
_LOGGER.debug("Requesting new data for symbol %s", self._symbol)
|
_LOGGER.debug("Requesting new data for symbol %s", self._symbol)
|
||||||
all_values, _ = self._timeseries.get_intraday(self._symbol)
|
all_values, _ = self._timeseries.get_intraday(self._symbol)
|
||||||
@ -144,7 +144,7 @@ class AlphaVantageSensor(SensorEntity):
|
|||||||
ATTR_LOW: values["3. low"],
|
ATTR_LOW: values["3. low"],
|
||||||
}
|
}
|
||||||
if isinstance(values, dict)
|
if isinstance(values, dict)
|
||||||
else None
|
else {}
|
||||||
)
|
)
|
||||||
_LOGGER.debug("Received new values for symbol %s", self._symbol)
|
_LOGGER.debug("Received new values for symbol %s", self._symbol)
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ class AlphaVantageForeignExchange(SensorEntity):
|
|||||||
self._attr_icon = ICONS.get(self._from_currency, "USD")
|
self._attr_icon = ICONS.get(self._from_currency, "USD")
|
||||||
self._attr_native_unit_of_measurement = self._to_currency
|
self._attr_native_unit_of_measurement = self._to_currency
|
||||||
|
|
||||||
def update(self):
|
def update(self) -> None:
|
||||||
"""Get the latest data and updates the states."""
|
"""Get the latest data and updates the states."""
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Requesting new data for forex %s - %s",
|
"Requesting new data for forex %s - %s",
|
||||||
@ -187,7 +187,7 @@ class AlphaVantageForeignExchange(SensorEntity):
|
|||||||
CONF_TO: self._to_currency,
|
CONF_TO: self._to_currency,
|
||||||
}
|
}
|
||||||
if values is not None
|
if values is not None
|
||||||
else None
|
else {}
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user