Does anyone know how to create a flow that stores persistent notifications?
I get the idea, starting from listening to call service events modify an entity/sensor whatever that will store those notifications.
[{"id":"74f777ea67012fb7","type":"server-events","z":"66b702e7.2af0fc","name":"","server":"9405c3fe.d0a6c","version":3,"exposeAsEntityConfig":"","eventType":"call_service","eventData":"","waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":1470,"y":1440,"wires":[["311cf50e76974799"]]},{"id":"311cf50e76974799","type":"switch","z":"66b702e7.2af0fc","name":"","property":"payload.event.domain","propertyType":"msg","rules":[{"t":"eq","v":"persistent_notification","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1595,"y":1440,"wires":[["fd0ee8d59d8d5593","4489c2a8b97d2d3f"]],"l":false},{"id":"4489c2a8b97d2d3f","type":"switch","z":"66b702e7.2af0fc","name":"service","property":"payload.event.service","propertyType":"msg","rules":[{"t":"eq","v":"create","vt":"str"},{"t":"eq","v":"dismiss","vt":"str"},{"t":"eq","v":"dismiss_all","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":1700,"y":1440,"wires":[["e0cff51cd254b801"],["22727c3d9f6b9a65"],["7de2c0e74f29467d"]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"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}]
Main problem is I don’t know how to store pairs of values. Every notification mainly consists (in my case) in a pair of values (notification_id and title).
How can I add up them in an array so they always work? I mean…when there’s only 1 value, how can I create an array of just 1 pair of values? when another notification adds up, how can I create the new array so values don’t duplicate?
I’m really lost, I tried achieving it by piling them in a string but ended up in a dead end.
any help will be appreciated