HA’s “variables” are the input_xxx components. E.g., you can save a number in an input_number, or text in an input_text, etc., and then use their values later. Their values (i.e., states), by default, will even be saved across HA restarts.
Given Horizon joined 20th September (12 days ago, though he has read 11hrs (20 was a mis-read, sorry, but it’s still impressive) + (impressive ! )) I think he should explore vanilla options as Phil has pointed out.
Once he finds they aren’t enough for him (I still use input_xxx for LOTS of stuff) than he can explain his problem and take it from there. I don’t think that, is yet the case.
Horizon, Please correct me if I’m wrong ???
Just to be sure …
I’m sorry if you knew this already
If you have an initial: statement in the config to create your input_xxx, then that will overwrite on o reboot … so avoid initial if you need to leave last value in place.
As long as we’re discussing the custom variables component , I definitely looked at that early on. I have no problem with using custom components (especially since I created several myself), but I guess I don’t see how this one is any easier than the built-in input_xxx components. You set them the same way, and you retrieve their values the same way, right? What is easier about the variables custom component? (No, really, I’m interested in hearing. It’s been a while since I looked at it so maybe I’m missing something. )
Different data types under one component perhaps? You don’t need to use input_number, input_text, and input_datetime separately, you can just use variable if you have data among different types that you want stored.
Markus, I hope Im not putting words in your mouth but …
I think I’ve seen Markuss recommending this before as being easier to hide from users, who may try to mess with them.
If they can edit the yaml to show them, then I’ll let them.
I don’t have a 7 year old in the house (i.e. anyone smarter than me) so I’m happy
Honestly. I think I did a search for variables months ago and that solution came up - so I started using it, been happy with it, built a bunch of stuff around it, and have been using it ever since. I was a relative NOOB at the time I implemented it, wasn’t aware of the input_xxxx method, so just stuck w/ what worked for me.
So, I’m basically following the if it’s not broke, don’t fix it model in my own implementation. I have nothing against input_xxxx and someday when I’m really bored and I’m sure I’ll remove and replace w/ input_xxxx
So it takes a parameter named attributes_template. Ok, that’s definitely something that the input_xxx components can’t do, AFAIK. Thanks!
FWIW, my set_state.py python_script can do this, too. And it does it in only 18 lines of code! Except in this case you’d just use the standard data_template option of the service call.