Add the tokens as custom attributes to your existing input_text. Attributes aren’t limited to storing a 255-character string.
-
Go to Configuration > Customisations
-
Select your input_text.
-
At the bottom of the form, where it indicates “Pick an attribute to override”, select Other.
- Enter a name for the first token (I used
token1) and paste the long string you have (I used a 335-character long string) to prove it can exceed 255 characters). Create another attribute to store the second token.

-
Click Save.
-
Go to Developer Tools > States, select your input_text and confirm the custom attribute contains the desired string. This custom attribute and its value will survive a restart.
You can access the string in a template using the state_attr function:
{{ state_attr('input_text.test', 'token1') }}
If you need to change the custom attribute’s value programmatically, you can use rodpayne’s set_state.py python_script. However, that technique does not store the value permanently and it only lasts until Home Assistant is restarted.
If you are already using MQTT, an entirely different way to handle this is with an MQTT Sensor and publishing the tokens as payloads to be saved as the sensor’s attributes (this may be what Hellis81 suggested).


