Hey,
I cant get this to work.
I have DOODS that scans for detected objects at my front door and returns a value. Normally I a value of 2 (2 cars in drive). I want to use this to save and restore a value of doods after a restart. My code is below and i would appreciate some help.
# Hass.io has restarted
- id: 'hassio_restarted'
alias: 'Hass.io Startup Notification'
trigger:
- platform: homeassistant
event: start
action:
- service: script.restore_states
- service: notify.mobile_app_stephen_s20
data:
title: "Home Assitant has restarted."
message: ''
- service: notify.alexa_media
data:
target:
- media_player.office_echo
data:
type: announce
message: "Home Assitsant has restarted."
# Hass.io has shutdown
- id: 'hassio_shutdown'
alias: 'Hass.io Shutdown Notification'
trigger:
- platform: homeassistant
event: shutdown
action:
- service: script.save_states
- service: notify.mobile_app_stephen_s20
data:
title: "Home Assitant has shutdown."
message: ''
- service: notify.alexa_media
data:
target:
- media_player.office_echo
data:
type: announce
message: "Home Assistant has shutdown"
save_states:
alias: Save States
sequence:
- service: saver.save_state
data:
entity_id: image_processing.doods_front_door
restore_states:
alias: Restore States
sequence:
- service: saver.restore_state
data:
entity_id: image_processing.doods_front_door
restore_script:
- service: image_processing.scan
data_template:
entity_id: image_processing.doods_front_door
value: "{{ state}}"
3_14
(Piotr Machowski)
June 22, 2020, 7:29pm
22
Does image_processing
have a possibility to set state using a service?
The only service i think it has is image_processing.scan
- i take it that it cant be done then?
pafftis1
(Pafftis)
December 20, 2020, 5:26pm
25
please tell me the script, there is a wled tape. I want to save its effect state, change the effect, and then return the effect back
alias: test
sequence:
service: saver.save_state
data:
entity_id: light.wled
delay: ‘00:00:05’
service: wled.effect
data:
entity_id: light.wled
effect: police
delay: ‘00:00:05’
service: saver.restore_state
data:
entity_id: light.wled
entity_id: saver.saver
mode: single
3_14
(Piotr Machowski)
December 20, 2020, 10:42pm
26
pafftis1
(Pafftis)
December 21, 2020, 1:46pm
27
it turns out that your addition will not help me. Sorry, maybe I don’t write correctly, I’m from Russia
cerebrate
(Alistair Young)
October 7, 2021, 5:12am
29
Is there a way to use this to save and restore multiple entities in one go. So, for example, saving with:
- service: saver.save_state
data:
entity_id:
- input_select.accent_lights_alert_color
- input_select.accent_lights_default_color
- input_select.accent_lights_movie_color
- input_select.accent_lights_test
and then restoring with a
- service: saver.restore_state
data:
entity_id:
- input_select.accent_lights_alert_color
- input_select.accent_lights_default_color
- input_select.accent_lights_movie_color
- input_select.accent_lights_test
restore_script:
- service: input_select.select_option
data:
entity_id: SOMETHING GOES HERE
option: '{{ "{{ state }}" }}'
rather than having to save and restore them one at a time?
3_14
(Piotr Machowski)
October 7, 2021, 7:49am
30
It is possible using built-in scenes mechanism:
- service: scene.create
data:
scene_id: before
snapshot_entities:
- climate.ecobee
- light.ceiling_lights
- service: scene.turn_on
target:
entity_id: scene.before
Documentation
cerebrate
(Alistair Young)
October 7, 2021, 3:04pm
31
I’ve given that a try, but it seems to be restoring too much for what I need.
(I’m trying to update the list of options for some input_selects, and then restore only the selected option to what it was before. Doing this with the scene method apparently restores the list of options as well.)
3_14
(Piotr Machowski)
October 7, 2021, 3:27pm
32
In this case unfortunately you have to do it one by one Alternatively you can try to play around with loops
cerebrate
(Alistair Young)
October 12, 2021, 5:06pm
33
Hrm. Before I start working on it as such, would you be interested in a pull request to add this?
3_14
(Piotr Machowski)
October 12, 2021, 8:03pm
34
Definitely not anytime soon, I have a looooot of work with other integrations
pcb1962
(pcb1962)
March 25, 2024, 5:35pm
36
Can you please provide an example of how to save and restore multiple entities? I would like to use this to preserve the state of some binary_sensors and restore them after a restart.
3_14
(Piotr Machowski)
March 29, 2024, 3:46am
37
It is not possible to set a state of a binary sensor