-
Notifications
You must be signed in to change notification settings - Fork 515
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
Improving VirtualFeeds #1660
Comments
Ah yes, sorry that does work. So maybe I will look at disabling the processes that don't make so much sense such as the ones under the feed and input section that will just use the last values. Perhaps they were disabled at one point but have been mistakenly reintroduced? |
What do you think of the expression idea in a wider sense? It could be a really powerful way of defining these kinds of operations, it's possible to include functions as well, there are some interesting examples in the documentation |
Always saw the process list as an assembly like language with math and conditions where you can do all that is required and expansable with new process types. Maybe you can add a new processtype that supports expressions on its own if you have a strong usecase. |
To add onto this request, I was working on creating a feed to display the amount of "self-produced" energy used at my house per day. The formula is pretty simple.
But, while trying to implement- It became pretty apparent the ability to subtract the value from 100, doesn't appear to be easily possible. As well, you cannot use a virtual feed, inside of another virtual feed. So, instead of creating yet another issue, I will attach my request to this existing issue, which if properly implemented, would solve my issue. |
You should bebhablenyonuse a virtual feed inside another virtual feed. |
Hello @XtremeOwnageDotCom please feel free to reopen your issue as a new issue. I wont be developing the expression approach anytime soon, so it might be worth looking at another solution to your issue. |
An example of a really useful function that the virtual feeds could be used for is to calculate the difference in temperature between internal temperature feed and an external temperature feed.
At the moment if you try and use a virtual feed to calculate the result of one feed subtracted from another it does not work as it just subtracts the last value of the second feed (due to the way input processing is formulated). - At least this is my understanding from testing here.
I've always though that being able to process mathematical expressions stated as strings would be a really neat feature and it looks like others have implemented everything needed make this possible.
Here are a couple of example libraries.
https://github.com/madorin/matex
&
https://github.com/mossadal/math-parser
I particularly like the first as it appears to be relatively compact, the library is a single file and its not that large.
Testing here it works really well, here's a basic example of what it can do:
What if we replace the current Virtual feeds creation modal with a modal that first allows a user to select a number of different source feeds, these are assigned to variable names .e.g
The user then specifies an expression as a string:
The result when viewing that virtual feed will be the result of the evaluated expression for all the datapoints in the request.
An alternative to a server side implementation would be to do this on the client, perhaps as a feature built in to the graph module, it could use a library such as https://mathjs.org/docs/expressions/parsing.html. An advantage of this approach is that it could simplify the server side feed module code removing the need for virtual feeds, the down side is that you have to load all the source feed data to the client before processing.. I think im edging towards the server side option as I think its a bit more versatile..
What do you think @chaveiro @alexandrecuer
The text was updated successfully, but these errors were encountered: