Has anyone managed to add several items to the shopping list at once? For example, I would like to say: put milk, butter and cheese on my shopping list and expect three entries. I have set up Open Ai as llm.
I automated it by listening for the shopping_item_added
event and if it contained “and”, I split it into multiple new items and deleted the old one. The problem with three or more items is the commas are not there, and you don’t want to split by a space (“diet coke and bread” would be 3 items when it should be 2). Therefore I say “add milk and butter and cheese”.
PLEASE could you share your automation yaml here. Love to have it your way.
Good idea, I’ll give it a try. We could also try sending the entry in the automation to ChatGPT to have it analyzed.
I tried the following:
The following entry is on a shopping list: diet coke bread and apple.
Analyze the entry, and if it appears to contain multiple items, create a list in the following format: [“Entry 1”, “Entry 2”].
Respond only with the completed list.
An i got this as a Response:
[“Diet Coke”, “Bread”, “Apple”]
As soon as I have some time, I will give it a try.
Is it possible to trigger the automation only If the Item was added with assist?
I use Node Red for my automations…
[{"id":"dc2d0eeb51e17d78","type":"server-events","z":"6affa018.d6a2f","g":"17735094fa4cf190","name":"Shopping added","server":"5c211963.f91a88","version":3,"exposeAsEntityConfig":"","eventType":"shopping_list_updated","eventData":"{\"action\":\"add\"}","waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":140,"y":2920,"wires":[["976bf9c285e14322"]]},{"id":"976bf9c285e14322","type":"switch","z":"6affa018.d6a2f","g":"17735094fa4cf190","name":"'and' ?","property":"payload.event.item.name","propertyType":"msg","rules":[{"t":"cont","v":" and ","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":2920,"wires":[["86ad868a365a7cf9","d3dcbbe49e13c463"],[]]},{"id":"86ad868a365a7cf9","type":"change","z":"6affa018.d6a2f","g":"17735094fa4cf190","name":"Payload(s)","rules":[{"t":"set","p":"payload","pt":"msg","to":"$split(payload.event.item.name, ' and ')\t ~> $map(function($v) {\t { \t \"data\": {\t \"name\": $v\t }\t }\t })\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":2980,"wires":[["a045b278e4dc4aab"]]},{"id":"a430f6c8df9e22db","type":"api-call-service","z":"6affa018.d6a2f","g":"17735094fa4cf190","name":"Add","server":"5c211963.f91a88","version":5,"debugenabled":false,"domain":"shopping_list","service":"add_item","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":2980,"wires":[[]]},{"id":"d3dcbbe49e13c463","type":"change","z":"6affa018.d6a2f","g":"17735094fa4cf190","name":"Payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \t \"data\": {\t \"name\": payload.event.item.name\t }\t}\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":2920,"wires":[["6b800b8ae97fcfb9"]]},{"id":"6b800b8ae97fcfb9","type":"api-call-service","z":"6affa018.d6a2f","g":"17735094fa4cf190","name":"Remove","server":"5c211963.f91a88","version":5,"debugenabled":false,"domain":"shopping_list","service":"remove_item","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":940,"y":2920,"wires":[[]]},{"id":"a045b278e4dc4aab","type":"split","z":"6affa018.d6a2f","g":"17735094fa4cf190","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":690,"y":2980,"wires":[["a430f6c8df9e22db"]]},{"id":"5c211963.f91a88","type":"server","name":"Home Assistant","version":5,"addon":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
You could use also a word in a sentence for a trigger, like “shoppinglist”.
trigger: conversation