Trying to get a simple multiply to happen on an current reading for an Owl rfx device using Javascript transform on an item. I’ve read that the bindings need to support the transform but I can’t find anywhere any info saying if the rfxcom binding supports them or not?
Item:
Number Owl_p3 { rfxcom="<[36352:Channel3Amps:JS(multiply240.js)]" }
multiply240.js file in transform directory…
(function(in) {
return in * 240;
})(input);
Hoping it is supported and my syntx is wrong - any pointers?
Looking at the source code for the rfxcom binding, I don’t see support for transforms. But you could use a rule and a “proxy item” to achieve what you are after.
items:
Number Owl_p3_proxy { rfxcom="<[36352:Channel3Amps]" }
Number Owl_p3
rule:
rule MultiplyP3
when
Item Owl_p3_proxy received update
then
Owl_p3.postUpdate((Owl_p3_proxy.state as DecimalType) * 240)
end