Add configurable decimal rounding of display value for CoinMarketCap sensor and upgrade to 5.0.3 (#14437) (#14604)
This commit is contained in:
1 parent
143be49c66
commit
b4f8d52fb1
5 files changed
+93
-53
No files matched your search
@@ -11,8 +11,9 @@ from tests.common import (
|
||||
|
||||
VALID_CONFIG = {
|
||||
'platform': 'coinmarketcap',
|
||||
'currency': 'ethereum',
|
||||
'currency_id': 1027,
|
||||
'display_currency': 'EUR',
|
||||
'display_currency_decimals': 3
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +40,6 @@ class TestCoinMarketCapSensor(unittest.TestCase):
|
||||
state = self.hass.states.get('sensor.ethereum')
|
||||
assert state is not None
|
||||
|
||||
assert state.state == '240.47'
|
||||
assert state.state == '493.455'
|
||||
assert state.attributes.get('symbol') == 'ETH'
|
||||
assert state.attributes.get('unit_of_measurement') == 'EUR'
|
||||
Vendored
+35
-20
@@ -1,21 +1,36 @@
|
||||
[
|
||||
{
|
||||
"id": "ethereum",
|
||||
"name": "Ethereum",
|
||||
"symbol": "ETH",
|
||||
"rank": "2",
|
||||
"price_usd": "282.423",
|
||||
"price_btc": "0.048844",
|
||||
"24h_volume_usd": "407024000.0",
|
||||
"market_cap_usd": "26908205315.0",
|
||||
"available_supply": "95276253.0",
|
||||
"total_supply": "95276253.0",
|
||||
"percent_change_1h": "0.06",
|
||||
"percent_change_24h": "-4.57",
|
||||
"percent_change_7d": "-16.39",
|
||||
"last_updated": "1508776751",
|
||||
"price_eur": "240.473299695",
|
||||
"24h_volume_eur": "346566690.16",
|
||||
"market_cap_eur": "22911395039.0"
|
||||
{
|
||||
"cached": false,
|
||||
"data": {
|
||||
"id": 1027,
|
||||
"name": "Ethereum",
|
||||
"symbol": "ETH",
|
||||
"website_slug": "ethereum",
|
||||
"rank": 2,
|
||||
"circulating_supply": 99619842.0,
|
||||
"total_supply": 99619842.0,
|
||||
"max_supply": null,
|
||||
"quotes": {
|
||||
"USD": {
|
||||
"price": 577.019,
|
||||
"volume_24h": 2839960000.0,
|
||||
"market_cap": 57482541899.0,
|
||||
"percent_change_1h": -2.28,
|
||||
"percent_change_24h": -14.88,
|
||||
"percent_change_7d": -17.51
|
||||
},
|
||||
"EUR": {
|
||||
"price": 493.454724572,
|
||||
"volume_24h": 2428699712.48,
|
||||
"market_cap": 49158380042.0,
|
||||
"percent_change_1h": -2.28,
|
||||
"percent_change_24h": -14.88,
|
||||
"percent_change_7d": -17.51
|
||||
}
|
||||
},
|
||||
"last_updated": 1527098658
|
||||
},
|
||||
"metadata": {
|
||||
"timestamp": 1527098716,
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user