A Way To Store `color_threshold:` As A Variable

Put simply, I want to store different color_threshold sets for use in different cards. Seeing as some values can go from 0-10 or in the case of measuring power usage up to 900W+ (when accounting for total usage)

I am looking for a solution, if any, to save the values to shrink down cards that don’t use the UI feature (mini-graph and APEXCHART to name a few)

Example:
[ Saved in !color_thresholds.yaml (or something that would work *.lol) ]
color_threshold_lights_on:
- value: 1
color: “#deb6f2
- value: 5
color: “#b877d9
- value: 10
color: “#9249A6
[…]

[ Card where the variable is used! ]
type: custom:apexcharts-card
color_threshold: var(–color_threshold_lights_on)

Any help is very much appreciated! :hugs:

Hello

First when posting code You can use the </> button like this… How to format your code in forum posts
OR… Here is an example of how to fix formatting from the site FAQ Page.
How to help us help you - or How to ask a good question.

Second, Create a text helper and store your variables there.
Open your Home Assistant instance and show your helper entities.

1 Like

I appreciate your reply regarding my inquiry and the advice regarding best practices.:hugs:

As far as the text-helper, I’m not exactly sure how that would work. After looking into it, the 255 text field limit would not let me use as many characters as I would like for my use case. Also I am sadly still a bit of a novice when it comes to pulling attributes/state information and using it in cards to set values.

I use n8n in my setup, very helpful since it has a feature that lets you call any value from a previous node and use it later via what ever node-id. If you are familiar with that program, that is basically what I am trying to accomplish.

Again that you for the advice and I look forward to any other notes you may have regarding this matter!

All the best!

Trigger based template sensor to store global variables .

I found a solution that more or less solves the issue I was having. I came across Streamline-Card

Basically let’s me create the cards, copy them as is to a designated .yaml and call them in a card on a given dashboard. Having the abilities to use variables to change things on the fly also meets my needs too.

Thanks again for the help and input! Got me going down the road I needed to solve my issue!

All the best!