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

How to save/delete/restore all the entites in one call-service command?

Open Krzysztonek opened this issue 3 years ago • 1 comments

Hi @PiotrMachowski ,

I usually use following:

service: saver.save_state
data:
  entity_id: specific_domain.specific_entity

However, I need to list all the entities I want to save, in a separate line. But what if I need to save all the entities when leaving home and then restore them when coming back home? So, I'm wondering if there is any chance to save all the entities at once?

I would expect the following useful ideas to be implemented:

  1. Save all the available entities:
service: saver.save_state
data:
  entity_id: [all]
  1. Save all the entities from the same domain:
service: saver.save_state
data:
  entity_id: specific_domain.all
  1. Save all the entities except those being excluded:
service: saver.save_state
data:
  entity_id: switch.all
    excluded_entities:
      - switch.kitchen_coffeemaker
      - switch.any_other_example

The same approach would be applicable to other services: delete, restore, etc.

Krzysztonek avatar May 15 '22 11:05 Krzysztonek

I think scene.create would be much better for your use case https://www.home-assistant.io/integrations/scene/#creating-scenes-on-the-fly

PiotrMachowski avatar May 15 '22 12:05 PiotrMachowski