Skip to content

TooGoodToGo items stock as sensor in Home Assistant

License

Notifications You must be signed in to change notification settings

mricharz/home_assistant_tgtg

 
 

Repository files navigation

TooGoodToGo items stock as a sensor in Home Assistant

This aim to show the stock of one or multiple TooGoodToGo item using the tgtg-python library. Sensor data can be used afterward to generate notifications, history graphs, ... share your best examples in the Discussion tab!

Usage

Installation via HACS

  1. Search for TooGoodToGo in the Integration tab of HACS
  2. Click Install
  3. Restart the Home Assistant server
  4. Go to Configuration -> Devices & Services and setup a new TGTG integration using your email

Features

  • No Docker-Container needed!!!
  • No local Python-Scripts and knowledge needed!!!
  • Fetch each item stock defined
  • ConfigFlow for easy configuration
  • Retrieve all favorites
  • Retrieve additional information as attributes, if available:
    • Item ID
    • Store ID
    • TooGoodToGo price and original value
    • Pick-up start and end
    • Sold-out date
    • Sales Window
    • Store Logo URL

How is it polling the data

  • This integration is polling all favourites every 15 minutes.
  • Every 2 hours the details of an item (for every item in favourites list) are fetched to update the saleswindow and/or pickup dates and other data of the item
  • If an item is inside his saleswindow (from start of saleswindow till 10 minutes later) it will be fetched more frequently (every 3 minutes)

Example Automation

As example we'll create a notification using the HomeAssistant Companion App on your smartphone.

alias: TGTG Q1 Notification
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.schaal_mehr_als_tanken_q1_tankstelle_karlsruhe_uberraschungstute
    above: 0
condition: []
action:
  - service: notify.notify
    data:
      message: Q1 gas station has new packages available
      title: TGTG Notification
mode: single

As soon as the number of your entry is higher than 0, this is immediately sent to you via push notification to the Companion App and displayed on your cell phone.

About

TooGoodToGo items stock as sensor in Home Assistant

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 93.3%
  • Dockerfile 5.4%
  • Shell 1.3%