Closed Extrapilot1 closed 1 year ago
Hey there @martinhjelmare, mind taking a look at this issue as it has been labeled with an integration (openexchangerates
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
openexchangerates documentation openexchangerates source (message by IssueLinks)
I suggest we simply remove the rounding.
If that works, great. I didnt know if there was reason for rounding to begin with (i.e. limit string length). Thanks so much for having a look at it.
Best I can tell, the problem persists. Im seeing in the log a value for gold as the entry: 'XAU': 0.00050298 In HA. even with the decimal precision set at 0.0000500 display Im seeing 0.00005. I dont know if display rounding limits other parsing/recording, but a template sensor that just does: value_template: "{{ 1.0|float / (states('sensor.open_exchange_rates_usd_xau')|float}}"
returns the equivalent of 0.0005 also (1/.0005), or 2000.
I restarted the integration, and then restarted Home Assistant- in the hope this was an initial update parse thing (lag), but seems a new read was logged, and yet the raw sensor and the template seem to be unaffected.
The change will be released in the December release as it's technically a breaking change.
Sorry- my mistake. I saw reference to open exchange rate in the release notes on today's update and assumed this was the change. I hope you are well- enjoy the week/end- Rob
The problem
In the Open Exchange Rate integration, the API returns textual values for currencies and metals. The Integration converts those to entities. Problem is, it is clipping the returned data to 4 decimal places. For certain entities, this is a problem. Example, Gold (XAU) is returned as Ounces/USD, so the value will be something like 0.0005143. 1/x gets you the dollar cost of an ounce of gold, but the integration only returns 0.0005. Same problem for various currencies. The Vietnamese currency currently trades at 0.000041/USD for example.
It would be better if the integration had a config option that permitted selection of decimal points, but it would be fine to return 8 points, where I dont believe there is need for precision beyond that for any supported currencies or metals.
What version of Home Assistant Core has the issue?
2023.11.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Open Exchange Rate
Link to integration documentation on our website
https://www.home-assistant.io/integrations/openexchangerates/
Diagnostics information
Code is operating as designed- problem is simply the truncation at 4 decimals where more resolution is required for some currencies and metals.
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response