home-assistant-config
home-assistant-config copied to clipboard
Shopping list integration > multiple list integration
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

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.