RM 4.0 Rule Questions and Optimizations


#61

thanks, I saw that, but I don't want to modify the value of the variable. My use case - calculate the variable once and then assign 10%*var to dimmer1.level and 20%*var to dimmer2.level, so basically I guess I am looking for in-line simple calculation.


#62

Don't have that. But, you can create two more variables and put the values in them -- they are free.


#63

Well this is a revelation. :grin:
I can now see how to do the average lux value of 2 devices.
It will take 5 variables though unless I've missed something.
Good stuff.
image


#64

You don't need the GV "Divide By 2" as you can use a "constant" in the math and just set it to 2 when you calculate the average.

You may need to add some "delays" in between the variable set/math to make sure that the value is set before the next step though, I've found that 2s is the magic number but YMMV.


#65

Thanks for the reply. I'll give it a go.


#66

Are the lux sensors reporting on level change or on a schedule? If they're reporting on level change you might end up with a pretty resource hungry rule since it could fire VERY frequently, just a heads up.


#67

Thanks. I've set the devices to report every 5 minutes not with every level change.


#68

also....

Other than average, you don't mention your ultimate goal... so maybe that app helps.. or not. :slight_smile:


#69

Probably won't be an issue then, what you might want to do is only have the "change" in level of one sensor (the one that has the most frequent level changes) as the trigger, then have a "wait for event with a short elapsed timeout" to give the 2nd sensor a change to report. I've found that it helps limit the number of times it runs too while maintaining an accurate value.


#70

I set a trigger for every 5 minutes to update the variables and it is working a treat.

Believe it or not I already use this but when I saw Bruce's post this came to mind and I thought I'd give it a go to see if it works. I do get the odd issue with the cobra app where intermittently it stops for some reason.

Also I thought I would give the variable option a go as this opens up other options to me and this was a good learning experience. :smile:


#71

Cobra's excellent app is "Average All"

I wanted to use a different equation.. exponentially weighted moving average.

"AverageThis" takes any number of omnisensor values and uses a virtual omni to save the rolling average of Illumination, Temperature and Humidity. (Some of which may not be reported by all onmi's.)

I leave mine accumulating permanently, but one could reset the virtual omni daily or hourly for a different 'curve.' I personally only use the Illumination, but I coded the app to take what it's given.

The Virtual Omni has a full 'library' of attribute values, but AverageThis is only touching those 3:

36%20PM

42%20PM


#72

I am trying to get the LastUsedCodeName attribute from Envisalink and send it as a part of the notification. I presume that value here will not be LastUsedCodeName, especially since it's triggered by HSM status changed.

So how do I retrieve an attribute of a device and add it to the notification string?


#73

The only direct way to do that right now would be to have a rule triggered by that attribute using Custom Attribute as the trigger capability. You could have a trigger with LastUsedCodeName changed, and then stick %value% in a string GV. That GV would then always have the latest value of that attribute. Of course this assumes the device is reporting events against that attribute.


#74

as much as it's a solution, is there a plan to make it happen in a less convoluted way? like maybe add an action "retrieve device attribute into a variable"?


#75

I'm thinking about it, now that you made me aware of it.

Update: this will be in the next release. Thanks for the suggestion.


#76

OK Folks here is your question for today. :smile: :wink:
I have a variable (Type Number) that I have saved a Lux level into.
I now want to copy that number into a Virtual Lux device.
I've had a good rummage through various posts and through RM4's menus but cannot seem to find how to do it.
Firstly is this possible and if so could someone offer me some pointers?
Thanks peeps.


#77

Custom action on the Virtual Lux device. The number parameter to a custom action accepts a gv for the value.


#78

Could you be a little more specific, please, because I'm trying to do this, too, and I'm really confused.

I created a virtual device with a type of Virtual Omni Sensor because that's the only virtual device type I could find that had illuminance.

I created a rule, and for the action selected "Run Custom Action." I selected "Illuminance" as the capability and selected my virtual device. I can select "setilluminance" as the command, but it only accepts a number, not a gv.

What am I missing?


#79

Aren't you able to use the GV with %'s around it? Like this: %VARIABLENAME%

I thought that was supposed to work.


#80

You can use a variable, like this: