Blueprint local variables

Hello all, tried to search the webz but didnt found any answer… I started with the HA like 2 days ago so I am complete noob… Bought philips hue white for getting started with automations, I have created a blueprint in which I have input that holds light entity, and input for number that holds entity to number helper which tracks current color and bunch of others but those are irrelevant…

name: Lights
description: The lights to control.
- light
multiple: true
name: Current color
description: Number helper to track the current light color.
- input_number
multiple: false

I can trigger an action that will increase value of current color and updates helper, then it will call service that sets this new value into light

- service: input_number.set_value
entity_id: !input current_color
value: "{{ states(current_color) | int + 250 }}"
- service: light.turn_on
entity_id: !input lights
color_temp_kelvin: "{{ states(current_color) | int }}"

Everything is working great but now I am struggling with mess in helpers as i dont really need current_color helper to be outside of the blueprint (or automation)…

So my question is, can i have current_color variable only locally with possibility to update it? if I try to define current_color as local variable with something like this:

name: Current Color
default: 4000
min: 2200
max: 6500
step: 250
mode: slider

I get and 500 error when i try to use this blueprint and create automation…

Possibility that I am missing something obvious is really high but as I said, I am noob and I dont even know what I need to search on web in order to solve this…

Any help is appreciated and thanks in advance…

I can’t understand what you have there.
Please follow this in the FAQ:

Also 2 days into HA is not the time to start blueprint writing. Start with an automation, get that working, Once that is doing what you want make that into a BP if you still need one.
2 days into HA you should be looking for blueprints that others have written to help / teach you how things work from the blueprint exchange.

thanks for F.A.Q link, I will go trough it… Basically what i have is automation where i am reading and setting value in helper… my question was if there is ability to declare variable that can be updated from automation but its not helper, kinda local variable within automation only…

Btw: 2 days was sufficient enough for me to get HA on rpi from scratch and create automation for all of my tado radiator valves and all philips hue lights operated with philips hue tap dial switch… after that i learned that blueprints exists so i started to rewrite automations into the blueprints… They are working but all those helpers are quite mess so i was just wondering if they need to be global… But i guess so as i believe that automation process is not persistent, so local variable declared there will not be persisted when automation triggers again… I mean, now I believe that automation run is new instance of process rather that one instance that is triggered over and over again…

Like this?

Or this?

If you are talking about adding an internal memory register to all automations that exist while the automation is running, that doesn’t exist either. (something like this.register with read/write global scope in the automation)
But if you put in a feature request for such a thing I will definitely vote it up. Been wanting one of those for a while. Just don’t know how to word the request.

Aaaah that Feature request is exactly what I was looking for… I can even see this native input helper support in roadmap for Blueprints V3…
So will wait until implemented…

Thanks for links :wink:

1 Like