Jarrod Bell
CommandFusion
www.commandfusion.com
--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Jarrod, I'm almost finishing my Slider button, I would like to say thanks a lot for your assistance!!!I'm working on the Serial Join to present the Dimmer Level percentage. I got successes to using CF.SetJoin to do It, but I did not succeed to print out format as decimal in module. I read math expression in the Wiki.My Dimmer Level is being presented as DD.ddd, for example : 30.123 and i would like to present the dimmer level value in module as 30 . I've already tried to use "%", "::" and "f" in a several combinations and positions but I did not succeed. Would you can help me, please?Part of My code is: CF.setJoins([{join:"s1", value:((sval/254)*100)}]);
To further elaborate by example let's start with Tulio's snippett (I am assuming sval is a string but is numeric in content):
var aaa = parseInt(sval,10);
var bbb = (aaa/254)*100);
CF.setJoins([{join:"s1", value:bbb}]); // or CF.setJoin("s1",bbb);
Change 1:
var aaa = sval-0;
var bbb = (aaa/254)*100);
CF.setJoins([{join:"s1", value:bbb}]); // or CF.setJoin("s1",bbb);
Change 2:
var bbb = ((sval-0)/254)*100;
CF.setJoins([{join:"s1", value:bbb}]); // or CF.setJoin("s1",bbb);
Change 3:
CF.setJoins([{join:"s1", value:((sval-0)/254)*100}]); // or CF.setJoin("s1",((sval-0)/254)*100);
Hopefully I did not screw up the typing
In fact since sval/254 should be properly evaluated by js first converting sval to a number then:
Change 4:
CF.setJoins([{join:"s1", value:(sval/254)*100}]); // or CF.setJoin("s1",(sval/254)*100);
if sval is not a true numeric then the result of the internal javascript conversion (sval/254) will produce the value NaN
If you are serious about Home Automation the best advice I can give you is to learn Javascript. I do all my work for my home automation systems in Javascript. I use a Raspberry Pi coded in Javascript as the central controller, in wall iPads in every room coded in Command Fusion / Javascript; and Amazon Alexa for full voice control of everything in the house. Because I write everything in Javascript I get a lot of reusability from code segments .
I addition there is lots of free code, information, and help if you are using Javascript.
Good luck, glad to be helpful
Barry
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusion+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "CommandFusion Software" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/commandfusion/mLIcEeUptMg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to commandfusion+unsubscribe@googlegroups.com.