External integration - "Fuel prices"

I just tried it but the widgets don’t work.


In the logs, nothing special, it seems to retrieve the stations and prices correctly

Did you set up the widgets correctly?
Can you share a screenshot of your configuration, please, while hiding any sensitive elements?
Are you on 2.0.5 for the integration?
Is Gladys on 5.1.1?
On my end, I don’t have any issues with the widgets

For the versions, yes, it’s good.
For the config capture, do you want the integration or the widget?

After that, there’s nothing special about the config, so I’d say yes, I’ve configured it properly.

All :slight_smile: So I can reproduce on my dev instance :wink:

Edit: If sensitive information, send in private

It works but it was necessary to uninstall and reinstall the integration.

I don’t have any issues on my end with the same configuration as you:

Have you tried recreating the widgets? Do any data show up if you display data without the widgets?

Ok, noted. I’ll submit it to Claude this afternoon to see if he finds a bug :wink:

Thanks

Yes, it’s good, it was necessary to uninstall and reinstall the complete integration.

However, regarding the rounding, I don’t know if it’s Gladys or the integration, but the prices should not be unrounded.
Example in the widget:

While the price outside the widget is

Thanks :slight_smile:
I will submit all this to Claude and I will get back to you this afternoon :slight_smile:


:sweat_smile:

I created three houses and found ‹ My house in Gladys ›, I should find the three of them…

Previewing nearby stations fails…

I deleted and recreated it given the version level…

@JPPUYB @Will_71

Here is Claude’s feedback:

  1. « Widget data is unavailable »

Cause (verified in Gladys’ code): the core waits for the widget.get ack in 15 s (WIDGET_GET_TIMEOUT_MS). Beyond that, the front end (ExternalWidgetBox.jsx):

clears the already displayed content,
displays "data unavailable" without details,
schedules no retry → the card remains dead until the dashboard is reloaded (hence the reinstallation).

On a cold container, we easily exceed 15 s: 2 cards pulling at the same time, the concentric circle search (1 request per ring, 15 s timeout each), the postal code geocoding, the station names (2 more datasets).

Fix:

getWidgetContent has its own 9 s deadline; beyond that, it returns a "Reading open data stream..." card with a 15 s TTL, while the real pull continues and fills the cache → the card fills itself on the next pull.
A real error remains an error (the core displays it to the user): only the missing ack was silent.
stationStore.search shares its in-flight promise: 2 cards = 1 search instead of 2.
  1. Rounding

It’s Gladys, not the integration, and in two places:

tile with a number → formatNumber with maximumFractionDigits: 2
tile linked to a device → DeviceFeatureValueText → Math.round(v * 10) / 10 → 1 decimal

It’s the second case in your screenshot: 1.699 becomes 1.7 in the widget, 1.699 on the device page.

Fix: all price tiles now send text formatted by us (1.699), in the language sent by the core. Assumed counterpart: the « My Station » card loses the live link to the device — but notifyWidgetsChanged already pushes the core to remove the card after each pass that moves a price.

To be reported upstream if you want: DeviceFeatureValueText which rounds to 1 decimal is debatable for any precise sensor.
3. Multiple houses

The core can only resolve the dynamic options of a select on devices (SELECT_SOURCES = [‹ devices ›]) — no manifest can list the houses.

Fix:

house.js now keeps all localized houses (it only kept one).
New config field "Which house" (free text, optional): name compared without case or accents, empty = the first localized one.
The "Station Preview" button displays the house used + the list of houses known by Gladys, to know what to write. Only the names, never the coordinates.

Everything should be fixed in version 2.0.6 which just came out :wink:

Everything seems correct house by house tonight.

They are simply accessible in settings, and wouldn’t it be possible to create a list area?.. OK, it’s a comfort.

For me, in principle, it’s all good… well done.

Perfect and thank you for the feedback :slight_smile:
For the list, it’s a limitation of Gladys, as indicated in the documentation :wink: :


Prices are now more rounded.

After this testing period, I will only use the fuels I actually use.

I usually go to this station, but they sell SP98:

• TotalEnergies - 104/106 AV MEDERIC - Noisy-le-Grand (1.6 km) — Diesel: €2.250/L, SP98: not sold, E10 (SP95-E10): out of stock…

Thanks :wink:

It’s fixed in the next version (2.0.7):

You were right: your station sells SP98. It displayed « not sold » due to a data gap that the integration read incorrectly. It’s fixed and pushed to claude/quirky-hypatia-59syh1.

What happened

  • Yesterday, the national file said « SP98 temporarily out of stock since 21/09 ».
  • Today, the feed no longer provides anything for SP98: neither price nor out of stock. The station probably lifted its outage without resetting its price.
  • The integration read this « nothing » as « not sold ».

Fix

  • When the feed says nothing about a fuel, the integration now checks the price history of the last 30 days (public dataset prix-des-carburants-j-1).
  • If the station has displayed a price for this fuel during this period, it is marked as « out of stock » instead of « not sold ».
  • A « permanent » outage declared by the station is never questioned.
  • If the history does not respond, nothing breaks: we keep what the feed says.
  • The response is cached for 6 hours, so no additional requests are made with each refresh.
  • Code in src/countries/franceRecent.js, merged in src/countries/france.js.

Verified on your station (93160009)

  • Before: SP98 not sold.
  • After: SP98 out of stock. Same for E10, which is actually out of stock at the moment.
  • All tests pass (4 new ones), as well as lint and format. The FR/EN documentation and CLAUDE.md are up to date.

To know

  • On the device, the text will be « Out of stock », without a date, because the feed does not provide one in this case.
  • As soon as the station resets its SP98 price, it will display normally.

Thanks for this new version with widgets/triggers: the « cheapest » widget and the « cheapest station has changed » trigger are really very useful right now

Question: could we adjust the display of the station names based on the available space on the screen we’re using?
On Desktop


On Mobile:

I’ve already iterated quite a bit to get to the result you see so that it looks good on mobile, but there might still be some adjustments to make :wink:

Here’s Claude’s feedback:

What do you think?

Okay, so I think the best solution would be for Gladys to send the current screen width and for the text to adapt according to option 3, but I understand that this is a request at the core level.
Regarding option 1, if I understand correctly, it would be to create a PC dashboard and another dashboard for mobile? For me, that’s too « heavy » and I don’t like it!
So what I would suggest in the meantime would be to add a parameter to option 3: the ability to set the number of characters to display, as this would allow everyone to adapt it to their screens (on my side, I still have space on my PC/Tablet/Mobile screens).