firstof9 / ha-gasbuddy

Component to integrate with GasBuddy fuel price tracker.
MIT License
20 stars 2 forks source link

[Feature Request]: Add a second last_updated #80

Open ldupont226 opened 1 week ago

ldupont226 commented 1 week ago

The feature

1 131 / 5 000 I will start by explaining my problem, to display the results of GasBoddy data I use custom:flex-table-card and that gives a good result. In this card we define the entities to search and then we specify the attributes for the columns. When we specify last_updated, it uses,by itself, the last_date (HA) of the entity and not the last_updated of the attribute. To get around the problem I rename the last_updated of your integration (sensor.py) by another name (ex: last_updated_gb) and it is well recognized. You could tell me to talk about my problem with the flex-table-card developers, it's true. But from another point of view, when using this card in other consistency it is practical to have the last_updated when there is no this attribute. Would it be to add another attribute with a different name than last_updated with the value of last_updated , I believe that the current last_updated must remain to be backwards compatible. If this is not possible I will continue to make the correction in sensor.py or if someone who uses flex-table-card has another solution. Thanks

Here is an example of the result

image

Additional information

No response

firstof9 commented 3 days ago

"Last updated" is update per the timestamp provided by GasBuddy, I feel this is a proper use of the attribute as it shows when the last time someone submitted price data to GasBuddy.

ldupont226 commented 2 days ago

As described in the previous message, there is no problem with your integration it works very well. But I use a popular card named flex-table-card which gives a very good result in Home Assistant. In this card we only name the attributes to see in column, but the NAME of your last_updated attribute is the same as Home Assistant and in this card (flex-table-card) it automatically takes the one of Home Assistant, But by using a card like Entities of Home assistant your Attribute works very well. To work around the problem I rename your Last_updated under another name in the sensor.py . When writing this request I suspected that it will probably be refused but if you or someone else uses flex-table-card with your integration have found a way to work around the problem. But if there was a second attribute under another name with the same information (last_updates) it would solve the problem. Yes indeed you can tell me that the problem is with flex-table-card ;-), I can also continue to rename line 113 of sensor.py.

Thanks for your time

If you are interested you can try this card it gives a very nice look to your integration. If you try it pay attention to the Last_updated date

flex-table-card Sample.txt

Dare2Code commented 4 minutes ago

Instead of calling it a 'second last_updated' I believes its best to just say 'Date Prices posted by Gasbuddy' aka 'Date Posted'. Just saying.