Setting new value state do nothing

Hi, I am solving the problem, that in automation I save a new value to (my) sensor and everything does well but there is no value at state

Definition of my sensor

power_history:
      friendly_name: 'History of Power'
      value_template: >-
        {% set xx = [{'x':0}, {'b':3}] %}
        {{ xx }}

Next automation in action has this:

service: text.set_value
data_template:
  entity_id: sensor.power_history
  value: "{% set xx = [{'x':0}, {'b':3}] %} {{ xx }}"

When I execute automation I see no error

obrazek

When I try to show state of sensor, I see that were changed

obrazek

But value of state is still Unknown

obrazek

Were I am wrong?

You can’t set the value of a sensor.

That service is for text entities - I’m guessing you’re another victim of ChatGPT et all.

Also, the sensor should set the value itself, after all you’ve got the template in it (even if that’s the old style of template sensor)

1 Like

BTW: no GPT…

What can I do to change value? … all components/devices of HA change values of self sensors… usually.

Why I cannot do for myself sensors??? That is non sense.

If you want something you can change, HA has you covered.

However your automation above was pointless because you already had the template in the template sensor