Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long decimal values showing for some entities #29

Closed
4 tasks done
snigehere opened this issue Nov 25, 2024 · 4 comments
Closed
4 tasks done

Long decimal values showing for some entities #29

snigehere opened this issue Nov 25, 2024 · 4 comments

Comments

@snigehere
Copy link

snigehere commented Nov 25, 2024

System Health details

System Information

version core-2024.11.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.54-haos
arch x86_64
timezone Europe/London
config_dir /config

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of any previous issues..

Describe the issue

I am seeing long decimal values with the new release (2024.11.3) which I have not noticed with the prior release

This shows up for a mix of brands and not all of the stations with the same brand have the issue. I see this for both B7 and E10 .. more B7 than E10

I am guessing this may be a data source issue but wanted to raise it in case some rounding could be added to the integration.

Although this picture only shows B7 with the issue there are some E10 stations further down the list
image

Example extracts from developer tools
sensor.asda_xxxxx
Asda xxxxx

Attributes:
id: asda_gcp32gjrtws3
name: Asda xxxx
address: xxxxxxx
postal_code: xxxxx
latitude: xxxxx
longitude: xxxxx
brand: Asda
available_fuels:
E10: 1.357
B7: 1.3969999999999998

fuel_details:
E10: {}
B7: {}

currency: GBP
last_updated: 2024-11-24T23:14:11.488777
next_update: 2024-11-25T23:14:11.660578
props:
source: asda
source_id: gcp32gjrtws3
prevent_cache_cleanup: true

E10: 1.357
B7: 1.3969999999999998
area: xxx
icon: mdi:gas-station
friendly_name: Asda xxxxx

Configuration info
image

Reproduction steps

  1. view data received by the integration

...

Debug logs

n/a - data rather than code failure

Diagnostics dump

n/a - data rather than code failure

@pantherale0
Copy link
Owner

Hi,

This is down to the data source itself (and for the UK this is direct from the owner of the fuel station)

I'm not sure how best to approach this, or even if this is something done deliberately by the suppliers.

I don't want to add in functionality to round up as I want to leave the data intact. At the same time, like you, I do find it frustrating that when shown on tables it's far too long.

@stevephi59
Copy link

stevephi59 commented Nov 25, 2024

In the card you can set the display to a fixed number decimal point numbers. I'd imagine you'd want 3. This way the original figure from the supplier is not altered but your display is neater. I had the problem with distance but it'll work on any numeric display field - Mine for E10. Change the 3 in toFixed(3) to how many places you want shown

  • data: state
    name: Price/l
    prefix: £
    modify: parseFloat(x).toFixed(3)

fuel_prices

@snigehere
Copy link
Author

Thanks Both
@pantherale0 Many thanks for your fast response - I do agree with what you say
@stevephi59 Many thanks for your help with this and providing the code I needed to use - very helpful

@pantherale0
Copy link
Owner

Thanks both, I'm going to close this issue for now, but pin for future reference. Really need to wait to see what the CMA comes up with for consumer access to this data because the data sources might change entirely in the future.

@pantherale0 pantherale0 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2024
@pantherale0 pantherale0 pinned this issue Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants