Skip to content

DavyRoswinkel/toogoodtogo-ha-mqtt-bridge

 
 

Repository files navigation

TooGoodToGoo Home Assistant Mqtt Bridge

Buy Me A Coffee

Small python tool to forward stock of you favourite stores to Home Assistant via MQTT.

Stores are automatically created via MQTT Discovery and contain some addition attributes like price and more.

Installation:

Add-On

Easiest way is to use the Home Assistant Add-on. I created one in my Home Assistant Add-on repository.

Docker

Docker image is created automatically and available at dockerhub: maxwinterstein/toogoodtogo-ha-mqtt-bridge

Create some settings file called settings.local.json (see settings.example.json):

{
  "mqtt": {
    "host": "homeassistant.local",
    "port": 1883,
    "username": "mqtt",
    "password": "mqtt"
  },
  "tgtg": {
    "email": "me@example.ocm",
    "every_n_minutes": 10
  },
  "timezone": "Europe/Berlin",
  "locale": "en_us"
}

every_n_minutes sets the polling intervall. A value of e.g. 10 would fetch data every 10 minutes.

timezone (optional) as TooGoodToGo provides its times as UTC we format it to local time. See Wikipedia for valid values.

locale (optional) to format pickup times like in 2 hours. E.g. de for german, en_us for american english.

cleanup (optional) remove items from Home Assistant if they are no longer in the fetched result.

data_dir (optional) folder to store persistent data. Needed e.g. for cleanup feature.

And start with the mounted settings file, e.g. for macOS:

docker run --rm -ti --pull always -v $PWD/settings.local.json:/app/settings.local.json -v $PWD/data/:/data maxwinterstein/toogoodtogo-ha-mqtt-bridge

Attributes

Attributes are used to keep the amount of sensors small. If you want some specific sensor you can create it as template sensor.

sensor:
  - platform: template
    sensors:
      toogoodtogo_eilles_frankfurt_price:
        unit_of_measurement: ""
        icon_template: mdi:currency-eur
        friendly_name: "Eilles Frankfurt Price"
        value_template: "{{ state_attr('sensor.toogoodtogo_eilles_frankfurt', 'price') }}"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 95.4%
  • Dockerfile 4.6%