snarky-snark / home-assistant-variables

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

[Feature] Allow updating any state #92

Closed mdeweerd closed 1 year ago

mdeweerd commented 1 year ago

I propose to not limit the update to the var entities, but allow updating any state, including sensors.

I tried the following:

service: var.set
data:
  entity_id: sensor.ewelink_th01_temperature
  value_template: "{{ states('sensor.ewelink_th01_temperature')|float + 0.0001 }}"

The purpose is to apply a small change to the sensor value so that when the device communicates the temperature again, HA will consider that to be a change. And that change will then become a trigger for an automation.

However the above did not have the desired effect (I suppose because value_template only indicates how the value will be set when a variable is updated - so the code should apply the template immediately when the method is not applied to a var)

snarky-snark commented 1 year ago

This is out of scope for the var component.