home-assistant-config icon indicating copy to clipboard operation
home-assistant-config copied to clipboard

Shopping list integration > multiple list integration

Open jcallaghan opened this issue 3 years ago • 1 comments

Quest to see if can make a multiple-list integration similar to the shopping list integration and shopping list card.

  • Integration https://github.com/home-assistant/core/tree/dev/homeassistant/components/shopping_list
  • Front-end https://github.com/home-assistant/frontend/blob/dev/src/panels/lovelace/cards/hui-shopping-list-card.ts

image

jcallaghan avatar Mar 12 '22 18:03 jcallaghan

Built-in shopping list integration is simply reading from and writing to a json file /config/.shopping_list.json. I have recently created a command_line sensor which reads that file every 5 seconds.

- platform: command_line
  name: Shopping list
  command: "jq -r '{complete: [.[] | select(.complete==true)], incomplete: [.[] | select(.complete==false)]}' /config/.shopping_list.json"
  value_template: "{{ value_json.incomplete | length }}"
  json_attributes:
    - complete
    - incomplete
  scan_interval: 5

I'm currently using it to sync with Yandex Station and Telegram bot.

alphasixtyfive avatar Jun 02 '22 13:06 alphasixtyfive