Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -10,14 +10,16 @@ from homeassistant.helpers.entity import Entity
|
||||
|
||||
ATTRIBUTION = "Data provided by ripple.com"
|
||||
|
||||
DEFAULT_NAME = 'Ripple Balance'
|
||||
DEFAULT_NAME = "Ripple Balance"
|
||||
|
||||
SCAN_INTERVAL = timedelta(minutes=5)
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_ADDRESS): cv.string,
|
||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||
})
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
{
|
||||
vol.Required(CONF_ADDRESS): cv.string,
|
||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
@@ -36,7 +38,7 @@ class RippleSensor(Entity):
|
||||
self._name = name
|
||||
self.address = address
|
||||
self._state = None
|
||||
self._unit_of_measurement = 'XRP'
|
||||
self._unit_of_measurement = "XRP"
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@@ -56,13 +58,12 @@ class RippleSensor(Entity):
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the sensor."""
|
||||
return {
|
||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
||||
}
|
||||
return {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||
|
||||
def update(self):
|
||||
"""Get the latest state of the sensor."""
|
||||
from pyripple import get_balance
|
||||
|
||||
balance = get_balance(self.address)
|
||||
if balance is not None:
|
||||
self._state = balance
|
||||
Reference in new issue
Block a user