fewieden / MMM-Fuel

Gas Station price Module for MagicMirror²
MIT License
63 stars 24 forks source link

Does the gasBuddy sortBy option work? #116

Closed dyeatman closed 8 months ago

dyeatman commented 1 year ago

Platform (Hardware/OS): Raspberry Pi 3A+

Node version: 18.18.0

MagicMirror² version: 2.25.0

Module version: 2.4.0

Description of the issue: Using Gasbuddy the sortBy parameter seems to have no effect. Does it work for GasBuddy? BTW, showDistance always shows zero so I turned that off, I assume that doesn't work in GasBuddy.

My MM Settings: { module: "MMM-Fuel", position: "top_left", config: { provider: "gasbuddy", types: ["regular"], sortBy: "regular", zip: "73071", radius: 10, fade: false, showDistance: false, max: 10 }

fewieden commented 1 year ago

@dyeatman I used your config and it is sorted by price, distance is not available for the GasBuddy provider.

image

dyeatman commented 1 year ago

Curious. None of my other modules appear to be affected and work with no apparent issues..

I flushed the logs then restarted MM and captured the logs which are attached along with a screenshot.

One log is with all my modules loaded and the second is with just the first basic modules loaded.

The error messages in both cases are pretty much the same and have some curious “index out of bounds” messages.

If I eliminate all the modules, in the error log I get the same index messages and nothing else.

Any thoughts? Should I reload something?

Thank you for your insights,

dave

From: fewieden @.> Sent: Thursday, October 12, 2023 2:48 AM To: fewieden/MMM-Fuel @.> Cc: dyeatman @.>; Mention @.> Subject: Re: [fewieden/MMM-Fuel] Does the gasBuddy sortBy option work? (Issue #116)

@dyeatman https://github.com/dyeatman I used your config and it is sorted by price, distance is not available for the GasBuddy provider.

https://user-images.githubusercontent.com/9334168/274497939-22eaf4cd-2bf4-4972-a330-08c8791fa6bb.png

— Reply to this email directly, view it on GitHub https://github.com/fewieden/MMM-Fuel/issues/116#issuecomment-1759106305 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKKPKFH3SJXCCD6PJP3LCC3X66ODJANCNFSM6AAAAAA54GFH3Y . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AKKPKFAVNW7R7FN2NLUXB73X66ODJA5CNFSM6AAAAAA54GFH32WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTI3HKQC.gif Message ID: @.***>

[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option) /home/pi/.pm2/pm2.log last 15 lines: PM2 | 2023-10-12T06:03:57: PM2 log: App [mm:0] starting in -fork mode- PM2 | 2023-10-12T06:03:57: PM2 log: App [mm:0] online

/home/pi/.pm2/logs/mm-error.log last 15 lines: 0|mm | [12.10.2023 06:04.07.030] [WARN] You're using a full whitelist configuration to allow for all IPs 0|mm | [7099:1012/060410.517896:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | ../../buildtools/third_party/libc++/trunk/include/vector:1473: assertion n < size() failed: vector[] index out of bounds[7099:1012/060423.106447:ERROR:gpu_process_host.cc(957)] GPU process exited unexpectedly: exit_code=134 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | ../../buildtools/third_party/libc++/trunk/include/vector:1473: assertion n < size() failed: vector[] index out of bounds[7099:1012/060431.896254:ERROR:gpu_process_host.cc(957)] GPU process exited unexpectedly: exit_code=134 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | ../../buildtools/third_party/libc++/trunk/include/vector:1473: assertion __n < size() failed: vector[] index out of bounds[7099:1012/060441.524156:ERROR:gpu_process_host.cc(957)] GPU process exited unexpectedly: exit_code=134 0|mm | [7139:1012/060445.360098:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.

/home/pi/.pm2/logs/mm-out.log last 15 lines: 0|mm | [12.10.2023 06:04.06.917] [LOG] Loading config ... 0|mm | [12.10.2023 06:04.06.923] [DEBUG] config template file not exists, no envsubst 0|mm | [12.10.2023 06:04.06.935] [LOG] Loading module helpers ... 0|mm | [12.10.2023 06:04.06.940] [LOG] No helper found for module: alert. 0|mm | [12.10.2023 06:04.06.989] [LOG] Initializing new module helper ... 0|mm | [12.10.2023 06:04.06.990] [LOG] Module helper loaded: updatenotification 0|mm | [12.10.2023 06:04.06.994] [LOG] No helper found for module: clock. 0|mm | [12.10.2023 06:04.06.995] [LOG] All module helpers loaded. 0|mm | [12.10.2023 06:04.07.011] [LOG] Starting server on port 8080 ... 0|mm | [12.10.2023 06:04.07.059] [LOG] Server started ... 0|mm | [12.10.2023 06:04.07.061] [LOG] Connecting socket for: updatenotification 0|mm | [12.10.2023 06:04.07.063] [LOG] Starting module helper: updatenotification 0|mm | [12.10.2023 06:04.07.064] [LOG] Sockets connected & modules started ... 0|mm | [12.10.2023 06:04.08.769] [LOG] Launching application. 0|mm | [12.10.2023 06:04.49.301] [INFO] Checking git for module: MagicMirror

[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option) /home/pi/.pm2/pm2.log last 15 lines: PM2 | 2023-10-12T05:46:47: PM2 log: App [mm:0] starting in -fork mode- PM2 | 2023-10-12T05:46:47: PM2 log: App [mm:0] online

/home/pi/.pm2/logs/mm-error.log last 15 lines: 0|mm | [12.10.2023 05:46.57.668] [WARN] You're using a full whitelist configuration to allow for all IPs 0|mm | [6783:1012/054701.212813:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | ../../buildtools/third_party/libc++/trunk/include/vector:1473: assertion n < size() failed: vector[] index out of bounds[6783:1012/054715.037330:ERROR:gpu_process_host.cc(957)] GPU process exited unexpectedly: exit_code=134 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | ../../buildtools/third_party/libc++/trunk/include/vector:1473: assertion n < size() failed: vector[] index out of bounds[6783:1012/054725.497898:ERROR:gpu_process_host.cc(957)] GPU process exited unexpectedly: exit_code=134 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | MESA-LOADER: failed to retrieve device information 0|mm | ../../buildtools/third_party/libc++/trunk/include/vector:1473: assertion __n < size() failed: vector[] index out of bounds[6783:1012/054735.404694:ERROR:gpu_process_host.cc(957)] GPU process exited unexpectedly: exit_code=134 0|mm | [6823:1012/054739.111093:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.

/home/pi/.pm2/logs/mm-out.log last 15 lines: 0|mm | [12.10.2023 05:46.57.706] [LOG] Starting module helper: updatenotification 0|mm | [12.10.2023 05:46.57.709] [LOG] Connecting socket for: calendar 0|mm | [12.10.2023 05:46.57.715] [LOG] Starting node helper for: calendar 0|mm | [12.10.2023 05:46.57.718] [LOG] Connecting socket for: MMM-Fuel 0|mm | [12.10.2023 05:46.57.719] [LOG] Starting module helper: MMM-Fuel 0|mm | [12.10.2023 05:46.57.719] [LOG] Connecting socket for: newsfeed 0|mm | [12.10.2023 05:46.57.720] [LOG] Starting node helper for: newsfeed 0|mm | [12.10.2023 05:46.57.721] [LOG] Sockets connected & modules started ... 0|mm | [12.10.2023 05:46.59.394] [LOG] Launching application. 0|mm | [12.10.2023 05:47.46.282] [LOG] Create new calendarfetcher for url: https://ics.calendarlabs.com/76/c089358d/US_Holidays.ics - Interval: 3600000 0|mm | [12.10.2023 05:47.47.958] [LOG] Create new newsfetcher for url: https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml - Interval: 300000 0|mm | [12.10.2023 05:47.48.042] [INFO] Checking git for module: MMM-Fuel 0|mm | [12.10.2023 05:47.49.765] [INFO] Checking git for module: MagicMirror 0|mm | [12.10.2023 05:47.53.654] [INFO] Calendar-Fetcher: Broadcasting 3 events from https://ics.calendarlabs.com/76/c089358d/US_Holidays.ics. 0|mm | [12.10.2023 05:47.55.328] [INFO] Newsfeed-Fetcher: Broadcasting 24 items.

Here is a screenshot: image

fewieden commented 1 year ago

@dyeatman hmm those could be errors from Electron. Did you try to run the mirror in server-only mode and access it from the browser? https://docs.magicmirror.builders/getting-started/installation.html#server-only

Your screenshot is not visible on GitHub.

dyeatman commented 1 year ago

I uploaded the image and linked it in the wiki.

I will trey server mode to see what happens.

Dave

From: fewieden @.> Sent: Thursday, October 12, 2023 12:36 PM To: fewieden/MMM-Fuel @.> Cc: dyeatman @.>; Mention @.> Subject: Re: [fewieden/MMM-Fuel] Does the gasBuddy sortBy option work? (Issue #116)

@dyeatman https://github.com/dyeatman hmm those could be errors from Electron. Did you try to run the mirror in server-only mode and access it from the browser? https://docs.magicmirror.builders/getting-started/installation.html#server-only

Your screenshot is not visible on GitHub.

— Reply to this email directly, view it on GitHub https://github.com/fewieden/MMM-Fuel/issues/116#issuecomment-1760060119 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKKPKFFNIUI3W66PTO4F343X7AS6FANCNFSM6AAAAAA54GFH3Y . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AKKPKFGEBCQ4TJETGE7OODLX7AS6FA5CNFSM6AAAAAA54GFH32WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTI5BRNO.gif Message ID: @. @.> >

fewieden commented 1 year ago

@dyeatman did you have a chance to test this in server-only mode?

dyeatman commented 1 year ago

Hi,

I still doesn’t sort. Everything else with Fuel (and the MM) works fine.

I haven’t tried it in server only mode but I will and let you know.

Dave

From: fewieden @.> Sent: Tuesday, November 7, 2023 12:54 AM To: fewieden/MMM-Fuel @.> Cc: dyeatman @.>; Mention @.> Subject: Re: [fewieden/MMM-Fuel] Does the gasBuddy sortBy option work? (Issue #116)

@dyeatman https://github.com/dyeatman did you have a chance to test this in server-only mode?

— Reply to this email directly, view it on GitHub https://github.com/fewieden/MMM-Fuel/issues/116#issuecomment-1797916258 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKKPKFGTZMNEWGXZZSVVNG3YDHLJTAVCNFSM6AAAAAA54GFH32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJXHEYTMMRVHA . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AKKPKFGQTBP7XOCYWSS7ZO3YDHLJTA5CNFSM6AAAAAA54GFH32WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTLFIDGE.gif Message ID: @. @.> >

dathbe commented 9 months ago

I'm having the same issue with both gasbuddy and autoblog (haven't tried the others). I can't tell what it's sorting by, but it's not price. The arrow suggests it's trying to, but the prices are all out of order.

bmikol commented 9 months ago

Agreed; for some odd reason gasbuddy only pulls 3 stations from my zipcode, despite having 10 as the max value.

Switching to autoblog, I'm seeing max and radius config properties work as expected. While the arrow indicates it's trying to do a descending sort by Price (why?), it appears that it's doing a distance sort… oddly from furthest to nearest.

I would expect that the list to be an ascending sort by either price (lowest -> highest) or distance (nearest -> furthest) – my personal preference would be by price.

dyeatman commented 9 months ago

In my case the list appears to be completely unsorted (even though there is a down arrow) and I am not sure what criteria causes them to be ranked as they are. Its not by name, distance or price.

dathbe commented 9 months ago

I turned on the distance column, and it seems mine is saying it is sorting by price, but it is really sorting by distance from farthest to closest. I'll dig into the code and see if I can find a reason.

Update: I don't have a solution.

It appears that the sorting is accomplished in /apis/utils/index.js. But I don't see any obvious errors. Through a little more exploration, there is something that is a bit curious. Autoblog's website that is being scraped effectively gives 20 stations for any given inputs (zip code, fuel type, sort method). When distance is the chosen sort method, it will give the 20 closest stations, which in a populated area is going to be a couple miles. If you choose price, though, it expands the search area greatly, displaying stations from up to 20 or so miles away. The /apis/autoblog.js file seems to properly grab the sort-by-price webpage (line 42), BUT when it is apparently reverse sorting by distance, when it is supposed to be sorting by price (and therefore supposed to be grabbing from the price page), the max distance is only a couple miles. This leads me to think that the DISTANCE PAGE is being fed into the sort and display functions when the price page is supposed to be. I couldn't immediately find where this was going wrong. I decided to make my own module with python, though, which has the added benefit of being able to hand pick the stations that I want to display.

bmikol commented 9 months ago

Thanks @dathbe! @fewieden any thoughts about this issue? Thanks!

fewieden commented 8 months ago

@dyeatman @dathbe @bmikol can you please share the configs that you used for gasbuddy and autoblog. Ideally also some screenshots of the result. Do you see any errors related to this module in the electron console or the terminal that you run the mirror in?

The last time I tried it with the config of @dyeatman from the issue description I was not able to reproduce the issue, see result here https://github.com/fewieden/MMM-Fuel/issues/116#issuecomment-1759106305

fewieden commented 8 months ago

My bad I already fixed the issue last year, but didn't release a new version :facepalm: https://github.com/fewieden/MMM-Fuel/issues/110

When I tried to reproduce the issue I was using the development version instead of the latest release.

I just released version 2.5.0, please update to that version and see if your problems are resolved. Don't forget to install the dependencies.

dyeatman commented 8 months ago

That finally fixed my sorting issue…Thanks!

From: fewieden @.> Sent: Sunday, March 10, 2024 6:40 AM To: fewieden/MMM-Fuel @.> Cc: dyeatman @.>; Mention @.> Subject: Re: [fewieden/MMM-Fuel] Does the gasBuddy sortBy option work? (Issue #116)

My bad I already fixed the issue last year, but didn't release a new version 🤦 #110 https://github.com/fewieden/MMM-Fuel/issues/110

When I tried to reproduce the issue I was using the development version instead of the latest release.

I just released version 2.5.0, please update to that version and see if your problems are resolved. Don't forget to install the dependencies.

— Reply to this email directly, view it on GitHub https://github.com/fewieden/MMM-Fuel/issues/116#issuecomment-1987196137 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKKPKFGF4D626EQJDDAE6HLYXRBA5AVCNFSM6AAAAAA54GFH32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGE4TMMJTG4 . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AKKPKFDAALUZ5WIHDB6EUR3YXRBA5A5CNFSM6AAAAAA54GFH32WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTWOI2OS.gif Message ID: @. @.> >

bmikol commented 8 months ago

Thanks @fewieden! I also can confirm the fix works and the issue's resolved with my config. Much appreciated!