You can add Spain, i can add it tomorrow if you like
Ill take a look
Amazing, glad your enjoying it ![]()
Haven’t had a lot of time to play with it recently, need to sort a few bugs first
did you want to create a pull request for the SA currency and products? I can add it to the repo.
Share rthe automation for entering the shopping zone, I can add it to the destructions when i properly get around to creating/updating them ![]()
would be great to add the Whatsapp integration
I used ai tools to add South Africa into the code.
My Whatsapp integrations work beautifully.
Add items automation:
alias: Shopping List - WhatsApp Commands
description: Adds or removes one or more products using WhatsApp
triggers:
- trigger: event
event_type: new_whatsapp_message
event_data:
clientId: default
conditions: - condition: template
alias: Message was not sent by IRIS
value_template: |-
{{
trigger.event.data.key.fromMe
| default(false)
| bool(false)
== false
}} - condition: template
alias: Sender is authorised
value_template: |-
{% set sender_lid =
trigger.event.data.key.senderLid
| default(trigger.event.data.key.remoteJid, true)
| default(‘’)
| string
| trim
%} {{
sender_lid in [
‘LID NUMBER@lid’,
‘LID NUMBER@lid’
]
}} - condition: template
alias: Message is not from a group
value_template: |-
{% set remote_jid =
trigger.event.data.key.remoteJid
| default(‘’)
| string
| trim
%} {{ not remote_jid.endswith(‘@g.us’) }} - condition: template
alias: Message contains a shopping list command
value_template: |-
{% set message_data =
trigger.event.data.message
| default({})
%}
{% set message =
(
message_data.extendedTextMessage.text
if message_data.extendedTextMessage is defined
and message_data.extendedTextMessage.text is defined
else
message_data.conversation
if message_data.conversation is defined
else
‘’
)
| string
| trim
| lower
%}
{{
message | regex_match(‘^(add|remove)\s+.+’)
and not (
message | regex_match(‘^add\s+.+\s+to\s+packing\s+list$’)
or
message | regex_match(‘^add\s+to\s+packing\s+list\s+.+$’)
)
}}
actions: - variables:
sender_lid: |-
{{
trigger.event.data.key.senderLid
| default(trigger.event.data.key.remoteJid, true)
| default(‘’)
| string
| trim
}}
sender_number: |-
{% if sender_lid == ‘LID NUMBER@lid’ %}
PHONE NUMBER
{% elif sender_lid == ‘LID NUMBER@lid’ %}
PHONE NUMBER
{% else %}
unknown
{% endif %}
recipient_jid: |-
{{
trigger.event.data.key.senderLid
| default(trigger.event.data.key.remoteJid, true)
| default(‘’)
| string
| trim
}}
message_text: |-
{% set message_data =
trigger.event.data.message
| default({})
%} {{
(
message_data.extendedTextMessage.text
if message_data.extendedTextMessage is defined
and message_data.extendedTextMessage.text is defined
else
message_data.conversation
if message_data.conversation is defined
else
‘’
)
| string
| trim
}}
command: ‘{{ message_text.split(’’ ‘’, 1)[0] | lower }}’
product_text: |-
{{
message_text
| regex_replace(‘(?i)^(add|remove)\s+’, ‘’)
| trim
}}
product_queries: |-
{% set normalised = product_text
| regex_replace(‘(?i)\s+(and|&)\s+’, ‘,’)
| regex_replace(‘\s*,\s*’, ‘,’) %}
{{ normalised.split(‘,’) | map(‘trim’) | reject(‘equalto’, ‘’) | list }} - repeat:
for_each: ‘{{ product_queries }}’
sequence:
- choose:
- conditions:
- condition: template
value_template: ‘{{ command == ‘‘add’’ }}’
sequence:
- action: shopping_list_manager.add_item
data:
query: ‘{{ repeat.item }}’
sender: ‘{{ sender_number }}’
- conditions:
- condition: template
value_template: ‘{{ command == ‘‘remove’’ }}’
sequence:
- action: shopping_list_manager.remove_item
data:
query: ‘{{ repeat.item }}’
sender: ‘{{ sender_number }}’ - choose:
- conditions:
-
condition: template
value_template: ‘{{ command == ‘‘add’’ }}’
sequence: -
action: whatsapp.send_message
data:
clientId: default
to: ‘{{ recipient_jid }}’
body:
text: |-
Add request completed:{% for product in product_queries %} • {{ product }} {% endfor %}
-
- conditions:
-
condition: template
value_template: ‘{{ command == ‘‘remove’’ }}’
sequence: -
action: whatsapp.send_message
data:
clientId: default
to: ‘{{ recipient_jid }}’
body:
text: |-
Remove request completed:{% for product in product_queries %} • {{ product }} {% endfor %}
-
- conditions:
mode: queued
max: 10
Shopping list sent via Whatsapp to person arriving at shopping zones specified:
alias: Shopping List - WhatsApp on Shop Arrival
description: >-
Sends the active shopping list to Gerhard or Lurica when either person enters
a shopping zone
triggers:
-
trigger: zone
entity_id: person.gerhard
zone: zone.bergbron_shopping_centre
event: enter
id: gerhard_bergbron -
trigger: zone
entity_id: person.gerhard
zone: zone.cresta_shopping_centre
event: enter
id: gerhard_cresta -
trigger: zone
entity_id: person.gerhard
zone: zone.northgate_shopping_centre
event: enter
id: gerhard_northgate -
trigger: zone
entity_id: person.gerhard
zone: zone.checkers_hyper
event: enter
id: gerhard_checkers -
trigger: zone
entity_id: person.gerhard
zone: zone.food_lovers_market
event: enter
id: gerhard_food_lovers_market -
trigger: zone
entity_id: person.lurica
zone: zone.bergbron_shopping_centre
event: enter
id: lurica_bergbron -
trigger: zone
entity_id: person.lurica
zone: zone.cresta_shopping_centre
event: enter
id: lurica_cresta -
trigger: zone
entity_id: person.lurica
zone: zone.northgate_shopping_centre
event: enter
id: lurica_northgate -
trigger: zone
entity_id: person.lurica
zone: zone.checkers_hyper
event: enter
id: lurica_checkers -
trigger: zone
entity_id: person.lurica
zone: zone.food_lovers_market
event: enter
id: lurica_food_lovers_market
conditions:
actions: -
action: homeassistant.update_entity
target:
entity_id: sensor.shopping_list_active_items -
delay:
seconds: 2 -
condition: numeric_state
entity_id: sensor.shopping_list_active_items
above: 0 -
variables:
recipient: |-
{% if trigger.id.startswith(‘gerhard_’) %}
LID NUMBER@lid
{% else %}
LID NUMBER@lid
{% endif %}
person_name: |-
{% if trigger.id.startswith(‘gerhard_’) %}
ME
{% else %}
WIFE
{% endif %}
shop_name: |-
{% if trigger.id.endswith(‘_bergbron’) %}
Bergbron Shopping Centre
{% elif trigger.id.endswith(‘_cresta’) %}
Cresta Shopping Centre
{% elif trigger.id.endswith(‘_northgate’) %}
Northgate Shopping Centre
{% elif trigger.id.endswith(‘_checkers’) %}
Checkers Hyper
{% else %}
the shops
{% endif %}
item_count: |-
{{
states(‘sensor.shopping_list_active_items’)
| int(0)
}}
shopping_items: |-
{{
state_attr(
‘sensor.shopping_list_active_items’,
‘message’
)
| default(‘’, true)
}} -
action: whatsapp.send_message
data:
clientId: default
to: ‘{{ recipient | trim }}’
body:
text: >-
Current Shopping ListHi {{ person_name }}, you have arrived at {{ shop_name }}. {{ shopping_items }} {{ item_count }} {{ 'item' if item_count == 1 else 'items' }} remaining.
mode: queued
max: 10
In both these automations I use the LID number instead of phone number as it is more reliable. Have fun
I am just publishing some speed fixes finally!
It runs lightling fast over HA Companion app via Nabu Casa and even on 4G network, it’s been annoying me for ages!
Have fun ![]()
also I am going to look at a few enhancements and bumps as well.
Hi all,
I have created a newer more modern styled version you can view a demo here if you like, let me know what you think. It’s still in beta.
Great job Brent!! Please please add German locale support, otherwise I wont convince my wife on this.
Sweet will do ![]()
done, havent had a chance to look at it yet, tell me if anything is missing or wrong