mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
added more debug logging for sensor.alpha_vantage (#12249)
* added more debug logging for sensor.alpha_vantage * fixed typo in log statement, more fine grained logging * Capitalized first character in log statement * replaced quotes as proposed by @OttoWinter
This commit is contained in:
parent
acb521330c
commit
b08294386b
@ -89,6 +89,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
dev = []
|
dev = []
|
||||||
for symbol in symbols:
|
for symbol in symbols:
|
||||||
try:
|
try:
|
||||||
|
_LOGGER.debug("Configuring timeseries for symbols: %s",
|
||||||
|
symbol[CONF_SYMBOL])
|
||||||
timeseries.get_intraday(symbol[CONF_SYMBOL])
|
timeseries.get_intraday(symbol[CONF_SYMBOL])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
@ -100,6 +102,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
from_cur = conversion.get(CONF_FROM)
|
from_cur = conversion.get(CONF_FROM)
|
||||||
to_cur = conversion.get(CONF_TO)
|
to_cur = conversion.get(CONF_TO)
|
||||||
try:
|
try:
|
||||||
|
_LOGGER.debug("Configuring forex %s - %s",
|
||||||
|
from_cur, to_cur)
|
||||||
forex.get_currency_exchange_rate(
|
forex.get_currency_exchange_rate(
|
||||||
from_currency=from_cur, to_currency=to_cur)
|
from_currency=from_cur, to_currency=to_cur)
|
||||||
except ValueError as error:
|
except ValueError as error:
|
||||||
@ -110,6 +114,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
dev.append(AlphaVantageForeignExchange(forex, conversion))
|
dev.append(AlphaVantageForeignExchange(forex, conversion))
|
||||||
|
|
||||||
add_devices(dev, True)
|
add_devices(dev, True)
|
||||||
|
_LOGGER.debug("Setup completed")
|
||||||
|
|
||||||
|
|
||||||
class AlphaVantageSensor(Entity):
|
class AlphaVantageSensor(Entity):
|
||||||
@ -158,8 +163,10 @@ class AlphaVantageSensor(Entity):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""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)
|
||||||
all_values, _ = self._timeseries.get_intraday(self._symbol)
|
all_values, _ = self._timeseries.get_intraday(self._symbol)
|
||||||
self.values = next(iter(all_values.values()))
|
self.values = next(iter(all_values.values()))
|
||||||
|
_LOGGER.debug("Received new values for symbol %s", self._symbol)
|
||||||
|
|
||||||
|
|
||||||
class AlphaVantageForeignExchange(Entity):
|
class AlphaVantageForeignExchange(Entity):
|
||||||
@ -210,5 +217,11 @@ class AlphaVantageForeignExchange(Entity):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data and updates the states."""
|
"""Get the latest data and updates the states."""
|
||||||
|
_LOGGER.debug("Requesting new data for forex %s - %s",
|
||||||
|
self._from_currency,
|
||||||
|
self._to_currency)
|
||||||
self.values, _ = self._foreign_exchange.get_currency_exchange_rate(
|
self.values, _ = self._foreign_exchange.get_currency_exchange_rate(
|
||||||
from_currency=self._from_currency, to_currency=self._to_currency)
|
from_currency=self._from_currency, to_currency=self._to_currency)
|
||||||
|
_LOGGER.debug("Received new data for forex %s - %s",
|
||||||
|
self._from_currency,
|
||||||
|
self._to_currency)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user