-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is 'variable' domain bad? #35
Comments
I also really didn’t like that now the setting for each variable needs to be added to the integration. |
The problem with UI is that variable and variable attributes are not searcheble within HA. How would you know what variables you have to controll pump now if you have several houndreds of such sensors in the system and now your variable is also a 'sensor'? Comments are crutial as well - how do you remember that your attribute 'avg_data_bins' store a list of dicts of a certain structure? And the most important - sensor and binary_sensor are already implemented in the HA with 'templete' integration - why would I need variable as a sensor if I already have it? I need variable as an abstract data type... P.S. it is not an issue of new and existing users. It is an issue of being usefull and useless. I cannot imagine anyone would seriosly need variable set up from UI - such people use basic functionality and do not need 'variables', but when you need it, it has to be introduced with YAML... |
I mean I guess u can change it so u could be able to set it up over UI and yaml. But I do not have the time do that right now for the next weeks. But thats why we asked for feedback to change it to the needs but also have new possibilities. @Snuffy2 ? |
It does not add possibilities but cuts these instead - this is the problem. Any extension MUST be reverse compatible, which implies that already stored data must not be lost. Just an example: some of my variables store statistics for over a year which I need (monthly insolation data). Reworking all scripts will take days, and the system will not be operational during this time. Regathering the data will take month... And I seriosly do not see enything you've introduced that was not already in the HA by today. Maybe we are missing something? Give an example and we may think of how to make it clear that this feature is already in HA and does not require a change to the 'variables'... |
I don't like the idea to have other than variables as well... A sensor is a sensor, a switch is a switch, variable should be as variable... It is not about the Breaking Change and the need to do everything from the beginning, even if I have thousand of variables with data already created, I don't mind to change something for a new better version, but having sensors and other things different than variables, I don't find it useful. |
I don't like the idea to have other than variables as well... A sensor is a sensor, a switch is a switch, variable should be as variable... It is not about the Breaking Change and the need to do everything from the beginning, even if I have thousand of variables with data already created, I don't mind to change something for a new better version, but having sensors and other things different than variables, I don't find it useful.
Lets be real, if someone knows how to install HACS, it will know how to use YAML as well.... So yes, no need for UI, or if there is an UI, i'm fine with if there is YAML as well... |
I'll attempt to respond with my opinions on why these changes were made.
|
The point is that use of UI to set up complex data structures is a bad idea from the start. Add from UI works well if all of your objects have similar structure. But if every object is different... It is a nightmare. You will never rememer the structure of your objects by theis names and will not be able to use them...
You can write a migration service for the new integration - keep both, new and old integrations alive (name them differently), On first boot, empty entities of a new type created, and after HA loads, you may run a migration service of the newest integration, which runs through the states.variable set and ads attributes to the entities of the new integration with same object_id... Then the old integration may be removed maually.
It is a must if every object is different from others...
The problem is not to find a variable, but to find a proper one. Script development is happening in the Notepad++ and from time to time in my old scripts I find a references of the type var.attributes.attr1, and I need to find all variables with attribute attr1. Normally, variables are arranged in files by topic, i.e. heating_contoller.yaml contains related variables of same type and so on. So, search in files swiftly brings me into the necessery file dedicated to a structure searched and I can read comments and recall the purpose of the fields... Search in WEB interface of the HA is absolutely useless.
Does not play any role at all. It is absolutely not important because once created you do not add or remove variables normally, after a set of relateed scripts is developed and tested, expirience tells that you never touch these again. So, this is the last in the list of prioritiess - it does not require massive rebooting, so it is o,k, to reboot couple of times when developng structure... Moreover, you reboot only if you declare new variable. But if you only need to add attribute, you can simply set this attribute and it will appear in the list.
The variables are needed in the first place because standard methods fail to deliver the result. We use them because we want abit more than standard methods can provide. Every variable is a RECORD/STRUCT/CLASS emulator which comes with it's own set of scripts to substitute the blueprints, groups and so on which everyone developes for his needs. So, this feature is not that important also.
UI limits use of variable due to the lack of convenience. Sonner or later, when variables get complex enough one will need to migrate to YAML after all... UI is sort os saying option for the beginners. But all beginners want more eventually and this is YAML...
As I wrote, config_flow is a bad idea for this case in the first place. P.S. just to illustrate, here is a sample of my small real life structure implemented as variable: think for yourself how convenient is that to have it set up in the UI, and this is by far not the complex one...
P.S.2 Is there a limit to the size of a sensor? For some of my sensors I see warnings that their size exids 16kB and attributes will not be stored: State attributes for sensor.nmi_weather_complete_forcast exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored. I guess if it's true, it also may cause problems... |
The Attribute size-limit is part of 2023.3: I don't want to exclude all Variables from the Recorder, but as a future enhancement could look into an option to exclude per entity. If you think this would be helpful/the right solution, free free to open a separate Issue so it can be tracked. Still looking into the possibility of a hybrid integration that supports yaml and config_flow. Will update when I have more. |
For this reason I continue to use built in helpers where I can. Really the only instance I actually really require this variable integration is when I need to set the attributes. The replace_attributes option is a very useful tool indeed. There is nothing stopping y'all from forking the previous version to keep using it as you were prior to v3.0. You could probably even run the forked version and v3.0 side by side! Not to say that there aren't some very valid points raised here but we all use the integration differently. For me it's slightly comforting knowing it's come more in line with current HASS standards and thus less likely to break unexpectedly. YAML option off the hop may have been nice, but I've converted so c'est la vie! I do appreciate having this option available to me in the first place, because the core devs certainly aren't interested in developing it. |
I have an idea, if it not too much what i ask.... Can you make two different variable addons and let people to choose what to use? |
Basically, you reiterate my suggestion on how to restore old variables in the new integration - you have to have both running and have a migration service. It could be like this:
|
Yes but I don't say nothing about restoring or anything else which involves using only the new addon |
You did not say it, bat basically it is what it should be - you need two integrations running at the same time for migration primarily (otherwise just use new one) - one day the old one may become unmantainable and you will need to migrate, no options. But, before this day came, you may continue using 2.6... Actually, you do not need a migration service if both integrations are running - anyone can migrate using simple script. In this sence - yes, running both integrations is enough. But, you need an option of YAML in the new one anyway - because when 2.6 will be gone, you will still need YAML in the new one... |
For me, the most annoying thing is that all the variables will not have the "variable." prefix... I want to know which entity is variable and which is other, you can't... Then, the UI thing... |
This is a horrible update for organizational purposes. Having all of my variables in yaml in their related packages was extremely useful. I could quickly copy/paste an existing variable config multiple times and place it in the related package of where it is used. Now if I need to go thru the UI to to configure a variable and then jump back into the package to configure everything else via yaml it's going to pretty well suck. Having the "variable" domain was instrumental in knowing how and where the entity was configured. As mentioned above being able to create a variable (which now isn't a variable any longer - it's now more like a template sensor) without restarting is no big deal for me. It's a once and done thing. I will usually never need to update the entity id and the restore option solved all of the issues with losing the variable state on HA restarts. I really fail to see the benefits of UI only config, etc. IMHO, this change totally destroyed the usefullness of this integration. The whole move to "only UI" is misdirected. UI is mostly for beginners. Beginners don't stay that way for long. And again as mentioned creating potentially complex data structures via the UI is likely impossible or next to it. I have an integration that was originally in yaml only. Others wanted a config flow option and I was fortunate that another dev was willing to make that happen. But the one requirement before I accepted his PR was to make sure that yaml config was still possible. So maintaining both is possible. Thanks to Wibias for taking it over and maintaining it after Rogro82 abandoned it but I guess it's time to lock my current version and hope it doesn't stop working in the future. It's a good thing I actually read the change notes for this update before I did it. I usually don't for this one since it's been so reliable. That would have been a not so nice surprise. Another question tho.. was there a discussion about this upcoming totally breaking change in the forums and I missed it? |
I just realeased the new version from @Snuffy2 as a beta release. Feel free to try it. HACS --> Integrations --> Variables+History --> Three Dots in the upper right corner --> Redownload --> Show beta versions Then you can select it by yourself in the version selector or it will show up in the HACS Dashboard |
@Snuffy2 or @Wibias , can you please tell me if there is any plan to have two different addons, one as a new one (with sensors) and one with variables (like the old version) ? Or at least a change in the future for the new addon, which will make it more like the old version? with "variable." entities and config from yaml? I just want to know if I need to wait or I should find another similar addon. Thank you! |
Relex and enjoy life. Some reading for you to calm down: Variables is an integration (not add-on) which is designed to implement complex data structures, which in it's turn enable to implement full scale functional programming (no kidding, I've done it) with Jinja templating. I was using it intensivelly for integration prototyping - this is when you want to try if your idea works or not and do a sample integration instead of proper one in Python - it works great. |
Will close this for now! |
Dear All,
The latest release (3.0) is not a step into the wright direction for the obvious reasons:
Why spoil something that is simple and works with something which will never work? KISS - Keep It Simple Silly
Regards,
P.S. to make thing clear an example of oversimplified variable one may have in real life:
Above example can be used when attribute pressure_sensor triggers automation to process variable's test_pump_controller data. From this it is clear, that variables are NOT sensors. And if you want average_pressure as a sensor - create template sensor from this attribute! It is already in he HA. Moreover, you need comments, because you will never remember what these attributes denote in a couple of month. And you need it to be declared in YAML, because you can do simple 'search in files' when you want to find variable with attribute 'average_sensor' - something you cannot do from UI...
The text was updated successfully, but these errors were encountered: