Skip to content

Commit 4a5e303

Browse files
author
heyajohnny
committed
Version: 1.0.6 20241222 - Added 14 day change and 1 year change
1 parent a0a60e5 commit 4a5e303

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ The entities have some important attributes:
6565
- 1h_change This will return the 1 hour change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
6666
- 24h_change This will return the 24 hour change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
6767
- 7d_change This will return the 7 day change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
68+
- 14d_change This will return the 14 day change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
6869
- 30d_change This will return the 30 day change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
70+
- 1y_change This will return the 1 year change in percentage of the 'cryptocurrency_id'(default = "bitcoin")
6971
- market_cap This will return the total market cap of the 'cryptocurrency_id'(default = "bitcoin") displayed in 'currency_name'(default = "usd")
7072
- circulating_supply This will return the circulating supply of the 'cryptocurrency_id'(default = "bitcoin")
7173
- total_supply This will return the total supply of the 'cryptocurrency_id'(default = "bitcoin")

Version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ Version: 1.0.2 20241121 - Added cryptocurrency_id, cryptocurrency_name, cryptocu
2222
Version: 1.0.3 20241123 - Fix for empty id and unit_of_measurement
2323
Version: 1.0.4 20241208 - Adjusted some translations
2424
Version: 1.0.5 20241219 - Updated help text
25+
Version: 1.0.6 20241222 - Added 14 day change and 1 year change

custom_components/cryptoinfo/const/const.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
ATTR_1H_CHANGE = "1h_change"
2323
ATTR_24H_CHANGE = "24h_change"
2424
ATTR_7D_CHANGE = "7d_change"
25+
ATTR_14D_CHANGE = "14d_change"
2526
ATTR_30D_CHANGE = "30d_change"
27+
ATTR_1Y_CHANGE = "1y_change"
2628
ATTR_MARKET_CAP = "market_cap"
2729
ATTR_CIRCULATING_SUPPLY = "circulating_supply"
2830
ATTR_TOTAL_SUPPLY = "total_supply"

custom_components/cryptoinfo/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"domain": "cryptoinfo",
33
"name": "Cryptoinfo",
4-
"version": "1.0.5",
4+
"version": "1.0.6",
55
"config_flow": true,
66
"iot_class": "cloud_polling",
77
"documentation": "https://github.com/heyajohnny/cryptoinfo",

custom_components/cryptoinfo/sensor.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
API_ENDPOINT,
2323
ATTR_1H_CHANGE,
2424
ATTR_7D_CHANGE,
25+
ATTR_14D_CHANGE,
2526
ATTR_24H_CHANGE,
2627
ATTR_24H_VOLUME,
2728
ATTR_30D_CHANGE,
29+
ATTR_1Y_CHANGE,
2830
ATTR_BASE_PRICE,
2931
ATTR_CIRCULATING_SUPPLY,
3032
ATTR_LAST_UPDATE,
@@ -167,7 +169,7 @@ async def _async_update_data(self):
167169
f"{API_ENDPOINT}coins/markets"
168170
f"?ids={self.cryptocurrency_ids}"
169171
f"&vs_currency={self.currency_name}"
170-
f"&price_change_percentage=1h%2C24h%2C7d%2C30d"
172+
f"&price_change_percentage=1h%2C24h%2C7d%2C14d%2C30d%2C1y"
171173
)
172174

173175
try:
@@ -223,7 +225,7 @@ async def _async_update_data(self):
223225
f"{API_ENDPOINT}coins/markets"
224226
f"?ids={self.cryptocurrency_ids}"
225227
f"&vs_currency={self.currency_name}"
226-
f"&price_change_percentage=1h%2C24h%2C7d%2C30d"
228+
f"&price_change_percentage=1h%2C24h%2C7d%2C14d%2C30d%2C1y"
227229
)
228230

229231
try:
@@ -312,7 +314,9 @@ def extra_state_attributes(self):
312314
ATTR_1H_CHANGE: None,
313315
ATTR_24H_CHANGE: None,
314316
ATTR_7D_CHANGE: None,
317+
ATTR_14D_CHANGE: None,
315318
ATTR_30D_CHANGE: None,
319+
ATTR_1Y_CHANGE: None,
316320
ATTR_MARKET_CAP: None,
317321
ATTR_CIRCULATING_SUPPLY: None,
318322
ATTR_TOTAL_SUPPLY: None,
@@ -331,7 +335,9 @@ def extra_state_attributes(self):
331335
ATTR_1H_CHANGE: data["price_change_percentage_1h_in_currency"],
332336
ATTR_24H_CHANGE: data["price_change_percentage_24h_in_currency"],
333337
ATTR_7D_CHANGE: data["price_change_percentage_7d_in_currency"],
338+
ATTR_14D_CHANGE: data["price_change_percentage_14d_in_currency"],
334339
ATTR_30D_CHANGE: data["price_change_percentage_30d_in_currency"],
340+
ATTR_1Y_CHANGE: data["price_change_percentage_1y_in_currency"],
335341
ATTR_MARKET_CAP: data["market_cap"],
336342
ATTR_CIRCULATING_SUPPLY: data["circulating_supply"],
337343
ATTR_TOTAL_SUPPLY: data["total_supply"],

0 commit comments

Comments
 (0)