Hi,
I am new to Home Assistant and seeking a method to store data that can be accessed by different automations. It should function similar to a dictionary, allowing me to dynamically set key value pairs. It is not necessary for the data to persist on reboot.
I tried to use an input_text to store a dictionary as json:
input_text:
latest_window_notification_automations:
name: Latest Window Notification Automations
initial: '{}'
action:
- service: input_text.set_value
data_template:
entity_id: input_text.latest_window_notification_automations
value: >-
{% set current = states('input_text.latest_window_notification_automations') | from_json %}
{% set set_item = dict({trigger.entity_id: this.context.id}) %}
{% set updated = dict(current.items(), **set_item) %}
{{ updated | to_json }}
This approach works well for a single item in the dictionary but encounters an issue when trying to store multiple items. I have observed an error in the home-assistant.log that appears to be related to a length limit:
WARNING (MainThread) [homeassistant.components.input_text] Invalid value: {"binary_sensor.hmip_bathroom_window":"01HDCK4FA29N98N9JE9DMJB4GX","binary_sensor.hmip_office_window":"01HDCMPWB9QHBMX2YZTZ70METM"} (length range 0 - 100)
Is there an issue with the code, or does it simply not function in that manner?