Add state class to Coinbase sensors (#59109)
This commit is contained in:
parent
121a0915bc
commit
f46ba2b38b
1 changed files with 3 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
"""Support for Coinbase sensors."""
|
"""Support for Coinbase sensors."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, SensorEntity
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION
|
from homeassistant.const import ATTR_ATTRIBUTION
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ class AccountSensor(SensorEntity):
|
||||||
API_ACCOUNT_CURRENCY
|
API_ACCOUNT_CURRENCY
|
||||||
]
|
]
|
||||||
break
|
break
|
||||||
|
self._attr_state_class = STATE_CLASS_MEASUREMENT
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
configuration_url="https://www.coinbase.com/settings/api",
|
configuration_url="https://www.coinbase.com/settings/api",
|
||||||
entry_type="service",
|
entry_type="service",
|
||||||
|
@ -177,6 +178,7 @@ class ExchangeRateSensor(SensorEntity):
|
||||||
1 / float(self._coinbase_data.exchange_rates[API_RATES][self.currency]), 2
|
1 / float(self._coinbase_data.exchange_rates[API_RATES][self.currency]), 2
|
||||||
)
|
)
|
||||||
self._unit_of_measurement = exchange_base
|
self._unit_of_measurement = exchange_base
|
||||||
|
self._attr_state_class = STATE_CLASS_MEASUREMENT
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
configuration_url="https://www.coinbase.com/settings/api",
|
configuration_url="https://www.coinbase.com/settings/api",
|
||||||
entry_type="service",
|
entry_type="service",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue