"Plugins"/firm-coded rulesets in MSR?
-
I know I have mentioned this before somewhere, but i simply can't find the thread..
Plugins like Auto Virtual Thermostat and Delaylight from Vera/openLuup are functions that whould be lovely to have in MSR - is there any possibility to implement these in some way?
I could offcourse program them myself and copy them to where i want to use them, but if i'm not wrong that would be a fairly advanced ruleset that in any case would be beneficial to share with the community in some way when they are made and done.
-
No comments leads me to belive there is no plans for this.
Anyone else using MSR for temperature control? If so, can you share control expressions?
Yep. I've moved my rules to MSR, but a couple are still on luup, waiting to be migrated.
What do you need, in particular?
I'm using a couple of rules to balance between solar and pellet stove, and to automatically start the electric heating when there's solar production going on for X hours.
I'm basing the logic on a couple of global expressions here:
The two variables heating_pellet and heating_prefersolar are two options we could switch to indicate we want to use solar or pellett (or not) to manually override the selection.
This is the main logic taking actions:
And I have others taking similar actions, to set the thermostat on when solar is producing a lot, etc. Termo richiesta is linked to thermostats, while Pompa di Calore drives our electric heater. The reset actions is turning the relays off.
-
@PerH , @therealdb gives a good example. I've implemented a four zone alarm with away, stay and home modes and entry delay in both R4V and MSR. Even in R4V I did a video showing how you can implement most of the functionality of DelayLight (the most common 80% of it that people use) easily. So I think you can do fairly complex and involved things with the tools that are present as yet, but I'm open to more... More... MORE!
If you are literally proposing plugins for Reactor, the question is... what should it look like? How would it work? Are you proposing that you literally write code for it, and if so, in what language? How/why is that different from using the current APIs? More is needed, for sure, but what do you think those things are? I've got enough other things I'm working on for Reactor right now that I don't really have mindshare for this depth of research in the near term, so I'd like to propose that you and any others that want to contribute formulate a proposal that covers these things, and how it would be integrated with the rest of the product, what it would look like (UI), and what additional tools you may need (debug?).
-
@toggledbits as I've already said via other routes, I'd like the ability to have an expression console, in order to better debug them.
My other requests at the moment are related to define virtual devices (or, if you like it more, persistent expressions) and functions (in order to define an action - let's say publish via mqtt or call an HTTP endpoint or whatever, and pass parameters - probably tied to the first part of this request, after all). I'm not sure plugins are necessary at this point, but I'm a programmer and I'm using MSR when I don't want to write code, or I want to tweak things visually. I'll further complicate things in the upcoming days, since I'll add solar prediction to the mix. -
@toggledbits as I've already said via other routes, I'd like the ability to have an expression console, in order to better debug them.
My other requests at the moment are related to define virtual devices (or, if you like it more, persistent expressions) and functions (in order to define an action - let's say publish via mqtt or call an HTTP endpoint or whatever, and pass parameters - probably tied to the first part of this request, after all). I'm not sure plugins are necessary at this point, but I'm a programmer and I'm using MSR when I don't want to write code, or I want to tweak things visually. I'll further complicate things in the upcoming days, since I'll add solar prediction to the mix.@therealdb said in "Plugins"/firm-coded rulesets in MSR?:
I'd like the ability to have an expression console, in order to better debug them.
OK. Let's talk about this for a minute. How do you envision that working? If you are working on an expression for a Rule, how would it establish context? Do you work from inside the rule, and if so, what is needed that is not currently provided? Same for global expressions... how would this operate differently from the global expression editor? Is it really necessary to create a separate facility, or would changes to the current expression editors somehow suffice?
@therealdb said in "Plugins"/firm-coded rulesets in MSR?:
functions (in order to define an action - let's say publish via mqtt or call an HTTP endpoint or whatever
Curious about this. In the MQTT example, there is a
perform()
function that can be used to run an action from an expression, and you can publish anything you want (usingx_mqtt.publish
), so I assume you are talking about something else. On HTTP, are you suggesting/imagining a function to perform an HTTP request and return the response as the function value? -
@therealdb said in "Plugins"/firm-coded rulesets in MSR?:
I'd like the ability to have an expression console, in order to better debug them.
OK. Let's talk about this for a minute. How do you envision that working? If you are working on an expression for a Rule, how would it establish context? Do you work from inside the rule, and if so, what is needed that is not currently provided? Same for global expressions... how would this operate differently from the global expression editor? Is it really necessary to create a separate facility, or would changes to the current expression editors somehow suffice?
@therealdb said in "Plugins"/firm-coded rulesets in MSR?:
functions (in order to define an action - let's say publish via mqtt or call an HTTP endpoint or whatever
Curious about this. In the MQTT example, there is a
perform()
function that can be used to run an action from an expression, and you can publish anything you want (usingx_mqtt.publish
), so I assume you are talking about something else. On HTTP, are you suggesting/imagining a function to perform an HTTP request and return the response as the function value?@toggledbits said in "Plugins"/firm-coded rulesets in MSR?:
OK. Let's talk about this for a minute. How do you envision that working? If you are working on an expression for a Rule, how would it establish context? Do you work from inside the rule, and if so, what is needed that is not currently provided? Same for global expressions... how would this operate differently from the global expression editor? Is it really necessary to create a separate facility, or would changes to the current expression editors somehow suffice?
I usually open two windows, and I'm working on a (disabled) test rule where I test things, and then copy it over to the final rule. The problem is that sometimes I don't want to mess existing expressions, or the expressions require values that are not evaluated until I save the rule - and then scrolling up and down. I just want a way to quickly test expressions without messing with existing expressions. Sometimes you're just testing new expressions, sometimes you're trying to tweak things. A debug tool is a better way to test, imho, since I don't need to persist the status.
Curious about this. In the MQTT example, there is a
perform()
function that can be used to run an action from an expression, and you can publish anything you want (usingx_mqtt.publish
), so I assume you are talking about something else. On HTTP, are you suggesting/imagining a function to perform an HTTP request and return the response as the function value?The message could be complex, like
text: "ABC", priority: 1, silent: true icon: "icon" }
and I want to pass parameters instead of trying to compose every time dynamically.
I'd like to invoke a function, instead, and be free to change the format in the future in a single place - or define defaults if necessary. I usually have functions for things like notifications (and I'm using the same payload to decide if I want to deliver it to TVs or PCs as well), TTS (where I pass volume, if it's emergency notification, etc) or to invoke an enpoint to get cams screenshot. Right now I'm still invoking luup endpoints that translate them via UDP/MQTT, but I want to remove this depedency on luup and invoke my own HTTP endpoints - or compose an MQTT message, based on the same placeholder (my system accepts the same message via MQTT or HTTP - for the same action).
So, I just want the ability to define a function like this (pseudo code):
function sendAlert(what, silent, sendToTv, chatid, localEmoji) { chatid = chatid or chats.group; silent = silent or false; sendToTv = sendToTv or false; publishMqtt("dbdomoticz/cmd/notification", { text = what, emoji = localEmoji, chatid = chatid, silent = silent } ); if (sendToTv) sendAlertToLGTV(what); }
And then have an action in the GUI, where placeholders are the parameters I have in the function.
-
@toggledbits said in "Plugins"/firm-coded rulesets in MSR?:
If you are literally proposing plugins for Reactor, the question is... what should it look like? How would it work? Are you proposing that you literally write code for it, and if so, in what language?
All good questions, let me explain my use profile:
I use wall plugs to control ovens in 5 rooms, and use AVT to do it by looking at two temp sensors per room. AVT gives me a "rule set" that takes into account heating time, cooling time, evaluating wether sensor data is valid, can run a fan to cool the room (no AC).. AVT also gives me the "Comfort"/"Eco" switch to enable lowering at night or when at work..
This is a very quick thermostat to install, and it gives me the thermostat appearance on my control panels in the house.
(the use profile of my co-inhabitants includes changing the thermostat setpoints fairly often!)In my head - with no experience with the MSR framework - this could be a type of rule in a rule set that looks a bit different than the usual ones (selected from a "Cusom rule" or "Prefab Rule" dialogue. It takes a set of defined inputs/controllers (sensors and actuators), and has its own "settings" tab for timers and other parameters for tuning.
This would then show up as a thermostat in the MSR panel GUI, similar to what AVT presents in imperihome or whatever.
Delaylight or other defined use cases could also be added to the custom rule list, and could lower the bar for having fairly complex automation quickly without thinking out an automation scheme for these functions.
@therealdb is obviously fluent in expression use, and this may perhaps be a way to open for some of that complexity for (us,) the non-coder-genius bunch?I'm getting better at the expressions use though, so all good examples are appreciated!
-
No comments leads me to belive there is no plans for this.
Anyone else using MSR for temperature control? If so, can you share control expressions?
@perh I've been using MSR for my HVAC since the beginning. I use what I've dubbed "Arm For" rulesets.
These "control" nothing. The individual rulesets referencing these do that.
As the Ambient API will sometimes drop I have a backup source thru OpenWeatherMap, hence the trigger re the Ambient being
null
.Is there a better way? Probably. This has worked wonderfully for years (starting with RFV and moving to MSR.)