Der-Henning / tgtg

Scanner for Too Good To Go Notifications
https://github.com/Der-Henning/tgtg/wiki
GNU General Public License v3.0
386 stars 61 forks source link

Message for items_available==0 #516

Open rdorsch opened 1 month ago

rdorsch commented 1 month ago

Hello,

for me it would be quite useful to obtain also a message if items_available==0, since that means it is not worth to open the tgtg app anymore.

My apologies if I missed that option, but I did not find it in the configuration wiki.

Many thanks Rainer

Der-Henning commented 1 month ago

Hi @rdorsch. This option does not exist as this feature is not in the scope of the scanner. But I can describe you a way to achieve what you want. When you set the METRICS option to true the scanner provides the current item amouts via a prometheus metrics endpoint on localhost:8000/metrics. You can scrape the data using prometheus and set custom alarms using i.e. alertmanager or grafana. The later also alows you to create dashboards visualizing the data.

For this setup I recommend using docker and create the stack using docker compose.

rdorsch commented 1 month ago

I didn't want visualization or similar.

I thought that there is somewhere in the code a condition like

if items_available>0 and old_items_available==0: send_message()

and a modification to

if (items_available>0 and old_items_available==0) or (items_available==0 and old_items_available>0 and sold_out_flag_enabled): send_message()

should already do , if there is a config parameter sold_out_flag_enabled.