File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed
custom_components/cryptoinfo Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -26,3 +26,4 @@ Version: 1.0.6 20241222 - Added 14 day change and 1 year change
2626Version: 1.0.7 20241227 - Added ath_price, ath_date and ath_change
2727Version: 1.0.8 20260317 - Updated code to support future Home Assistant versions
2828Version: 1.0.9 20260322 - Optional CoinGecko API price precision (config + /coins/markets)
29+ Version: 1.0.10 20260323 - Fix default and 0 precision values
Original file line number Diff line number Diff line change 11{
22 "domain" : " cryptoinfo" ,
33 "name" : " Cryptoinfo" ,
4- "version" : " 1.0.9 " ,
4+ "version" : " 1.0.10 " ,
55 "config_flow" : true ,
66 "iot_class" : " cloud_polling" ,
77 "documentation" : " https://github.com/heyajohnny/cryptoinfo" ,
Original file line number Diff line number Diff line change @@ -306,9 +306,15 @@ def __init__(
306306 def native_value (self ):
307307 """Return the native value of the sensor."""
308308 if self .coordinator .data and self .cryptocurrency_id in self .coordinator .data :
309- return float (
309+ value = float (
310310 self .coordinator .data [self .cryptocurrency_id ]["current_price" ]
311311 ) * float (self .multiplier )
312+ # Keep integer display when there are no decimals (or precision=0).
313+ if self ._api_precision == "0" :
314+ return int (round (value ))
315+ if self ._api_precision == "" and value .is_integer ():
316+ return int (value )
317+ return value
312318 return None
313319
314320 @property
You can’t perform that action at this time.
0 commit comments