Saving namespace into sensor.variable ends with error extra keys not allowed @ data['value']

I have problem to save namespace to normal

sensor.power_consumption_history

. It writes error

extra keys not allowed @ data[‘value’]

Source code of automation that should save new value/new namespace is this:

service: input_select.set_options
data_template:
  entity_id: sensor.power_consumption_history
  value: >-
    {% set historie_spotreby = namespace(id = [1,2,3], datum = [1,2,3], nakup = [1,2,3], prodej
    = [1,2,3]) %} 
    {{ historie_spotreby }}

Did you anybody know where the problem is?

input_select.set_options is only for input_select entities, not sensors; and it needs a list for value, not a dictionary.

Ok, in YAML this array is dictionary.

So how is posible to store/save dictionary to sensors value?

What is the source integration of the sensor? You can only modify the states and attributes of user-defined sensors entities from a limited number of integrations such as Template and MQTT.

It is my own declaration/definition of sensor value. I could define whole variable or variable with attributes. But I absolutely did not find way how to store dictionary to that… I mean at action of an automation. I did not see there any way who to change the values.

But what underlying integration or platform are you using to create the entity?

The method or service you would use depend entirely on the integration/platform being used.

Yeah I found that too… But nowhere I find out how to read options values :sweat_smile: