From baa5656fcc12e1c78e8b240a3756dabf812905cb Mon Sep 17 00:00:00 2001 From: Yashar Dabiran Date: Thu, 13 Feb 2025 22:21:10 -0500 Subject: [PATCH] Add README --- README.md | 55 ++++++++++++++++++++++++ view.liquid => views/full-height.liquid | 6 +-- views/half-height.liquid | 50 +++++++++++++++++++++ views/sample.png | Bin 0 -> 3385 bytes 4 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 README.md rename view.liquid => views/full-height.liquid (88%) create mode 100644 views/half-height.liquid create mode 100644 views/sample.png diff --git a/README.md b/README.md new file mode 100644 index 0000000..2eb82b3 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# Bring! shopping list TRMNL plugin + +![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/yshrdbrn/trmnl-bring-plugin/docker-publish.yml) +![License](https://img.shields.io/github/license/yshrdbrn/trmnl-bring-plugin) +![Issues](https://img.shields.io/github/issues/yshrdbrn/trmnl-bring-plugin) + +Unofficial Bring! plugin for TRMNL + +![Plugin view](views/sample.png) + +## How to use + +### 1. Create a private plugin on TRMNL dashboard + +First, create a [private plugin](https://help.usetrmnl.com/en/articles/9510536-private-plugins) with webhook strategy. + +You then need to create the view templates for your plugin. Go to the Edit Markup page: + +1. paste the contents of [full-height.liquid](views/full-height.liquid) into the Full and and Half Vertical tabs. + +1. paste the contents of [half-height.liquid](views/half-height.liquid) into the Half Horizontal and and Quadrant tabs. + +### 2. Run the backend service + +The backend service queries Bring! every 15 minutes to grab the list of items in your shopping list and sends the list to TRMNL if the shopping list changed since the last query. + +Have these handy: + +1. Bring! account email +1. Bring! account password +1. TRMNL plugin webhook URL. You can find this at the bottom of your private plugin page. + +*Note:* If you signed up to Bring! using Apple ID or Google Sign-in or other SSOs you need to create password first. More [here](https://www.home-assistant.io/integrations/bring/#prerequisites). + +You can either run the backend service through docker: + +```bash +docker pull ghcr.io/yshrdbrn/trmnl-bring-plugin:main + +docker run + -d + --name='BringTRMNLPlugin' + -e 'EMAIL'='' + -e 'PASSWORD'='' + -e 'WEBHOOK_URL'='' + 'ghcr.io/yshrdbrn/trmnl-bring-plugin:main' +``` + +or run the script directly: + +```bash +python3 -m venv venv +pip install -r requirements.txt +python ./main.py +``` diff --git a/view.liquid b/views/full-height.liquid similarity index 88% rename from view.liquid rename to views/full-height.liquid index 95cd0f6..f3fa473 100644 --- a/view.liquid +++ b/views/full-height.liquid @@ -2,12 +2,12 @@
{% assign number_of_items_per_column = 10 %} {% assign number_of_columns = 2 %} - {% assign totalCount = items | size %} + {% assign total_count = items | size %} {% assign number_of_items_displayed = 0 %} {% assign var = number_of_columns | minus: 1 %} {% for i in (0..var) %} - {% if number_of_items_displayed >= totalCount %} + {% if number_of_items_displayed >= total_count %} {% break %} {% endif %}
{% assign items_to_display_count = number_of_items_per_column %} {% if i == var %} - {% assign items_to_display_count = totalCount | minus: number_of_items_displayed %} + {% assign items_to_display_count = total_count | minus: number_of_items_displayed %} {% endif %} {% assign items_to_display = items | slice: number_of_items_displayed, items_to_display_count %} {% for item in items_to_display %} diff --git a/views/half-height.liquid b/views/half-height.liquid new file mode 100644 index 0000000..51c8eed --- /dev/null +++ b/views/half-height.liquid @@ -0,0 +1,50 @@ +
+
+ {% assign number_of_items_per_column = 5 %} + {% assign number_of_columns = 2 %} + {% assign total_count = items | size %} + {% assign number_of_items_displayed = 0 %} + + {% assign var = number_of_columns | minus: 1 %} + {% for i in (0..var) %} + {% if number_of_items_displayed >= total_count %} + {% break %} + {% endif %} +
+ {% assign items_to_display_count = number_of_items_per_column %} + {% if i == var %} + {% assign items_to_display_count = total_count | minus: number_of_items_displayed %} + {% endif %} + {% assign items_to_display = items | slice: number_of_items_displayed, items_to_display_count %} + {% for item in items_to_display %} + {% assign number_of_items_displayed = number_of_items_displayed | plus: 1 %} +
+
+ +
+
+ {{ item }} +
+
+ {% endfor %} +
+ {% endfor %} +
+
+
+ + Bring! + Home +
+ + + + \ No newline at end of file diff --git a/views/sample.png b/views/sample.png new file mode 100644 index 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