State variables (entity_id) after reboot #597
Unanswered
rundercaster
asked this question in
Q&A
Replies: 2 comments
-
I have never tried it, but could it be this? https://hacs-pyscript.readthedocs.io/en/latest/reference.html?highlight=persist#persistent-state |
Beta Was this translation helpful? Give feedback.
0 replies
-
state.persist('pyscript.current_shower_fan', default_value='fan.shower)
@time_trigger('once(10:30:00)')
def current_shower_fan_switcher(trigger_type=None, var_name=None, value=None, old_value=None, context=None, **kwargs):
log.debug(f"changing pyscript.current_shower_fan from {pyscript.current_shower_fan} to fan.shower_top")
pyscript.current_shower_fan = 'fan.shower_top'
# then
current_shower_fan_state = state.get(f"{pyscript.current_shower_fan}") |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just a quick question:
When I set the state with
state.set("sensor.test1", new_attributes={}, value=event_date)
I cannot access it after restart, but if I set it again new or the same value I can see the history of it
Is there any way to get the last states back after start up without running the main script
Beta Was this translation helpful? Give feedback.
All reactions