being a huge fan of TooGoodToGo (buy leftover food for a reduced price) for years I stripped some telegram bot I use for myself and made some Home Assistant Add-on out of the core.
I am mostly happy to have data at Home Assistant Level and therefore in InfluxDB so I can create some ābig dataā analysis for my favorite shops.
Of course somebody could create notifications out of this, e.g. when your favourite shop add some offer. But this would be bad and you should feel bad.
(If I see you catching the Sushi I hunt for my wife I will steal your soya sauce!)
Feedback is highly welcome! Doing this in my spare time to give the community something back
Thatās ugly! Haha. I love the integration. Today I create my automation to notice me when new boxes are available. Never have to check it myself all the time!
I will share my script when done. Maybe you can add it in your wiki part on github
ID of the shop will always be the same. When the shop change a part of its name the ID still be the same.
With this sensor. Its shortā¦ In the attributes you already have the friendly_name.
And maybe you can stock_available from true/false to 1/0. I think you can use them in a trigger template part as numeric value?
Sadly not. The Sensor name is always created by the friendly name from HomeAssistant.
But, in the background there is some unique id that is set to the item id, this could/should prevent such things.
It can be used in a few ways.
To prevent anybody from accidentally creating notifications as soon as portions are available, here is something you should not create as automation, so be careful!
alias: TooGoodToGo Test
description: ''
trigger:
- platform: state
entity_id: sensor.toogoodtogo_brot_freunde
attribute: stock_available
from: 'false'
to: 'true'
condition: []
action:
- service: notify.mobile_app_iphone_max
data:
message: There is food!
mode: single
Scrap what I said below, I restarted the app and now I can see the sensors and their status. Looks me just being impatient.
Many thanks,
Andy
#################
Hiya, Iāve installed the app once I added the repo to the supervisor page, then added my mqtt details and Tgtg login and when the app starts I can see in both the app log and my mqtt server that it is retrieving my favourites and connecting to the mqtt server but Iām not getting any sensors. When I subscribe to everything on the mqtt server I donāt see any tgtg messages - am I missing something?
Iāve just checked the tgtg website and the first place that will be offering something is Starbucks tonight at 1900 - do I have to wait for the companies to offer something before the sensors are created?
Is there a reason that you use the portions value as state instead of the stock_available?
With stock_available you can group them also because if one is TRUE then group goes on.
You can get the portions with state_attrā¦
Nice update. Will it be possible to keep de update_interval back min: 30 sec?
I see some stores that have some in stock and its gone within the minuteā¦
well, yeah, as i wanted some nice graphs genereated automatically
This way I can see not only when portions are available, I can see how many and how quick they are sold out.
As i spend some lovely holiday in Amsterdam a few years ago (There was some awesome waffle house, so friendly and lovely) i give you some secret hint: 0.5 is also a valid value (aka āhalf of a minuteā)