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

Set a price as entity state #15

Closed
3 tasks done
Jab2870 opened this issue Apr 25, 2024 · 9 comments
Closed
3 tasks done

Set a price as entity state #15

Jab2870 opened this issue Apr 25, 2024 · 9 comments

Comments

@Jab2870
Copy link

Jab2870 commented Apr 25, 2024

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

The home assistant map card allows for map marker text to display an entities state rather than an entities name. Currently, a map simply shows an abbreviation of a fuel station's name, which is not hugely helpful:

image

It would be much more helpful do display a fuel price, as demo'd here: https://www.home-assistant.io/blog/2023/10/04/release-202310/#map-entity-marker-options

Describe the solution you'd like

I would like the ability to set an entity's state to be the fuel price.

Describe alternatives you've considered

Could probably do it with template sensors, although that would mean having 2 entities for each fuel station - something I'd prefer to avoid.

Additional context

I suspect this would take the form of a selection during setup whereby a user selects the sort of fuel they would like to display as the entity's state. E10 or B7 for instance

@Jab2870
Copy link
Author

Jab2870 commented Apr 25, 2024

an additional advantage here is that the state is stored in HA history so the price of fuel can be tracked over time

@pantherale0
Copy link
Owner

Will work on this for the next version, I agree, this would be much more helpful

@pantherale0
Copy link
Owner

Small preview of what is to come. Need to write up some docs though first.

Home Assistant will actually capture the states into the long term statistics table in the backend so I found out a little while ago.

image
image

@pantherale0
Copy link
Owner

fixed in 86e2282

@Jab2870
Copy link
Author

Jab2870 commented Jun 17, 2024

This looks great @pantherale0 . Thanks. have 2 queries:

  1. Is the data going to remain in attributes? I have a bunch of stuff that currently reads the data in attributes and I would have to re-write it if not. Not a huge deal, but would mean waiting to do the update until I have time to do them.
  2. What is shown if a particular station doesn't have the "chosen" fuel type. Lets say I pick E5 - which is normally called something like "Premium Unleaded" - would the state just be unavailable if a fuel station didn't sell premium unleaded?

@pantherale0
Copy link
Owner

Hi,

  1. The data in the attributes hasn't changed apart from the addition of the area that generated the entity (Include area as sensor attribute. #12)
  2. If the fuel station does not sell a specific fuel, the name of the fuel station will be used as the state instead (otherwise the attributes aren't available in HA as an entity always needs a valid state for those to show)

@Jab2870
Copy link
Author

Jab2870 commented Jun 17, 2024

So, downloaded the latest version and it's working great, thanks very much. 1 small thing is that the units are wrong. If you would prefer, I can open a new issue for it, but given it is a result of this I thought I'd ask here first.

image

This should be pence, not pounds.

@pantherale0
Copy link
Owner

Discussed here, it's not a simple swap to pence as this integration supports other countries / currencies where the format varies.

#13 (comment)

@Jab2870
Copy link
Author

Jab2870 commented Jun 17, 2024

Ok, no problem. thanks for the quick response

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

2 participants