snarky-snark / home-assistant-variables

A custom Home Assistant component for declaring and setting generic variable entities dynamically.
Apache License 2.0
278 stars 16 forks source link

Value template problem after 0.15.1 upgrade #109

Closed blackie333 closed 6 months ago

blackie333 commented 6 months ago

Hello, use variables for holding some long-term values which worked great. After latest upgrade my variables values became reset to empty string after HA restart. Seems like value automatic update via template won't work as before for tracked_entity updates. I want to return old value if group state condition is not met but old value gets lost. please fix this.

var: last_motion_time: friendly_name: "Last Motion Time" restore: true value_template: >- {% if is_state('group.grp_motion_sensors_all', "on") %} {{ states.sensor.date_time.state }} {% else %} {{ states('var.last_motion_time') }} {% endif %} icon: mdi:motion-sensor-off tracked_entity_id:

snarky-snark commented 6 months ago

v0.15.1 was broken. Try v0.15.2.

blackie333 commented 6 months ago

v0.15.2 tested but unfortunately issue remains. Template values still got reset during HA Core restart.

nm20220210 commented 6 months ago

same error in v0.15.1 & v0.15.2 variable value is empty go back to old release v0.15.0

alias: vartest
description: ""
trigger: []
condition: []
action:
  - service: var.set
    data:
      entity_id: var.pmx152
      value: test
  - if:
      - condition: state
        entity_id: var.pmx152
        state: test
    then:
      - service: notify.persistent_notification
        metadata: {}
        data:
          message: OK
    else:
      - service: notify.persistent_notification
        metadata: {}
        data:
          message: NIO
mode: single
poohbah commented 6 months ago

I'm seeing the same problem. Variables are not restored after restarting HA. I tried adding the 'restore: true' flag but it had no effect. I also tried removing and reinstalling variable with no change. Every reboot clears the variables I have created.

How do you revert to a prior version through HACS? I know I can do this manually.

estegewr commented 6 months ago

How do you revert to a prior version through HACS? I know I can do this manually.

Select the installed variable module in your HACS repositoy. On the module page select the context menu (three dots) in the upper right corner. There you find the Redownload function and can pick the version you want to downgrade to.

nm20220210 commented 6 months ago

Screen-2024-04-08_00-27-52 Screen-2024-04-08_00-32-21

highincolorado commented 6 months ago

I also had to revert to 15.0, all my variable get reset after a reboot as well.

snarky-snark commented 6 months ago

Try v0.15.3.

snarky-snark commented 6 months ago

See #112.

blackie333 commented 6 months ago

Thanks. 0.15.3 seems to work fine again, no values lost during HA restart.