Closed FWeinb closed 7 months ago
Hi, Can you desribe in more detail how you see this issue? The App officially only supports € and $, not a currency code. Its simply a char that must be sent. I tried also with other single currency chars as supported by the integration and did not see an issue with it. Even the App displayed them (like £,¥), but of course a change in the App only allows $ or € And I never saw an error in the frontend/browser for the currency unit selection or change, because it is simply a character, But maybe newer HA core changed something that broke it?
When I view the cost savings entity on the a dashboard (example was the Power Site Type 2 device page) this error is thrown:
This happens because the "€" symbol inside the currency
property for the Intl.NumberFormat
is used. I think to communicate the unit towards HA this component needs to translate "€" into "EUR" and vice-versa towards the Anker API.
Hm, sounds weird, because the number and the unit are completely different things in HA. However, the entity is classified as currency as I remember, and maybe therefore HA expect this to be iso format currency unit. If that is the case, I'm going to change the classification of the entity to accept any chars as unit.
Thanks for all you work on this component! Glad you could identify a solution to this.
I cannot recreate this issue with Firefox, so it seems to be browser related on how monetary values are managed. For compatability, I'm going to remove the SensorDeviceClass.MONETARY declaration from this sensor so that it does not have a device class. That should allow any char as unit to be handled correctly.
System Health details
System Information
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1401 Downloaded Repositories | 18Home Assistant Cloud
logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | okDashboards
dashboards | 9 -- | -- resources | 12 views | 23 mode | storageRecorder
oldest_recorder_run | April 3, 2024 at 20:08 -- | -- current_recorder_run | April 5, 2024 at 22:26 estimated_db_size | 129.24 MiB database_engine | sqlite database_version | 3.44.2Checklist
Describe the issue
When configuring the price currency this component offers €,$,£,¥,₹,원 and will configure the entity to use that unit. That unit will be used as-is in the
Intl.NumberFormat
as the currency code causing the following issue:This API is expecting a well-formed 3-letter ISO 4217 currency codes I would expect this component to convert between these symbols and the ISO 4217 currency code.
Reproduction steps
Debug logs
Diagnostics dump
No response