Home-Assistant-custom-components-Saver icon indicating copy to clipboard operation
Home-Assistant-custom-components-Saver copied to clipboard

Delete variable by wildcard

Open PiotrMachowski opened this issue 1 year ago • 0 comments

Discussed in https://github.com/PiotrMachowski/Home-Assistant-custom-components-Saver/discussions/29

Originally posted by tapsystem May 4, 2024 Hello, Before all really a great thanks for this addon, it's really usefull , specially when you need to work with varaible update in conditionnal block and bypass the scope limitation !

Just an idea for an update : it's will be great to have the possibility to delete variables or entites using wildcard like

service: saver.delete_variable
  data:
    name: myVariable_*

this way it's possible go generate a random variable for parrallel script execution like this

service: saver.set_variable
    metadata: {}
    data:
      name: "{{ 'myVariable_' + ((range(10000, 99999) | random)| string ) }}"
      value: "false"

and so get the possibility to clear all these randoms var in an automation every night ( i was deleting random var at script end, but some time with errors ... varialbes stay in database and in memory

Thanks again for this nice job ! ;)

(Grrrr can not get my line jump nice in code section, sorry for edit spaming)

PiotrMachowski avatar May 05 '24 01:05 PiotrMachowski