Register Coinbase service in Device Registry and provide configuration URL (#58472)
This commit is contained in:
parent
3970a50553
commit
11d8bcf0e2
1 changed files with 15 additions and 0 deletions
|
@ -3,6 +3,7 @@ import logging
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION
|
from homeassistant.const import ATTR_ATTRIBUTION
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
API_ACCOUNT_AMOUNT,
|
API_ACCOUNT_AMOUNT,
|
||||||
|
@ -104,6 +105,13 @@ class AccountSensor(SensorEntity):
|
||||||
API_ACCOUNT_CURRENCY
|
API_ACCOUNT_CURRENCY
|
||||||
]
|
]
|
||||||
break
|
break
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
|
configuration_url="https://www.coinbase.com/settings/api",
|
||||||
|
entry_type="service",
|
||||||
|
identifiers={(DOMAIN, self._coinbase_data.user_id)},
|
||||||
|
manufacturer="Coinbase.com",
|
||||||
|
name=f"Coinbase {self._coinbase_data.user_id[-4:]}",
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -169,6 +177,13 @@ 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_device_info = DeviceInfo(
|
||||||
|
configuration_url="https://www.coinbase.com/settings/api",
|
||||||
|
entry_type="service",
|
||||||
|
identifiers={(DOMAIN, self._coinbase_data.user_id)},
|
||||||
|
manufacturer="Coinbase.com",
|
||||||
|
name=f"Coinbase {self._coinbase_data.user_id[-4:]}",
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue