home-assistant-variables icon indicating copy to clipboard operation
home-assistant-variables copied to clipboard

automation reload triggers state change from original value, to unknown, to original value

Open Brucepbd opened this issue 2 months ago • 0 comments

My var definition:

electricity_price_peak: friendly_name: Electricity Price peak unit_of_measurement: "USD/kWh"
icon: mdi:application-variable-outline

When triggering an automation on a var change like this: triggers:

  • trigger: numeric_state entity_id:
    • var.electricity_price_peak

And I do a home assistant quick reload, it triggers the automation. The first trigger looks like it's from var.electricity_price_peak='unknown'. The next trigger is var.electricity_price_peak= back to it's restored/original value before the reload.

The work around I am using is don't trigger on vars. Trigger on something built into home assistant, like this:

triggers:

  • trigger: state entity_id:
    • input_boolean.flag_seasonal_electric_rate_change

For some reason vars change state twice during a quick reload. input_boolean or I suspect other things built into home assistant don't trigger state changes during reload.

If anyone knows about another work around or something I'm doing wrong or if this is a bug. Please post.

Also, thanks for making the integration! :)

Brucepbd avatar Nov 28 '24 21:11 Brucepbd