https://wiki.webcore.co/api.php?action=feedcontributions&user=Whoismoses&feedformat=atomwebCoRE Wiki - Web-enabled Community's own Rule Engine - User contributions [en]2024-03-29T04:53:22ZUser contributionsMediaWiki 1.28.0https://wiki.webcore.co/index.php?title=Functions&diff=476Functions2017-05-28T13:42:17Z<p>Whoismoses: /* upper */</p>
<hr />
<div><div style="float: left; clear: both; margin-right: 1em; margin-bottom: 1em;">__TOC__</div><br />
Functions are extensions to expressions that allow data processing and conversion. Here is a list of all defined functions<br />
<br />
<br />
=[[Variable_data_types#String|String]] functions=<br />
<br />
==concat==<br />
:Syntax<br />
::<code>''string'' concat(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns a string that is the concatenation of all the supplied values. This function accepts two or more input values.<br />
<br />
==contains==<br />
:Syntax<br />
::<code>''boolean'' contains(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if the <code>needle</code> is found anywhere in the <code>haystack</code><br />
<br />
==endsWith==<br />
:Syntax<br />
::<code>''boolean'' endsWith(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if <code>haystack</code> ends with the <code>needle</code><br />
<br />
==format==<br />
[[File:Format.pdf|page=1|thumb|256px|A very nice article written by Professor Don Colton, at the Brigham Young University of Hawaii]]<br />
:Syntax<br />
::<code>''string'' format(''string'' formatString[, ''dynamic'' value1[, .., ''dynamic'' valueN]])</code><br />
:Returns<br />
::Returns a string that is built based on the <code>formatString</code> with arguments replaced by their corresponding values. Follows the java syntax for <code>printf()</code>. See a quick reference [https://www.cs.colostate.edu/~cs160/.Summer16/resources/Java_printf_method_quick_reference.pdf here], or a more detailed reference [https://sharkysoft.com/archive/printf/docs/javadocs/lava/clib/stdio/doc-files/specification.htm Reference here].<br />
::Each % in the format string represents an argument and corresponds to a value (in order of appearance) in the value list. Each argument can have formatting settings, according to the reference provided. <br />
:Example<br />
::<code>format('The temperature outside is %.2f degrees Fahrenheit', [Temp sensor:temperature])</code> outputs <code>The temperature outside is 71.26 degrees Fahrenheit</code><br />
::The <code>%.2f</code> translates to "format as <code>f</code>loat and use <code>.2</code> decimal places.<br />
<br />
==indexOf==<br />
:Syntax<br />
::<code>''integer'' indexOf(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns the character index of the first occurrence of <code>needle</code> inside <code>haystack</code><br />
:Examples<br />
::<code>indexOf("hello world", 'l')</code> outputs <code>2</code><br />
<br />
==lastIndexOf==<br />
:Syntax<br />
::<code>''integer'' lastIndexOf(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns the character index of the last occurrence of <code>needle</code> inside <code>haystack</code><br />
:Examples<br />
::<code>lastIndexOf("hello world", 'l')</code> outputs <code>9</code><br />
<br />
==left==<br />
:Syntax<br />
::<code>''string'' left(''string'' value, ''integer'' length)</code><br />
:Returns<br />
::Returns the first <code>length</code> characters in <code>value</code><br />
:Examples<br />
::<code>left("hello world", 2)</code> outputs <code>he</code><br />
<br />
==lower==<br />
:Syntax<br />
::<code>''string'' lower(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but with all lower case letters.<br />
:Examples<br />
::<code>lower("Hello World")</code> outputs <code>hello world</code><br />
<br />
==mid==<br />
:Syntax<br />
::<code>''string'' mid(''string'' value, ''integer'' start[, ''integer'' count = remaining])</code><br />
:Arguments<br />
::<code>start</code> - provides the 0-based index of the first character to copy. If <code>start</code> is negative, the counting starts from the end of <code>value</code>.<br />
::<code>count</code> - provides the number of characters to copy from <code>value</code>. If not provided, all of the remaining characters from <code>value</code> are returned, starting with character number <code>start</code>. If <code>count</code> is negative, prior characters are returned.<br />
:Returns<br />
::Returns a substring of <code>value</code>, <code>count</code> characters long, starting at character number <code>start</code>. Note that the first character in any string has index 0.<br />
:Examples<br />
::<code>mid("Hello World", 2, 3)</code> outputs <code>llo</code><br />
::<code>mid("Hello World", 2)</code> outputs <code>llo World</code><br />
::<code>mid("Hello World", -5, 2)</code> outputs <code>Wo</code><br />
::<code>mid("Hello World", -1, -3)</code> outputs <code>orl</code><br />
<br />
==random==<br />
:Syntax<br />
::<code>''dynamic'' random([''integer'' range | ''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN]])</code><br />
:Arguments<br />
::<code>range</code> - an integer number representing a range<br />
::<code>value1</code>..<code>valueN</code> - any kind of arguments, one will be randomly returned<br />
:Returns<br />
::Returns a random decimal number between <code>0</code> and <code>1</code> if no arguments are provided, or a number between <code>0</code> and <code>range</code> (inclusive) if a single argument is provided, or a randomly selected argument if two or more arguments are provided.<br />
:Examples<br />
::<code>random()</code> outputs <code>0.483</code> (random decimal)<br />
::<code>random(20)</code> outputs <code>6</code> (random integer)<br />
::<code>random("Hello World", "Good morning", "Hello", "Hi")</code> outputs <code>Hello</code> (randomly selected value)<br />
:Tips<br />
::To output a random integer between 5 and 20 use <code>(5 + random(15))</code><br />
::To output a random integer between -5 and 20 use <code>(-5 + random(25))</code><br />
<br />
==replace==<br />
:Syntax<br />
::<code>''string'' replace(''string'' haystack, ''string'' needle1, ''string'' replacement1[, .., ''string'' needleN, ''string'' replacementN])</code><br />
:Returns<br />
::Replaces all the occurrences of <code>needle</code> inside <code>haystack</code> with its respective <code>replacement</code>. Multiple pairs of <code>needle</code>/<code>replacement</code> can be provided in one function call.<br />
:Regular expressions<br />
::Needles support regular expressions when their value starts and ends with a <code>/</code>. For example, <code>'/(\s)/'</code> will match all spaces.<br />
:Examples<br />
::<code>replace("Hello World", 'World', 'Earth')</code> outputs <code>Hello Earth</code><br />
::<code>replace("Hello World", 'World', 'Earth', 'Hello', 'Hi')</code> outputs <code>Hi Earth</code><br />
::<code>replace("Hello World", 'World', 'Earth', 'Earth', 'Planet')</code> outputs <code>Hello Planet</code><br />
<br />
==right==<br />
:Syntax<br />
::<code>''string'' right(''string'' value, ''integer'' length)</code><br />
:Returns<br />
::Returns the last <code>length</code> characters in <code>value</code><br />
:Examples<br />
::<code>right("hello world", 4)</code> outputs <code>orld</code><br />
<br />
==startsWith==<br />
:Syntax<br />
::<code>''boolean'' startsWith(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if <code>haystack</code> starts with the <code>needle</code><br />
<br />
==string==<br />
:Syntax<br />
::<code>''string'' string(''dynamic'' value)</code><br />
:Returns<br />
::Returns <code>value</code> as a string.<br />
<br />
==substr==<br />
:Alias of <code>mid()</code><br />
<br />
==substring==<br />
:Alias of <code>mid()</code><br />
<br />
==title==<br />
:Syntax<br />
::<code>''string'' title(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but in its title case format (each word starts with a capitalized letter).<br />
:Examples<br />
::<code>lower("Hello there world")</code> outputs <code>Hello There World</code><br />
<br />
==upper==<br />
:Syntax<br />
::<code>''string'' upper(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but with all upper case letters.<br />
:Examples<br />
::<code>upper("Hello World")</code> outputs <code>HELLO WORLD</code><br />
<br />
==text==<br />
:Alias of <code>string()</code><br />
<br />
=Numeric functions=<br />
<br />
==avg==<br />
:Syntax<br />
::<code>''decimal'' avg(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the mean average of all the values provided.<br />
<br />
==ceil==<br />
:Syntax<br />
::<code>''integer'' ceil(''decimal'' value)</code><br />
:Returns<br />
::Returns the immediately higher integer, equivalent to rounding the decimal away from zero.<br />
:Examples<br />
::<code>ceil(5.6)</code> outputs <code>6</code><br />
::<code>ceil(-5.6)</code> outputs <code>-6</code><br />
<br />
==ceiling==<br />
:Alias of <code>ceil</code><br />
<br />
==decimal==<br />
:Syntax<br />
::<code>''decimal'' decimal(''dynamic'' value)</code><br />
:Returns<br />
::Converts <code>value</code> into a decimal. Returns <code>0</code> if <code>value</code> is not numeric.<br />
<br />
==float==<br />
:Alias of <code>decimal</code><br />
<br />
==floor==<br />
:Syntax<br />
::<code>''integer'' ceil(''decimal'' value)</code><br />
:Returns<br />
::Returns the integer part of a decimal, equivalent to rounding the decimal towards zero.<br />
:Examples<br />
::<code>floor(5.6)</code> outputs <code>5</code><br />
::<code>floor(-5.6)</code> outputs <code>-5</code><br />
<br />
==max==<br />
:Syntax<br />
::<code>''dynamic'' max(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the maximum of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==median==<br />
:Syntax<br />
::<code>''dynamic'' median(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the median average of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==min==<br />
:Syntax<br />
::<code>''dynamic'' min(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the minimum of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==number==<br />
:Alias of <code>decimal</code><br />
<br />
==power==<br />
:Syntax<br />
::<code>''decimal'' power(''decimal'' value, ''decimal'' exponent)</code><br />
:Returns<br />
::Returns the <code>value</code> at the power of <code>exponent</code><br />
<br />
==round==<br />
:Syntax<br />
::<code>''decimal'' round(''decimal'' value[, ''integer'' precision = 0])</code><br />
:Arguments<br />
::<code>precision</code> - the number of decimal places to be retained. If not provided, defaults to <code>0</code><br />
:Returns<br />
::Returns the rounded <code>value</code> with <code>precision</code> decimal places.<br />
<br />
==sqr==<br />
:Syntax<br />
::<code>''decimal'' sqr(''decimal'' value)</code><br />
:Returns<br />
::Returns the squared <code>value</code>, equivalent to <code>value</code> multiplied by itself.<br />
<br />
==sqrt==<br />
:Syntax<br />
::<code>''decimal'' sqrt(''decimal'' value)</code><br />
:Returns<br />
::Returns the square root of <code>value</code>.<br />
<br />
==stdev==<br />
:Syntax<br />
::<code>''decimal'' stdev(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the standard deviation of all the values provided.<br />
<br />
==sum==<br />
:Syntax<br />
::<code>''decimal'' sum(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the sum of sum of all the values provided.<br />
<br />
==variance==<br />
:Syntax<br />
::<code>''decimal'' variance(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the variance of all the values provided.<br />
<br />
=[[Variable_data_types#Boolean|Boolean]] functions=<br />
<br />
==bool==<br />
:Syntax<br />
::<code>bool(''dynamic'' value)</code><br />
:Returns<br />
::Returns the truth value of the input. Accepts anything as input and will return true if <code>value</code> is either a non-zero number, a non-empty string (with some exceptions, see below), a non-empty device list, a non-empty date/time/datetime<br />
<br />
==boolean==<br />
:This is an alias of [[Functions#bool|bool]]<br />
<br />
==eq==<br />
:Syntax<br />
::<code>eq(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is equivalent to <code>value2</code><br />
<br />
==ge==<br />
:Syntax<br />
::<code>ge(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is greater than or equal to <code>value2</code><br />
<br />
==gt==<br />
:Syntax<br />
::<code>gt(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is greater than <code>value2</code><br />
<br />
==isBetween==<br />
:Syntax<br />
::<code>isBetween(''dynamic'' value, ''dynamic'' startValue, ''dynamic'' endValue)</code><br />
:Returns<br />
::Returns true if <code>value</code> is greater then or equal to <code>startValue</code> and less than or equal to <code>endValue</code><br />
<br />
==isEmpty==<br />
:Syntax<br />
::<code>isEmpty(''dynamic'' value)</code><br />
:Returns<br />
::Returns true if <code>value</code> is not set, an empty string, or zero<br />
<br />
==le==<br />
:Syntax<br />
::<code>le(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is less than or equal to <code>value2</code><br />
<br />
==lt==<br />
:Syntax<br />
::<code>lt(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is less than <code>value2</code><br />
<br />
==not==<br />
:Syntax<br />
::<code>not(''dynamic'' value)</code><br />
:Returns<br />
::Returns the negated truth state of <code>value</code>. This is the logical negation of <code>[[Functions#bool|bool]](''dynamic'' value)</code>.<br />
<br />
=[[Variable_data_types#Date_and_Time|Date and time]] functions=<br />
<br />
==addDays==<br />
:Syntax<br />
::<code>addDays(''datetime'' value, ''integer'' days)</code><br />
:Returns<br />
::Returns a datetime that is <code>days</code> days after the <code>value</code>. For negative values of <code>days</code>, it returns a datetime that is <code>days</code> days before <code>value</code>.<br />
<br />
==addHours==<br />
:Syntax<br />
::<code>addHours(''datetime'' value, ''integer'' hours)</code><br />
:Returns<br />
::Returns a datetime that is <code>hours</code> hours after the <code>value</code>. For negative values of <code>hours</code>, it returns a datetime that is <code>hours</code> hours before <code>value</code>.<br />
<br />
==addMinutes==<br />
:Syntax<br />
::<code>addMinutes(''datetime'' value, ''integer'' minutes)</code><br />
:Returns<br />
::Returns a datetime that is <code>minutes</code> minutes after the <code>value</code>. For negative values of <code>minutes</code>, it returns a datetime that is <code>minutes</code> minutes before <code>value</code>.<br />
<br />
==addSeconds==<br />
:Syntax<br />
::<code>addSeconds(''datetime'' value, ''integer'' seconds)</code><br />
:Returns<br />
::Returns a datetime that is <code>seconds</code> seconds after the <code>value</code>. For negative values of <code>seconds</code>, it returns a datetime that is <code>seconds</code> seconds before <code>value</code>.<br />
<br />
==addWeeks==<br />
:Syntax<br />
::<code>addWeeks(''datetime'' value, ''integer'' weeks)</code><br />
:Returns<br />
::Returns a datetime that is <code>weeks</code> weeks after the <code>value</code>. For negative values of <code>weeks</code>, it returns a datetime that is <code>weeks</code> weeks before <code>value</code>.<br />
<br />
==date==<br />
:Syntax<br />
::<code>date(''datetime'' value)</code><br />
:Returns<br />
::Returns the date portion of <code>value</code> by stripping off time information.<br />
<br />
==datetime==<br />
:Syntax<br />
::<code>''datetime'' datetime(''dynamic'' value)</code><br />
:Returns<br />
::Tries to convert any value into a datetime. Accepts strings in common date/time formats.<br />
<br />
<br />
==formatDuration==<br />
:Syntax<br />
::<code>''string'' formatDuration(''datetime'' value[, ''boolean'' friendly = false[, ''string'' granularity = 's'[, ''boolean'' showAdverbs = false]]])</code><br />
:Arguments<br />
::<code>friendly</code> - <code>false</code> makes the output compact, in the form of <code>0d 00:00:00.000</code>, while <code>true</code> makes the output more human friendly, in the form of <code> 0 days, 0 hours, 0 minutes, and 0 seconds</code>. Defaults to <code>false</code>.<br />
::<code>granularity</code> - represents the smallest time unit to be output. One of <code>d</code> for days, <code>h</code> for hours, <code>m</code> for minutes, <code>s</code> for seconds, or <code>ms</code> for milliseconds. Any time unit below the selected granularity will not be output. Defaults to <code>s</code><br />
::<code>showAdverbs</code> - only affects the friendly output, when <code>true</code> the words <code>in</code> (for future durations - positive input) or <code>ago</code> (for past durations - negative input) are prepended or appended respectively to the output<br />
:Returns<br />
::Returns a string that represents the duration in a human readable format<br />
:Examples<br />
::<code>formatDuration(12029)</code> will output <code>00:00:12</code><br />
::<code>formatDuration(68493, true)</code> will output <code>1 minute and 8 seconds</code><br />
::<code>formatDuration(68493, false, 'ms')</code> will output <code>00:01:08</code><br />
::<code>formatDuration(68493, true, 'm', true)</code> will output <code>in 1 minute</code><br />
<br />
==time==<br />
:Syntax<br />
::<code>''time'' time(''datetime'' value)</code><br />
:Returns<br />
::Returns the time portion of <code>value</code> by stripping off date information.<br />
<br />
<br />
<br />
=Weather related functions=<br />
<br />
==celsius==<br />
:Syntax<br />
::<code>''decimal'' celsius(''decimal'' value)</code><br />
:Returns<br />
::Converts a temperature value from Fahrenheit to Celsius.<br />
<br />
==dewPoint==<br />
:Syntax<br />
::<code>''decimal'' dewPoint(''decimal'' temperature, ''decimal'' relativeHumidity[, ''string'' scale = 'F'])</code><br />
:Parameters<br />
::<code>scale</code> - optional, one of <code>C</code> or <code>F</code>, corresponding to the temperature range used for <code>temperature</code>. The result will be provided in the same scale. If no scale is provided, the Fahrenheit scale will be used.<br />
:Returns<br />
::Returns the due temperature for a given temperature and relative humidity<br />
<br />
==fahrenheit==<br />
:Syntax<br />
::<code>''decimal'' fahrenheit(''decimal'' value)</code><br />
:Returns<br />
::Converts a temperature value from Celsius to Fahrenheit.<br />
<br />
<br />
<br />
= [[Variable_data_types#Dynamic|Dynamic]] =<br />
;if(condition, valueIfTrue, valueIfFalse)<br />
:evaluates a boolean and returns value1 if true, or value2 otherwise<br />
;least(values)<br />
:returns the value that is least found a series of numeric values<br />
;most(values)<br />
:returns the value that is most found a series of numeric values<br />
;previousValue([device;attribute])<br />
:returns the previous value of the attribute<br />
<br />
= [[Variable_data_types#Number_.28Integer.29|Integers]] =<br />
;age([device﹕attribute])<br />
:returns the number of milliseconds an attribute had the current value<br />
;count(values)<br />
:calculates the number of true/non-zero/non-empty items in a series of numeric values<br />
;int()<br />
://todo<br />
;integer(decimal or string)<br />
:converts a decimal value to it's integer value<br />
;newer([device﹕attribute],[...], [device﹕attribute], threshold)<br />
:returns the number of devices whose attribute had the current value for less than the specified number of milliseconds<br />
;older([device﹕attribute],[...], [device﹕attribute], threshold)<br />
:returns the number of devices whose attribute had the current value for more than the specified number of milliseconds<br />
;previousAge([device﹕attribute])<br />
:returns the number of milliseconds an attribute had the previous value<br />
<br />
= [[Variable_data_types#Time|Time]] =<br />
;time(value)<br />
:returns the value as a time type<br />
;addSeconds(dateTime, seconds)<br />
:adds seconds to time, returns the value as a time type<br />
;addMinutes(dateTime, minutes)<br />
:adds minutes to time, returns the value as a time type<br />
;addHours(dateTime, hours)<br />
:adds hours to time, returns the value as a time type<br />
;addDays(dateTime, days)<br />
:adds days to time, returns the value as a time type<br />
;addWeeks(dateTime, weeks)<br />
:adds weeks to time, returns the value as a time type</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Functions&diff=475Functions2017-05-28T13:24:33Z<p>Whoismoses: /* random */</p>
<hr />
<div><div style="float: left; clear: both; margin-right: 1em; margin-bottom: 1em;">__TOC__</div><br />
Functions are extensions to expressions that allow data processing and conversion. Here is a list of all defined functions<br />
<br />
<br />
=[[Variable_data_types#String|String]] functions=<br />
<br />
==concat==<br />
:Syntax<br />
::<code>''string'' concat(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns a string that is the concatenation of all the supplied values. This function accepts two or more input values.<br />
<br />
==contains==<br />
:Syntax<br />
::<code>''boolean'' contains(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if the <code>needle</code> is found anywhere in the <code>haystack</code><br />
<br />
==endsWith==<br />
:Syntax<br />
::<code>''boolean'' endsWith(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if <code>haystack</code> ends with the <code>needle</code><br />
<br />
==format==<br />
[[File:Format.pdf|page=1|thumb|256px|A very nice article written by Professor Don Colton, at the Brigham Young University of Hawaii]]<br />
:Syntax<br />
::<code>''string'' format(''string'' formatString[, ''dynamic'' value1[, .., ''dynamic'' valueN]])</code><br />
:Returns<br />
::Returns a string that is built based on the <code>formatString</code> with arguments replaced by their corresponding values. Follows the java syntax for <code>printf()</code>. See a quick reference [https://www.cs.colostate.edu/~cs160/.Summer16/resources/Java_printf_method_quick_reference.pdf here], or a more detailed reference [https://sharkysoft.com/archive/printf/docs/javadocs/lava/clib/stdio/doc-files/specification.htm Reference here].<br />
::Each % in the format string represents an argument and corresponds to a value (in order of appearance) in the value list. Each argument can have formatting settings, according to the reference provided. <br />
:Example<br />
::<code>format('The temperature outside is %.2f degrees Fahrenheit', [Temp sensor:temperature])</code> outputs <code>The temperature outside is 71.26 degrees Fahrenheit</code><br />
::The <code>%.2f</code> translates to "format as <code>f</code>loat and use <code>.2</code> decimal places.<br />
<br />
==indexOf==<br />
:Syntax<br />
::<code>''integer'' indexOf(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns the character index of the first occurrence of <code>needle</code> inside <code>haystack</code><br />
:Examples<br />
::<code>indexOf("hello world", 'l')</code> outputs <code>2</code><br />
<br />
==lastIndexOf==<br />
:Syntax<br />
::<code>''integer'' lastIndexOf(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns the character index of the last occurrence of <code>needle</code> inside <code>haystack</code><br />
:Examples<br />
::<code>lastIndexOf("hello world", 'l')</code> outputs <code>9</code><br />
<br />
==left==<br />
:Syntax<br />
::<code>''string'' left(''string'' value, ''integer'' length)</code><br />
:Returns<br />
::Returns the first <code>length</code> characters in <code>value</code><br />
:Examples<br />
::<code>left("hello world", 2)</code> outputs <code>he</code><br />
<br />
==lower==<br />
:Syntax<br />
::<code>''string'' lower(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but with all lower case letters.<br />
:Examples<br />
::<code>lower("Hello World")</code> outputs <code>hello world</code><br />
<br />
==mid==<br />
:Syntax<br />
::<code>''string'' mid(''string'' value, ''integer'' start[, ''integer'' count = remaining])</code><br />
:Arguments<br />
::<code>start</code> - provides the 0-based index of the first character to copy. If <code>start</code> is negative, the counting starts from the end of <code>value</code>.<br />
::<code>count</code> - provides the number of characters to copy from <code>value</code>. If not provided, all of the remaining characters from <code>value</code> are returned, starting with character number <code>start</code>. If <code>count</code> is negative, prior characters are returned.<br />
:Returns<br />
::Returns a substring of <code>value</code>, <code>count</code> characters long, starting at character number <code>start</code>. Note that the first character in any string has index 0.<br />
:Examples<br />
::<code>mid("Hello World", 2, 3)</code> outputs <code>llo</code><br />
::<code>mid("Hello World", 2)</code> outputs <code>llo World</code><br />
::<code>mid("Hello World", -5, 2)</code> outputs <code>Wo</code><br />
::<code>mid("Hello World", -1, -3)</code> outputs <code>orl</code><br />
<br />
==random==<br />
:Syntax<br />
::<code>''dynamic'' random([''integer'' range | ''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN]])</code><br />
:Arguments<br />
::<code>range</code> - an integer number representing a range<br />
::<code>value1</code>..<code>valueN</code> - any kind of arguments, one will be randomly returned<br />
:Returns<br />
::Returns a random decimal number between <code>0</code> and <code>1</code> if no arguments are provided, or a number between <code>0</code> and <code>range</code> (inclusive) if a single argument is provided, or a randomly selected argument if two or more arguments are provided.<br />
:Examples<br />
::<code>random()</code> outputs <code>0.483</code> (random decimal)<br />
::<code>random(20)</code> outputs <code>6</code> (random integer)<br />
::<code>random("Hello World", "Good morning", "Hello", "Hi")</code> outputs <code>Hello</code> (randomly selected value)<br />
:Tips<br />
::To output a random integer between 5 and 20 use <code>(5 + random(15))</code><br />
::To output a random integer between -5 and 20 use <code>(-5 + random(25))</code><br />
<br />
==replace==<br />
:Syntax<br />
::<code>''string'' replace(''string'' haystack, ''string'' needle1, ''string'' replacement1[, .., ''string'' needleN, ''string'' replacementN])</code><br />
:Returns<br />
::Replaces all the occurrences of <code>needle</code> inside <code>haystack</code> with its respective <code>replacement</code>. Multiple pairs of <code>needle</code>/<code>replacement</code> can be provided in one function call.<br />
:Regular expressions<br />
::Needles support regular expressions when their value starts and ends with a <code>/</code>. For example, <code>'/(\s)/'</code> will match all spaces.<br />
:Examples<br />
::<code>replace("Hello World", 'World', 'Earth')</code> outputs <code>Hello Earth</code><br />
::<code>replace("Hello World", 'World', 'Earth', 'Hello', 'Hi')</code> outputs <code>Hi Earth</code><br />
::<code>replace("Hello World", 'World', 'Earth', 'Earth', 'Planet')</code> outputs <code>Hello Planet</code><br />
<br />
==right==<br />
:Syntax<br />
::<code>''string'' right(''string'' value, ''integer'' length)</code><br />
:Returns<br />
::Returns the last <code>length</code> characters in <code>value</code><br />
:Examples<br />
::<code>right("hello world", 4)</code> outputs <code>orld</code><br />
<br />
==startsWith==<br />
:Syntax<br />
::<code>''boolean'' startsWith(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if <code>haystack</code> starts with the <code>needle</code><br />
<br />
==string==<br />
:Syntax<br />
::<code>''string'' string(''dynamic'' value)</code><br />
:Returns<br />
::Returns <code>value</code> as a string.<br />
<br />
==substr==<br />
:Alias of <code>mid()</code><br />
<br />
==substring==<br />
:Alias of <code>mid()</code><br />
<br />
==title==<br />
:Syntax<br />
::<code>''string'' title(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but in its title case format (each word starts with a capitalized letter).<br />
:Examples<br />
::<code>lower("Hello there world")</code> outputs <code>Hello There World</code><br />
<br />
==upper==<br />
:Syntax<br />
::<code>''string'' upper(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but with all upper case letters.<br />
:Examples<br />
::<code>lower("Hello World")</code> outputs <code>HELLO WORLD</code><br />
<br />
==text==<br />
:Alias of <code>string()</code><br />
<br />
=Numeric functions=<br />
<br />
==avg==<br />
:Syntax<br />
::<code>''decimal'' avg(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the mean average of all the values provided.<br />
<br />
==ceil==<br />
:Syntax<br />
::<code>''integer'' ceil(''decimal'' value)</code><br />
:Returns<br />
::Returns the immediately higher integer, equivalent to rounding the decimal away from zero.<br />
:Examples<br />
::<code>ceil(5.6)</code> outputs <code>6</code><br />
::<code>ceil(-5.6)</code> outputs <code>-6</code><br />
<br />
==ceiling==<br />
:Alias of <code>ceil</code><br />
<br />
==decimal==<br />
:Syntax<br />
::<code>''decimal'' decimal(''dynamic'' value)</code><br />
:Returns<br />
::Converts <code>value</code> into a decimal. Returns <code>0</code> if <code>value</code> is not numeric.<br />
<br />
==float==<br />
:Alias of <code>decimal</code><br />
<br />
==floor==<br />
:Syntax<br />
::<code>''integer'' ceil(''decimal'' value)</code><br />
:Returns<br />
::Returns the integer part of a decimal, equivalent to rounding the decimal towards zero.<br />
:Examples<br />
::<code>floor(5.6)</code> outputs <code>5</code><br />
::<code>floor(-5.6)</code> outputs <code>-5</code><br />
<br />
==max==<br />
:Syntax<br />
::<code>''dynamic'' max(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the maximum of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==median==<br />
:Syntax<br />
::<code>''dynamic'' median(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the median average of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==min==<br />
:Syntax<br />
::<code>''dynamic'' min(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the minimum of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==number==<br />
:Alias of <code>decimal</code><br />
<br />
==power==<br />
:Syntax<br />
::<code>''decimal'' power(''decimal'' value, ''decimal'' exponent)</code><br />
:Returns<br />
::Returns the <code>value</code> at the power of <code>exponent</code><br />
<br />
==round==<br />
:Syntax<br />
::<code>''decimal'' round(''decimal'' value[, ''integer'' precision = 0])</code><br />
:Arguments<br />
::<code>precision</code> - the number of decimal places to be retained. If not provided, defaults to <code>0</code><br />
:Returns<br />
::Returns the rounded <code>value</code> with <code>precision</code> decimal places.<br />
<br />
==sqr==<br />
:Syntax<br />
::<code>''decimal'' sqr(''decimal'' value)</code><br />
:Returns<br />
::Returns the squared <code>value</code>, equivalent to <code>value</code> multiplied by itself.<br />
<br />
==sqrt==<br />
:Syntax<br />
::<code>''decimal'' sqrt(''decimal'' value)</code><br />
:Returns<br />
::Returns the square root of <code>value</code>.<br />
<br />
==stdev==<br />
:Syntax<br />
::<code>''decimal'' stdev(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the standard deviation of all the values provided.<br />
<br />
==sum==<br />
:Syntax<br />
::<code>''decimal'' sum(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the sum of sum of all the values provided.<br />
<br />
==variance==<br />
:Syntax<br />
::<code>''decimal'' variance(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the variance of all the values provided.<br />
<br />
=[[Variable_data_types#Boolean|Boolean]] functions=<br />
<br />
==bool==<br />
:Syntax<br />
::<code>bool(''dynamic'' value)</code><br />
:Returns<br />
::Returns the truth value of the input. Accepts anything as input and will return true if <code>value</code> is either a non-zero number, a non-empty string (with some exceptions, see below), a non-empty device list, a non-empty date/time/datetime<br />
<br />
==boolean==<br />
:This is an alias of [[Functions#bool|bool]]<br />
<br />
==eq==<br />
:Syntax<br />
::<code>eq(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is equivalent to <code>value2</code><br />
<br />
==ge==<br />
:Syntax<br />
::<code>ge(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is greater than or equal to <code>value2</code><br />
<br />
==gt==<br />
:Syntax<br />
::<code>gt(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is greater than <code>value2</code><br />
<br />
==isBetween==<br />
:Syntax<br />
::<code>isBetween(''dynamic'' value, ''dynamic'' startValue, ''dynamic'' endValue)</code><br />
:Returns<br />
::Returns true if <code>value</code> is greater then or equal to <code>startValue</code> and less than or equal to <code>endValue</code><br />
<br />
==isEmpty==<br />
:Syntax<br />
::<code>isEmpty(''dynamic'' value)</code><br />
:Returns<br />
::Returns true if <code>value</code> is not set, an empty string, or zero<br />
<br />
==le==<br />
:Syntax<br />
::<code>le(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is less than or equal to <code>value2</code><br />
<br />
==lt==<br />
:Syntax<br />
::<code>lt(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is less than <code>value2</code><br />
<br />
==not==<br />
:Syntax<br />
::<code>not(''dynamic'' value)</code><br />
:Returns<br />
::Returns the negated truth state of <code>value</code>. This is the logical negation of <code>[[Functions#bool|bool]](''dynamic'' value)</code>.<br />
<br />
=[[Variable_data_types#Date_and_Time|Date and time]] functions=<br />
<br />
==addDays==<br />
:Syntax<br />
::<code>addDays(''datetime'' value, ''integer'' days)</code><br />
:Returns<br />
::Returns a datetime that is <code>days</code> days after the <code>value</code>. For negative values of <code>days</code>, it returns a datetime that is <code>days</code> days before <code>value</code>.<br />
<br />
==addHours==<br />
:Syntax<br />
::<code>addHours(''datetime'' value, ''integer'' hours)</code><br />
:Returns<br />
::Returns a datetime that is <code>hours</code> hours after the <code>value</code>. For negative values of <code>hours</code>, it returns a datetime that is <code>hours</code> hours before <code>value</code>.<br />
<br />
==addMinutes==<br />
:Syntax<br />
::<code>addMinutes(''datetime'' value, ''integer'' minutes)</code><br />
:Returns<br />
::Returns a datetime that is <code>minutes</code> minutes after the <code>value</code>. For negative values of <code>minutes</code>, it returns a datetime that is <code>minutes</code> minutes before <code>value</code>.<br />
<br />
==addSeconds==<br />
:Syntax<br />
::<code>addSeconds(''datetime'' value, ''integer'' seconds)</code><br />
:Returns<br />
::Returns a datetime that is <code>seconds</code> seconds after the <code>value</code>. For negative values of <code>seconds</code>, it returns a datetime that is <code>seconds</code> seconds before <code>value</code>.<br />
<br />
==addWeeks==<br />
:Syntax<br />
::<code>addWeeks(''datetime'' value, ''integer'' weeks)</code><br />
:Returns<br />
::Returns a datetime that is <code>weeks</code> weeks after the <code>value</code>. For negative values of <code>weeks</code>, it returns a datetime that is <code>weeks</code> weeks before <code>value</code>.<br />
<br />
==date==<br />
:Syntax<br />
::<code>date(''datetime'' value)</code><br />
:Returns<br />
::Returns the date portion of <code>value</code> by stripping off time information.<br />
<br />
==datetime==<br />
:Syntax<br />
::<code>''datetime'' datetime(''dynamic'' value)</code><br />
:Returns<br />
::Tries to convert any value into a datetime. Accepts strings in common date/time formats.<br />
<br />
<br />
==formatDuration==<br />
:Syntax<br />
::<code>''string'' formatDuration(''datetime'' value[, ''boolean'' friendly = false[, ''string'' granularity = 's'[, ''boolean'' showAdverbs = false]]])</code><br />
:Arguments<br />
::<code>friendly</code> - <code>false</code> makes the output compact, in the form of <code>0d 00:00:00.000</code>, while <code>true</code> makes the output more human friendly, in the form of <code> 0 days, 0 hours, 0 minutes, and 0 seconds</code>. Defaults to <code>false</code>.<br />
::<code>granularity</code> - represents the smallest time unit to be output. One of <code>d</code> for days, <code>h</code> for hours, <code>m</code> for minutes, <code>s</code> for seconds, or <code>ms</code> for milliseconds. Any time unit below the selected granularity will not be output. Defaults to <code>s</code><br />
::<code>showAdverbs</code> - only affects the friendly output, when <code>true</code> the words <code>in</code> (for future durations - positive input) or <code>ago</code> (for past durations - negative input) are prepended or appended respectively to the output<br />
:Returns<br />
::Returns a string that represents the duration in a human readable format<br />
:Examples<br />
::<code>formatDuration(12029)</code> will output <code>00:00:12</code><br />
::<code>formatDuration(68493, true)</code> will output <code>1 minute and 8 seconds</code><br />
::<code>formatDuration(68493, false, 'ms')</code> will output <code>00:01:08</code><br />
::<code>formatDuration(68493, true, 'm', true)</code> will output <code>in 1 minute</code><br />
<br />
==time==<br />
:Syntax<br />
::<code>''time'' time(''datetime'' value)</code><br />
:Returns<br />
::Returns the time portion of <code>value</code> by stripping off date information.<br />
<br />
<br />
<br />
=Weather related functions=<br />
<br />
==celsius==<br />
:Syntax<br />
::<code>''decimal'' celsius(''decimal'' value)</code><br />
:Returns<br />
::Converts a temperature value from Fahrenheit to Celsius.<br />
<br />
==dewPoint==<br />
:Syntax<br />
::<code>''decimal'' dewPoint(''decimal'' temperature, ''decimal'' relativeHumidity[, ''string'' scale = 'F'])</code><br />
:Parameters<br />
::<code>scale</code> - optional, one of <code>C</code> or <code>F</code>, corresponding to the temperature range used for <code>temperature</code>. The result will be provided in the same scale. If no scale is provided, the Fahrenheit scale will be used.<br />
:Returns<br />
::Returns the due temperature for a given temperature and relative humidity<br />
<br />
==fahrenheit==<br />
:Syntax<br />
::<code>''decimal'' fahrenheit(''decimal'' value)</code><br />
:Returns<br />
::Converts a temperature value from Celsius to Fahrenheit.<br />
<br />
<br />
<br />
= [[Variable_data_types#Dynamic|Dynamic]] =<br />
;if(condition, valueIfTrue, valueIfFalse)<br />
:evaluates a boolean and returns value1 if true, or value2 otherwise<br />
;least(values)<br />
:returns the value that is least found a series of numeric values<br />
;most(values)<br />
:returns the value that is most found a series of numeric values<br />
;previousValue([device;attribute])<br />
:returns the previous value of the attribute<br />
<br />
= [[Variable_data_types#Number_.28Integer.29|Integers]] =<br />
;age([device﹕attribute])<br />
:returns the number of milliseconds an attribute had the current value<br />
;count(values)<br />
:calculates the number of true/non-zero/non-empty items in a series of numeric values<br />
;int()<br />
://todo<br />
;integer(decimal or string)<br />
:converts a decimal value to it's integer value<br />
;newer([device﹕attribute],[...], [device﹕attribute], threshold)<br />
:returns the number of devices whose attribute had the current value for less than the specified number of milliseconds<br />
;older([device﹕attribute],[...], [device﹕attribute], threshold)<br />
:returns the number of devices whose attribute had the current value for more than the specified number of milliseconds<br />
;previousAge([device﹕attribute])<br />
:returns the number of milliseconds an attribute had the previous value<br />
<br />
= [[Variable_data_types#Time|Time]] =<br />
;time(value)<br />
:returns the value as a time type<br />
;addSeconds(dateTime, seconds)<br />
:adds seconds to time, returns the value as a time type<br />
;addMinutes(dateTime, minutes)<br />
:adds minutes to time, returns the value as a time type<br />
;addHours(dateTime, hours)<br />
:adds hours to time, returns the value as a time type<br />
;addDays(dateTime, days)<br />
:adds days to time, returns the value as a time type<br />
;addWeeks(dateTime, weeks)<br />
:adds weeks to time, returns the value as a time type</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Functions&diff=474Functions2017-05-28T13:24:12Z<p>Whoismoses: /* random */</p>
<hr />
<div><div style="float: left; clear: both; margin-right: 1em; margin-bottom: 1em;">__TOC__</div><br />
Functions are extensions to expressions that allow data processing and conversion. Here is a list of all defined functions<br />
<br />
<br />
=[[Variable_data_types#String|String]] functions=<br />
<br />
==concat==<br />
:Syntax<br />
::<code>''string'' concat(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns a string that is the concatenation of all the supplied values. This function accepts two or more input values.<br />
<br />
==contains==<br />
:Syntax<br />
::<code>''boolean'' contains(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if the <code>needle</code> is found anywhere in the <code>haystack</code><br />
<br />
==endsWith==<br />
:Syntax<br />
::<code>''boolean'' endsWith(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if <code>haystack</code> ends with the <code>needle</code><br />
<br />
==format==<br />
[[File:Format.pdf|page=1|thumb|256px|A very nice article written by Professor Don Colton, at the Brigham Young University of Hawaii]]<br />
:Syntax<br />
::<code>''string'' format(''string'' formatString[, ''dynamic'' value1[, .., ''dynamic'' valueN]])</code><br />
:Returns<br />
::Returns a string that is built based on the <code>formatString</code> with arguments replaced by their corresponding values. Follows the java syntax for <code>printf()</code>. See a quick reference [https://www.cs.colostate.edu/~cs160/.Summer16/resources/Java_printf_method_quick_reference.pdf here], or a more detailed reference [https://sharkysoft.com/archive/printf/docs/javadocs/lava/clib/stdio/doc-files/specification.htm Reference here].<br />
::Each % in the format string represents an argument and corresponds to a value (in order of appearance) in the value list. Each argument can have formatting settings, according to the reference provided. <br />
:Example<br />
::<code>format('The temperature outside is %.2f degrees Fahrenheit', [Temp sensor:temperature])</code> outputs <code>The temperature outside is 71.26 degrees Fahrenheit</code><br />
::The <code>%.2f</code> translates to "format as <code>f</code>loat and use <code>.2</code> decimal places.<br />
<br />
==indexOf==<br />
:Syntax<br />
::<code>''integer'' indexOf(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns the character index of the first occurrence of <code>needle</code> inside <code>haystack</code><br />
:Examples<br />
::<code>indexOf("hello world", 'l')</code> outputs <code>2</code><br />
<br />
==lastIndexOf==<br />
:Syntax<br />
::<code>''integer'' lastIndexOf(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns the character index of the last occurrence of <code>needle</code> inside <code>haystack</code><br />
:Examples<br />
::<code>lastIndexOf("hello world", 'l')</code> outputs <code>9</code><br />
<br />
==left==<br />
:Syntax<br />
::<code>''string'' left(''string'' value, ''integer'' length)</code><br />
:Returns<br />
::Returns the first <code>length</code> characters in <code>value</code><br />
:Examples<br />
::<code>left("hello world", 2)</code> outputs <code>he</code><br />
<br />
==lower==<br />
:Syntax<br />
::<code>''string'' lower(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but with all lower case letters.<br />
:Examples<br />
::<code>lower("Hello World")</code> outputs <code>hello world</code><br />
<br />
==mid==<br />
:Syntax<br />
::<code>''string'' mid(''string'' value, ''integer'' start[, ''integer'' count = remaining])</code><br />
:Arguments<br />
::<code>start</code> - provides the 0-based index of the first character to copy. If <code>start</code> is negative, the counting starts from the end of <code>value</code>.<br />
::<code>count</code> - provides the number of characters to copy from <code>value</code>. If not provided, all of the remaining characters from <code>value</code> are returned, starting with character number <code>start</code>. If <code>count</code> is negative, prior characters are returned.<br />
:Returns<br />
::Returns a substring of <code>value</code>, <code>count</code> characters long, starting at character number <code>start</code>. Note that the first character in any string has index 0.<br />
:Examples<br />
::<code>mid("Hello World", 2, 3)</code> outputs <code>llo</code><br />
::<code>mid("Hello World", 2)</code> outputs <code>llo World</code><br />
::<code>mid("Hello World", -5, 2)</code> outputs <code>Wo</code><br />
::<code>mid("Hello World", -1, -3)</code> outputs <code>orl</code><br />
<br />
==random==<br />
:Syntax<br />
::<code>''dynamic'' random([''integer'' range | ''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN]])</code><br />
:Arguments<br />
::<code>range</code> - an integer number representing a range<br />
::<code>value1</code>..<code>valueN</code> - any kind of arguments, one will be randomly returned<br />
:Returns<br />
::Returns a random decimal number between <code>0</code> and <code>1</code> if no arguments are provided, or a number between <code>0</code> and <code>range</code> (inclusive) if a single argument is provided, or a randomly selected argument if two or more arguments are provided.<br />
:Examples<br />
::<code>random()</code> outputs <code>0.483</code> (random decimal)<br />
::<code>random(20)</code> outputs <code>6</code> (random integer)<br />
::<code>random("Hello World", "Good morning", "Hello", "Hi")</code> outputs <code>Hello</code> (randomly selected value)<br />
:Tips<br />
::To output a random integer between 5 and 20 use <code>(5 + random(15))</code><br />
::To output a random integer between -5 and 20 use <code>(-5 + random(20))</code><br />
<br />
==replace==<br />
:Syntax<br />
::<code>''string'' replace(''string'' haystack, ''string'' needle1, ''string'' replacement1[, .., ''string'' needleN, ''string'' replacementN])</code><br />
:Returns<br />
::Replaces all the occurrences of <code>needle</code> inside <code>haystack</code> with its respective <code>replacement</code>. Multiple pairs of <code>needle</code>/<code>replacement</code> can be provided in one function call.<br />
:Regular expressions<br />
::Needles support regular expressions when their value starts and ends with a <code>/</code>. For example, <code>'/(\s)/'</code> will match all spaces.<br />
:Examples<br />
::<code>replace("Hello World", 'World', 'Earth')</code> outputs <code>Hello Earth</code><br />
::<code>replace("Hello World", 'World', 'Earth', 'Hello', 'Hi')</code> outputs <code>Hi Earth</code><br />
::<code>replace("Hello World", 'World', 'Earth', 'Earth', 'Planet')</code> outputs <code>Hello Planet</code><br />
<br />
==right==<br />
:Syntax<br />
::<code>''string'' right(''string'' value, ''integer'' length)</code><br />
:Returns<br />
::Returns the last <code>length</code> characters in <code>value</code><br />
:Examples<br />
::<code>right("hello world", 4)</code> outputs <code>orld</code><br />
<br />
==startsWith==<br />
:Syntax<br />
::<code>''boolean'' startsWith(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if <code>haystack</code> starts with the <code>needle</code><br />
<br />
==string==<br />
:Syntax<br />
::<code>''string'' string(''dynamic'' value)</code><br />
:Returns<br />
::Returns <code>value</code> as a string.<br />
<br />
==substr==<br />
:Alias of <code>mid()</code><br />
<br />
==substring==<br />
:Alias of <code>mid()</code><br />
<br />
==title==<br />
:Syntax<br />
::<code>''string'' title(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but in its title case format (each word starts with a capitalized letter).<br />
:Examples<br />
::<code>lower("Hello there world")</code> outputs <code>Hello There World</code><br />
<br />
==upper==<br />
:Syntax<br />
::<code>''string'' upper(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but with all upper case letters.<br />
:Examples<br />
::<code>lower("Hello World")</code> outputs <code>HELLO WORLD</code><br />
<br />
==text==<br />
:Alias of <code>string()</code><br />
<br />
=Numeric functions=<br />
<br />
==avg==<br />
:Syntax<br />
::<code>''decimal'' avg(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the mean average of all the values provided.<br />
<br />
==ceil==<br />
:Syntax<br />
::<code>''integer'' ceil(''decimal'' value)</code><br />
:Returns<br />
::Returns the immediately higher integer, equivalent to rounding the decimal away from zero.<br />
:Examples<br />
::<code>ceil(5.6)</code> outputs <code>6</code><br />
::<code>ceil(-5.6)</code> outputs <code>-6</code><br />
<br />
==ceiling==<br />
:Alias of <code>ceil</code><br />
<br />
==decimal==<br />
:Syntax<br />
::<code>''decimal'' decimal(''dynamic'' value)</code><br />
:Returns<br />
::Converts <code>value</code> into a decimal. Returns <code>0</code> if <code>value</code> is not numeric.<br />
<br />
==float==<br />
:Alias of <code>decimal</code><br />
<br />
==floor==<br />
:Syntax<br />
::<code>''integer'' ceil(''decimal'' value)</code><br />
:Returns<br />
::Returns the integer part of a decimal, equivalent to rounding the decimal towards zero.<br />
:Examples<br />
::<code>floor(5.6)</code> outputs <code>5</code><br />
::<code>floor(-5.6)</code> outputs <code>-5</code><br />
<br />
==max==<br />
:Syntax<br />
::<code>''dynamic'' max(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the maximum of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==median==<br />
:Syntax<br />
::<code>''dynamic'' median(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the median average of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==min==<br />
:Syntax<br />
::<code>''dynamic'' min(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the minimum of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==number==<br />
:Alias of <code>decimal</code><br />
<br />
==power==<br />
:Syntax<br />
::<code>''decimal'' power(''decimal'' value, ''decimal'' exponent)</code><br />
:Returns<br />
::Returns the <code>value</code> at the power of <code>exponent</code><br />
<br />
==round==<br />
:Syntax<br />
::<code>''decimal'' round(''decimal'' value[, ''integer'' precision = 0])</code><br />
:Arguments<br />
::<code>precision</code> - the number of decimal places to be retained. If not provided, defaults to <code>0</code><br />
:Returns<br />
::Returns the rounded <code>value</code> with <code>precision</code> decimal places.<br />
<br />
==sqr==<br />
:Syntax<br />
::<code>''decimal'' sqr(''decimal'' value)</code><br />
:Returns<br />
::Returns the squared <code>value</code>, equivalent to <code>value</code> multiplied by itself.<br />
<br />
==sqrt==<br />
:Syntax<br />
::<code>''decimal'' sqrt(''decimal'' value)</code><br />
:Returns<br />
::Returns the square root of <code>value</code>.<br />
<br />
==stdev==<br />
:Syntax<br />
::<code>''decimal'' stdev(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the standard deviation of all the values provided.<br />
<br />
==sum==<br />
:Syntax<br />
::<code>''decimal'' sum(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the sum of sum of all the values provided.<br />
<br />
==variance==<br />
:Syntax<br />
::<code>''decimal'' variance(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the variance of all the values provided.<br />
<br />
=[[Variable_data_types#Boolean|Boolean]] functions=<br />
<br />
==bool==<br />
:Syntax<br />
::<code>bool(''dynamic'' value)</code><br />
:Returns<br />
::Returns the truth value of the input. Accepts anything as input and will return true if <code>value</code> is either a non-zero number, a non-empty string (with some exceptions, see below), a non-empty device list, a non-empty date/time/datetime<br />
<br />
==boolean==<br />
:This is an alias of [[Functions#bool|bool]]<br />
<br />
==eq==<br />
:Syntax<br />
::<code>eq(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is equivalent to <code>value2</code><br />
<br />
==ge==<br />
:Syntax<br />
::<code>ge(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is greater than or equal to <code>value2</code><br />
<br />
==gt==<br />
:Syntax<br />
::<code>gt(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is greater than <code>value2</code><br />
<br />
==isBetween==<br />
:Syntax<br />
::<code>isBetween(''dynamic'' value, ''dynamic'' startValue, ''dynamic'' endValue)</code><br />
:Returns<br />
::Returns true if <code>value</code> is greater then or equal to <code>startValue</code> and less than or equal to <code>endValue</code><br />
<br />
==isEmpty==<br />
:Syntax<br />
::<code>isEmpty(''dynamic'' value)</code><br />
:Returns<br />
::Returns true if <code>value</code> is not set, an empty string, or zero<br />
<br />
==le==<br />
:Syntax<br />
::<code>le(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is less than or equal to <code>value2</code><br />
<br />
==lt==<br />
:Syntax<br />
::<code>lt(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is less than <code>value2</code><br />
<br />
==not==<br />
:Syntax<br />
::<code>not(''dynamic'' value)</code><br />
:Returns<br />
::Returns the negated truth state of <code>value</code>. This is the logical negation of <code>[[Functions#bool|bool]](''dynamic'' value)</code>.<br />
<br />
=[[Variable_data_types#Date_and_Time|Date and time]] functions=<br />
<br />
==addDays==<br />
:Syntax<br />
::<code>addDays(''datetime'' value, ''integer'' days)</code><br />
:Returns<br />
::Returns a datetime that is <code>days</code> days after the <code>value</code>. For negative values of <code>days</code>, it returns a datetime that is <code>days</code> days before <code>value</code>.<br />
<br />
==addHours==<br />
:Syntax<br />
::<code>addHours(''datetime'' value, ''integer'' hours)</code><br />
:Returns<br />
::Returns a datetime that is <code>hours</code> hours after the <code>value</code>. For negative values of <code>hours</code>, it returns a datetime that is <code>hours</code> hours before <code>value</code>.<br />
<br />
==addMinutes==<br />
:Syntax<br />
::<code>addMinutes(''datetime'' value, ''integer'' minutes)</code><br />
:Returns<br />
::Returns a datetime that is <code>minutes</code> minutes after the <code>value</code>. For negative values of <code>minutes</code>, it returns a datetime that is <code>minutes</code> minutes before <code>value</code>.<br />
<br />
==addSeconds==<br />
:Syntax<br />
::<code>addSeconds(''datetime'' value, ''integer'' seconds)</code><br />
:Returns<br />
::Returns a datetime that is <code>seconds</code> seconds after the <code>value</code>. For negative values of <code>seconds</code>, it returns a datetime that is <code>seconds</code> seconds before <code>value</code>.<br />
<br />
==addWeeks==<br />
:Syntax<br />
::<code>addWeeks(''datetime'' value, ''integer'' weeks)</code><br />
:Returns<br />
::Returns a datetime that is <code>weeks</code> weeks after the <code>value</code>. For negative values of <code>weeks</code>, it returns a datetime that is <code>weeks</code> weeks before <code>value</code>.<br />
<br />
==date==<br />
:Syntax<br />
::<code>date(''datetime'' value)</code><br />
:Returns<br />
::Returns the date portion of <code>value</code> by stripping off time information.<br />
<br />
==datetime==<br />
:Syntax<br />
::<code>''datetime'' datetime(''dynamic'' value)</code><br />
:Returns<br />
::Tries to convert any value into a datetime. Accepts strings in common date/time formats.<br />
<br />
<br />
==formatDuration==<br />
:Syntax<br />
::<code>''string'' formatDuration(''datetime'' value[, ''boolean'' friendly = false[, ''string'' granularity = 's'[, ''boolean'' showAdverbs = false]]])</code><br />
:Arguments<br />
::<code>friendly</code> - <code>false</code> makes the output compact, in the form of <code>0d 00:00:00.000</code>, while <code>true</code> makes the output more human friendly, in the form of <code> 0 days, 0 hours, 0 minutes, and 0 seconds</code>. Defaults to <code>false</code>.<br />
::<code>granularity</code> - represents the smallest time unit to be output. One of <code>d</code> for days, <code>h</code> for hours, <code>m</code> for minutes, <code>s</code> for seconds, or <code>ms</code> for milliseconds. Any time unit below the selected granularity will not be output. Defaults to <code>s</code><br />
::<code>showAdverbs</code> - only affects the friendly output, when <code>true</code> the words <code>in</code> (for future durations - positive input) or <code>ago</code> (for past durations - negative input) are prepended or appended respectively to the output<br />
:Returns<br />
::Returns a string that represents the duration in a human readable format<br />
:Examples<br />
::<code>formatDuration(12029)</code> will output <code>00:00:12</code><br />
::<code>formatDuration(68493, true)</code> will output <code>1 minute and 8 seconds</code><br />
::<code>formatDuration(68493, false, 'ms')</code> will output <code>00:01:08</code><br />
::<code>formatDuration(68493, true, 'm', true)</code> will output <code>in 1 minute</code><br />
<br />
==time==<br />
:Syntax<br />
::<code>''time'' time(''datetime'' value)</code><br />
:Returns<br />
::Returns the time portion of <code>value</code> by stripping off date information.<br />
<br />
<br />
<br />
=Weather related functions=<br />
<br />
==celsius==<br />
:Syntax<br />
::<code>''decimal'' celsius(''decimal'' value)</code><br />
:Returns<br />
::Converts a temperature value from Fahrenheit to Celsius.<br />
<br />
==dewPoint==<br />
:Syntax<br />
::<code>''decimal'' dewPoint(''decimal'' temperature, ''decimal'' relativeHumidity[, ''string'' scale = 'F'])</code><br />
:Parameters<br />
::<code>scale</code> - optional, one of <code>C</code> or <code>F</code>, corresponding to the temperature range used for <code>temperature</code>. The result will be provided in the same scale. If no scale is provided, the Fahrenheit scale will be used.<br />
:Returns<br />
::Returns the due temperature for a given temperature and relative humidity<br />
<br />
==fahrenheit==<br />
:Syntax<br />
::<code>''decimal'' fahrenheit(''decimal'' value)</code><br />
:Returns<br />
::Converts a temperature value from Celsius to Fahrenheit.<br />
<br />
<br />
<br />
= [[Variable_data_types#Dynamic|Dynamic]] =<br />
;if(condition, valueIfTrue, valueIfFalse)<br />
:evaluates a boolean and returns value1 if true, or value2 otherwise<br />
;least(values)<br />
:returns the value that is least found a series of numeric values<br />
;most(values)<br />
:returns the value that is most found a series of numeric values<br />
;previousValue([device;attribute])<br />
:returns the previous value of the attribute<br />
<br />
= [[Variable_data_types#Number_.28Integer.29|Integers]] =<br />
;age([device﹕attribute])<br />
:returns the number of milliseconds an attribute had the current value<br />
;count(values)<br />
:calculates the number of true/non-zero/non-empty items in a series of numeric values<br />
;int()<br />
://todo<br />
;integer(decimal or string)<br />
:converts a decimal value to it's integer value<br />
;newer([device﹕attribute],[...], [device﹕attribute], threshold)<br />
:returns the number of devices whose attribute had the current value for less than the specified number of milliseconds<br />
;older([device﹕attribute],[...], [device﹕attribute], threshold)<br />
:returns the number of devices whose attribute had the current value for more than the specified number of milliseconds<br />
;previousAge([device﹕attribute])<br />
:returns the number of milliseconds an attribute had the previous value<br />
<br />
= [[Variable_data_types#Time|Time]] =<br />
;time(value)<br />
:returns the value as a time type<br />
;addSeconds(dateTime, seconds)<br />
:adds seconds to time, returns the value as a time type<br />
;addMinutes(dateTime, minutes)<br />
:adds minutes to time, returns the value as a time type<br />
;addHours(dateTime, hours)<br />
:adds hours to time, returns the value as a time type<br />
;addDays(dateTime, days)<br />
:adds days to time, returns the value as a time type<br />
;addWeeks(dateTime, weeks)<br />
:adds weeks to time, returns the value as a time type</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Functions&diff=473Functions2017-05-28T13:23:08Z<p>Whoismoses: /* random */</p>
<hr />
<div><div style="float: left; clear: both; margin-right: 1em; margin-bottom: 1em;">__TOC__</div><br />
Functions are extensions to expressions that allow data processing and conversion. Here is a list of all defined functions<br />
<br />
<br />
=[[Variable_data_types#String|String]] functions=<br />
<br />
==concat==<br />
:Syntax<br />
::<code>''string'' concat(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns a string that is the concatenation of all the supplied values. This function accepts two or more input values.<br />
<br />
==contains==<br />
:Syntax<br />
::<code>''boolean'' contains(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if the <code>needle</code> is found anywhere in the <code>haystack</code><br />
<br />
==endsWith==<br />
:Syntax<br />
::<code>''boolean'' endsWith(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if <code>haystack</code> ends with the <code>needle</code><br />
<br />
==format==<br />
[[File:Format.pdf|page=1|thumb|256px|A very nice article written by Professor Don Colton, at the Brigham Young University of Hawaii]]<br />
:Syntax<br />
::<code>''string'' format(''string'' formatString[, ''dynamic'' value1[, .., ''dynamic'' valueN]])</code><br />
:Returns<br />
::Returns a string that is built based on the <code>formatString</code> with arguments replaced by their corresponding values. Follows the java syntax for <code>printf()</code>. See a quick reference [https://www.cs.colostate.edu/~cs160/.Summer16/resources/Java_printf_method_quick_reference.pdf here], or a more detailed reference [https://sharkysoft.com/archive/printf/docs/javadocs/lava/clib/stdio/doc-files/specification.htm Reference here].<br />
::Each % in the format string represents an argument and corresponds to a value (in order of appearance) in the value list. Each argument can have formatting settings, according to the reference provided. <br />
:Example<br />
::<code>format('The temperature outside is %.2f degrees Fahrenheit', [Temp sensor:temperature])</code> outputs <code>The temperature outside is 71.26 degrees Fahrenheit</code><br />
::The <code>%.2f</code> translates to "format as <code>f</code>loat and use <code>.2</code> decimal places.<br />
<br />
==indexOf==<br />
:Syntax<br />
::<code>''integer'' indexOf(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns the character index of the first occurrence of <code>needle</code> inside <code>haystack</code><br />
:Examples<br />
::<code>indexOf("hello world", 'l')</code> outputs <code>2</code><br />
<br />
==lastIndexOf==<br />
:Syntax<br />
::<code>''integer'' lastIndexOf(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns the character index of the last occurrence of <code>needle</code> inside <code>haystack</code><br />
:Examples<br />
::<code>lastIndexOf("hello world", 'l')</code> outputs <code>9</code><br />
<br />
==left==<br />
:Syntax<br />
::<code>''string'' left(''string'' value, ''integer'' length)</code><br />
:Returns<br />
::Returns the first <code>length</code> characters in <code>value</code><br />
:Examples<br />
::<code>left("hello world", 2)</code> outputs <code>he</code><br />
<br />
==lower==<br />
:Syntax<br />
::<code>''string'' lower(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but with all lower case letters.<br />
:Examples<br />
::<code>lower("Hello World")</code> outputs <code>hello world</code><br />
<br />
==mid==<br />
:Syntax<br />
::<code>''string'' mid(''string'' value, ''integer'' start[, ''integer'' count = remaining])</code><br />
:Arguments<br />
::<code>start</code> - provides the 0-based index of the first character to copy. If <code>start</code> is negative, the counting starts from the end of <code>value</code>.<br />
::<code>count</code> - provides the number of characters to copy from <code>value</code>. If not provided, all of the remaining characters from <code>value</code> are returned, starting with character number <code>start</code>. If <code>count</code> is negative, prior characters are returned.<br />
:Returns<br />
::Returns a substring of <code>value</code>, <code>count</code> characters long, starting at character number <code>start</code>. Note that the first character in any string has index 0.<br />
:Examples<br />
::<code>mid("Hello World", 2, 3)</code> outputs <code>llo</code><br />
::<code>mid("Hello World", 2)</code> outputs <code>llo World</code><br />
::<code>mid("Hello World", -5, 2)</code> outputs <code>Wo</code><br />
::<code>mid("Hello World", -1, -3)</code> outputs <code>orl</code><br />
<br />
==random==<br />
:Syntax<br />
::<code>''dynamic'' random([''integer'' range | ''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN]])</code><br />
:Arguments<br />
::<code>range</code> - an integer number representing a range<br />
::<code>value1</code>..<code>valueN</code> - any kind of arguments, one will be randomly returned<br />
:Returns<br />
::Returns a random decimal number between <code>0</code> and <code>1</code> if no arguments are provided, or a number between <code>0</code> and <code>range</code> (inclusive) if a single argument is provided, or a randomly selected argument if two or more arguments are provided.<br />
:Examples<br />
::<code>random()</code> outputs <code>0.483</code> (random decimal)<br />
::<code>random(20)</code> outputs <code>6</code> (random integer)<br />
::<code>random("Hello World", "Good morning", "Hello", "Hi")</code> outputs <code>Hello</code> (randomly selected value)<br />
:Tips<br />
::To output a random integer between 5 and 20 use <code>(5 + random(15))</code><br />
::To output a random integer between -5 and 20 use <code>(5 + random(15)) * if(random(1), 1, -1)</code><br />
<br />
==replace==<br />
:Syntax<br />
::<code>''string'' replace(''string'' haystack, ''string'' needle1, ''string'' replacement1[, .., ''string'' needleN, ''string'' replacementN])</code><br />
:Returns<br />
::Replaces all the occurrences of <code>needle</code> inside <code>haystack</code> with its respective <code>replacement</code>. Multiple pairs of <code>needle</code>/<code>replacement</code> can be provided in one function call.<br />
:Regular expressions<br />
::Needles support regular expressions when their value starts and ends with a <code>/</code>. For example, <code>'/(\s)/'</code> will match all spaces.<br />
:Examples<br />
::<code>replace("Hello World", 'World', 'Earth')</code> outputs <code>Hello Earth</code><br />
::<code>replace("Hello World", 'World', 'Earth', 'Hello', 'Hi')</code> outputs <code>Hi Earth</code><br />
::<code>replace("Hello World", 'World', 'Earth', 'Earth', 'Planet')</code> outputs <code>Hello Planet</code><br />
<br />
==right==<br />
:Syntax<br />
::<code>''string'' right(''string'' value, ''integer'' length)</code><br />
:Returns<br />
::Returns the last <code>length</code> characters in <code>value</code><br />
:Examples<br />
::<code>right("hello world", 4)</code> outputs <code>orld</code><br />
<br />
==startsWith==<br />
:Syntax<br />
::<code>''boolean'' startsWith(''string'' haystack, ''string'' needle)</code><br />
:Returns<br />
::Returns true if <code>haystack</code> starts with the <code>needle</code><br />
<br />
==string==<br />
:Syntax<br />
::<code>''string'' string(''dynamic'' value)</code><br />
:Returns<br />
::Returns <code>value</code> as a string.<br />
<br />
==substr==<br />
:Alias of <code>mid()</code><br />
<br />
==substring==<br />
:Alias of <code>mid()</code><br />
<br />
==title==<br />
:Syntax<br />
::<code>''string'' title(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but in its title case format (each word starts with a capitalized letter).<br />
:Examples<br />
::<code>lower("Hello there world")</code> outputs <code>Hello There World</code><br />
<br />
==upper==<br />
:Syntax<br />
::<code>''string'' upper(''string'' value)</code><br />
:Returns<br />
::Returns the <code>value</code> but with all upper case letters.<br />
:Examples<br />
::<code>lower("Hello World")</code> outputs <code>HELLO WORLD</code><br />
<br />
==text==<br />
:Alias of <code>string()</code><br />
<br />
=Numeric functions=<br />
<br />
==avg==<br />
:Syntax<br />
::<code>''decimal'' avg(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the mean average of all the values provided.<br />
<br />
==ceil==<br />
:Syntax<br />
::<code>''integer'' ceil(''decimal'' value)</code><br />
:Returns<br />
::Returns the immediately higher integer, equivalent to rounding the decimal away from zero.<br />
:Examples<br />
::<code>ceil(5.6)</code> outputs <code>6</code><br />
::<code>ceil(-5.6)</code> outputs <code>-6</code><br />
<br />
==ceiling==<br />
:Alias of <code>ceil</code><br />
<br />
==decimal==<br />
:Syntax<br />
::<code>''decimal'' decimal(''dynamic'' value)</code><br />
:Returns<br />
::Converts <code>value</code> into a decimal. Returns <code>0</code> if <code>value</code> is not numeric.<br />
<br />
==float==<br />
:Alias of <code>decimal</code><br />
<br />
==floor==<br />
:Syntax<br />
::<code>''integer'' ceil(''decimal'' value)</code><br />
:Returns<br />
::Returns the integer part of a decimal, equivalent to rounding the decimal towards zero.<br />
:Examples<br />
::<code>floor(5.6)</code> outputs <code>5</code><br />
::<code>floor(-5.6)</code> outputs <code>-5</code><br />
<br />
==max==<br />
:Syntax<br />
::<code>''dynamic'' max(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the maximum of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==median==<br />
:Syntax<br />
::<code>''dynamic'' median(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the median average of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==min==<br />
:Syntax<br />
::<code>''dynamic'' min(''dynamic'' value1, ''dynamic'' value2[, .., ''dynamic'' valueN])</code><br />
:Returns<br />
::Returns the minimum of all the values provided. Note: this function works with both numbers and strings.<br />
<br />
==number==<br />
:Alias of <code>decimal</code><br />
<br />
==power==<br />
:Syntax<br />
::<code>''decimal'' power(''decimal'' value, ''decimal'' exponent)</code><br />
:Returns<br />
::Returns the <code>value</code> at the power of <code>exponent</code><br />
<br />
==round==<br />
:Syntax<br />
::<code>''decimal'' round(''decimal'' value[, ''integer'' precision = 0])</code><br />
:Arguments<br />
::<code>precision</code> - the number of decimal places to be retained. If not provided, defaults to <code>0</code><br />
:Returns<br />
::Returns the rounded <code>value</code> with <code>precision</code> decimal places.<br />
<br />
==sqr==<br />
:Syntax<br />
::<code>''decimal'' sqr(''decimal'' value)</code><br />
:Returns<br />
::Returns the squared <code>value</code>, equivalent to <code>value</code> multiplied by itself.<br />
<br />
==sqrt==<br />
:Syntax<br />
::<code>''decimal'' sqrt(''decimal'' value)</code><br />
:Returns<br />
::Returns the square root of <code>value</code>.<br />
<br />
==stdev==<br />
:Syntax<br />
::<code>''decimal'' stdev(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the standard deviation of all the values provided.<br />
<br />
==sum==<br />
:Syntax<br />
::<code>''decimal'' sum(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the sum of sum of all the values provided.<br />
<br />
==variance==<br />
:Syntax<br />
::<code>''decimal'' variance(''decimal'' value1, ''decimal'' value2[, .., ''decimal'' valueN])</code><br />
:Returns<br />
::Returns the variance of all the values provided.<br />
<br />
=[[Variable_data_types#Boolean|Boolean]] functions=<br />
<br />
==bool==<br />
:Syntax<br />
::<code>bool(''dynamic'' value)</code><br />
:Returns<br />
::Returns the truth value of the input. Accepts anything as input and will return true if <code>value</code> is either a non-zero number, a non-empty string (with some exceptions, see below), a non-empty device list, a non-empty date/time/datetime<br />
<br />
==boolean==<br />
:This is an alias of [[Functions#bool|bool]]<br />
<br />
==eq==<br />
:Syntax<br />
::<code>eq(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is equivalent to <code>value2</code><br />
<br />
==ge==<br />
:Syntax<br />
::<code>ge(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is greater than or equal to <code>value2</code><br />
<br />
==gt==<br />
:Syntax<br />
::<code>gt(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is greater than <code>value2</code><br />
<br />
==isBetween==<br />
:Syntax<br />
::<code>isBetween(''dynamic'' value, ''dynamic'' startValue, ''dynamic'' endValue)</code><br />
:Returns<br />
::Returns true if <code>value</code> is greater then or equal to <code>startValue</code> and less than or equal to <code>endValue</code><br />
<br />
==isEmpty==<br />
:Syntax<br />
::<code>isEmpty(''dynamic'' value)</code><br />
:Returns<br />
::Returns true if <code>value</code> is not set, an empty string, or zero<br />
<br />
==le==<br />
:Syntax<br />
::<code>le(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is less than or equal to <code>value2</code><br />
<br />
==lt==<br />
:Syntax<br />
::<code>lt(''dynamic'' value1, ''dynamic'' value2)</code><br />
:Returns<br />
::Returns true if <code>value1</code> is less than <code>value2</code><br />
<br />
==not==<br />
:Syntax<br />
::<code>not(''dynamic'' value)</code><br />
:Returns<br />
::Returns the negated truth state of <code>value</code>. This is the logical negation of <code>[[Functions#bool|bool]](''dynamic'' value)</code>.<br />
<br />
=[[Variable_data_types#Date_and_Time|Date and time]] functions=<br />
<br />
==addDays==<br />
:Syntax<br />
::<code>addDays(''datetime'' value, ''integer'' days)</code><br />
:Returns<br />
::Returns a datetime that is <code>days</code> days after the <code>value</code>. For negative values of <code>days</code>, it returns a datetime that is <code>days</code> days before <code>value</code>.<br />
<br />
==addHours==<br />
:Syntax<br />
::<code>addHours(''datetime'' value, ''integer'' hours)</code><br />
:Returns<br />
::Returns a datetime that is <code>hours</code> hours after the <code>value</code>. For negative values of <code>hours</code>, it returns a datetime that is <code>hours</code> hours before <code>value</code>.<br />
<br />
==addMinutes==<br />
:Syntax<br />
::<code>addMinutes(''datetime'' value, ''integer'' minutes)</code><br />
:Returns<br />
::Returns a datetime that is <code>minutes</code> minutes after the <code>value</code>. For negative values of <code>minutes</code>, it returns a datetime that is <code>minutes</code> minutes before <code>value</code>.<br />
<br />
==addSeconds==<br />
:Syntax<br />
::<code>addSeconds(''datetime'' value, ''integer'' seconds)</code><br />
:Returns<br />
::Returns a datetime that is <code>seconds</code> seconds after the <code>value</code>. For negative values of <code>seconds</code>, it returns a datetime that is <code>seconds</code> seconds before <code>value</code>.<br />
<br />
==addWeeks==<br />
:Syntax<br />
::<code>addWeeks(''datetime'' value, ''integer'' weeks)</code><br />
:Returns<br />
::Returns a datetime that is <code>weeks</code> weeks after the <code>value</code>. For negative values of <code>weeks</code>, it returns a datetime that is <code>weeks</code> weeks before <code>value</code>.<br />
<br />
==date==<br />
:Syntax<br />
::<code>date(''datetime'' value)</code><br />
:Returns<br />
::Returns the date portion of <code>value</code> by stripping off time information.<br />
<br />
==datetime==<br />
:Syntax<br />
::<code>''datetime'' datetime(''dynamic'' value)</code><br />
:Returns<br />
::Tries to convert any value into a datetime. Accepts strings in common date/time formats.<br />
<br />
<br />
==formatDuration==<br />
:Syntax<br />
::<code>''string'' formatDuration(''datetime'' value[, ''boolean'' friendly = false[, ''string'' granularity = 's'[, ''boolean'' showAdverbs = false]]])</code><br />
:Arguments<br />
::<code>friendly</code> - <code>false</code> makes the output compact, in the form of <code>0d 00:00:00.000</code>, while <code>true</code> makes the output more human friendly, in the form of <code> 0 days, 0 hours, 0 minutes, and 0 seconds</code>. Defaults to <code>false</code>.<br />
::<code>granularity</code> - represents the smallest time unit to be output. One of <code>d</code> for days, <code>h</code> for hours, <code>m</code> for minutes, <code>s</code> for seconds, or <code>ms</code> for milliseconds. Any time unit below the selected granularity will not be output. Defaults to <code>s</code><br />
::<code>showAdverbs</code> - only affects the friendly output, when <code>true</code> the words <code>in</code> (for future durations - positive input) or <code>ago</code> (for past durations - negative input) are prepended or appended respectively to the output<br />
:Returns<br />
::Returns a string that represents the duration in a human readable format<br />
:Examples<br />
::<code>formatDuration(12029)</code> will output <code>00:00:12</code><br />
::<code>formatDuration(68493, true)</code> will output <code>1 minute and 8 seconds</code><br />
::<code>formatDuration(68493, false, 'ms')</code> will output <code>00:01:08</code><br />
::<code>formatDuration(68493, true, 'm', true)</code> will output <code>in 1 minute</code><br />
<br />
==time==<br />
:Syntax<br />
::<code>''time'' time(''datetime'' value)</code><br />
:Returns<br />
::Returns the time portion of <code>value</code> by stripping off date information.<br />
<br />
<br />
<br />
=Weather related functions=<br />
<br />
==celsius==<br />
:Syntax<br />
::<code>''decimal'' celsius(''decimal'' value)</code><br />
:Returns<br />
::Converts a temperature value from Fahrenheit to Celsius.<br />
<br />
==dewPoint==<br />
:Syntax<br />
::<code>''decimal'' dewPoint(''decimal'' temperature, ''decimal'' relativeHumidity[, ''string'' scale = 'F'])</code><br />
:Parameters<br />
::<code>scale</code> - optional, one of <code>C</code> or <code>F</code>, corresponding to the temperature range used for <code>temperature</code>. The result will be provided in the same scale. If no scale is provided, the Fahrenheit scale will be used.<br />
:Returns<br />
::Returns the due temperature for a given temperature and relative humidity<br />
<br />
==fahrenheit==<br />
:Syntax<br />
::<code>''decimal'' fahrenheit(''decimal'' value)</code><br />
:Returns<br />
::Converts a temperature value from Celsius to Fahrenheit.<br />
<br />
<br />
<br />
= [[Variable_data_types#Dynamic|Dynamic]] =<br />
;if(condition, valueIfTrue, valueIfFalse)<br />
:evaluates a boolean and returns value1 if true, or value2 otherwise<br />
;least(values)<br />
:returns the value that is least found a series of numeric values<br />
;most(values)<br />
:returns the value that is most found a series of numeric values<br />
;previousValue([device;attribute])<br />
:returns the previous value of the attribute<br />
<br />
= [[Variable_data_types#Number_.28Integer.29|Integers]] =<br />
;age([device﹕attribute])<br />
:returns the number of milliseconds an attribute had the current value<br />
;count(values)<br />
:calculates the number of true/non-zero/non-empty items in a series of numeric values<br />
;int()<br />
://todo<br />
;integer(decimal or string)<br />
:converts a decimal value to it's integer value<br />
;newer([device﹕attribute],[...], [device﹕attribute], threshold)<br />
:returns the number of devices whose attribute had the current value for less than the specified number of milliseconds<br />
;older([device﹕attribute],[...], [device﹕attribute], threshold)<br />
:returns the number of devices whose attribute had the current value for more than the specified number of milliseconds<br />
;previousAge([device﹕attribute])<br />
:returns the number of milliseconds an attribute had the previous value<br />
<br />
= [[Variable_data_types#Time|Time]] =<br />
;time(value)<br />
:returns the value as a time type<br />
;addSeconds(dateTime, seconds)<br />
:adds seconds to time, returns the value as a time type<br />
;addMinutes(dateTime, minutes)<br />
:adds minutes to time, returns the value as a time type<br />
;addHours(dateTime, hours)<br />
:adds hours to time, returns the value as a time type<br />
;addDays(dateTime, days)<br />
:adds days to time, returns the value as a time type<br />
;addWeeks(dateTime, weeks)<br />
:adds weeks to time, returns the value as a time type</div>Whoismoseshttps://wiki.webcore.co/index.php?title=User:Robin_Winbourne&diff=217User:Robin Winbourne2017-05-02T20:33:09Z<p>Whoismoses: Creating user page for new user.</p>
<hr />
<div>Lorem ipsum dolor sit amet, qui cu modus torquatos, eum ut alia populo aeterno. Movet quaestio et vix, ea sit veniam delicatissimi, nam id brute doctus constituam. Usu falli gubergren referrentur ne, aeque ridens fuisset in his, usu an aliquid accusamus persecuti. Id qui diceret suscipiantur, mea ei facete insolens sententiae. Impetus detracto molestiae vim id, ad sed liber dicam nullam, natum explicari scriptorem est ad.<br />
<br />
Magna saperet sea ei, his malis feugiat admodum et, ad saepe integre bonorum sea. Esse illum platonem ad quo, pri at modo ipsum possim. Eu vel case conclusionemque, mel ne saepe cotidieque. Mea quando bonorum docendi ei. Pro soleat graecis ex, aliquip mentitum ea nam.<br />
<br />
No facete equidem nominavi eos, tota disputando omittantur id vim. Vis euismod officiis abhorreant id. Reque choro mediocrem nec id, libris sententiae pri in. Offendit delectus ut per, ei ius minim possim, ad vim tantas iisque suavitate. Nonumes expetendis ad pri, in velit clita sed.<br />
<br />
No usu persius insolens consequuntur, id nec impedit omittam philosophia. Ut quo choro nemore admodum. Assum noster ex duo. Vix diceret partiendo ei. Error mediocritatem pri in, putent nostrum hendrerit in mei, ea eam recusabo qualisque consequuntur. Modus mnesarchum omittantur his an, per mediocrem gloriatur ad.<br />
<br />
Has unum maiestatis et, dico recusabo ei mea. Nam eius verterem imperdiet ad, in his tamquam maiestatis. Viris percipit vituperatoribus ex eos, discere accusata elaboraret an sea. Denique principes disputando et vis.<br />
<br />
Graece noluisse vix id, est id justo accusata, mel in torquatos eloquentiam. Per ex dolorum tibique. Unum dolore contentiones te duo, qui oratio audiam ex. Vix cu aliquid intellegam. Harum oblique ne sed, eam no meis velit interpretaris.<br />
<br />
Ut sit mutat affert elaboraret, pri cu unum tractatos. Assum dolores repudiandae mea id. An sit nisl stet dictas. Justo eleifend instructior eum no, feugait commune instructior est in. Vix at debet legimus.<br />
<br />
Pri brute fastidii deterruisset eu. Quo lucilius omittantur eu, ius omnium malorum admodum ea. Idque pertinax gloriatur est ad, ne solet euismod necessitatibus sed. Ex meis malis fugit vis, quo ludus pertinax complectitur ei. Cu purto delenit platonem per, pro cu magna tempor quaerendum, odio tempor ut qui.<br />
<br />
Usu eu errem nostro, animal commune iracundia an eos. Alia stet eos no, iriure nominati contentiones sea te. Porro virtute an eum, vocibus molestiae ea est. Ea eos iusto epicuri constituam, qui noster urbanitas no. No ius summo simul, an nonumy conceptam forensibus has, graece dolores pro in. Graeci regione recteque his ea, debet perfecto has ea.<br />
<br />
Ornatus quaestio ei per. Eu saperet utroque sed. Suas legimus expetendis eam id, mel id eros consectetuer, nec tollit consul et. Cum ex brute simul, sea nostrud salutandi voluptatibus ne. Duo vero ancillae ne. Eum ne vidit nostro efficiantur, inani iracundia incorrupte an vim.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=User_talk:Robin_Winbourne&diff=218User talk:Robin Winbourne2017-05-02T20:33:09Z<p>Whoismoses: Welcome!</p>
<hr />
<div>'''Welcome to ''webCoRE Wiki''!'''<br />
We hope you will contribute much and well.<br />
You will probably want to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages].<br />
Again, welcome and have fun! [[User:Whoismoses|Whoismoses]] ([[User talk:Whoismoses|talk]]) 14:33, 2 May 2017 (MDT)</div>Whoismoseshttps://wiki.webcore.co/index.php?title=GitHub_Install&diff=197GitHub Install2017-05-01T19:20:07Z<p>Whoismoses: /* Github Installation Troubleshooting */</p>
<hr />
<div>=Summary=<br />
These instructions will help you install webCoRE via GitHub integration.<br />
<br />
=Installing Source Code into SmartThings Cloud=<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''My SmartApps'''.<br />
#:[[File:Mysmartapps.jpg]]<br />
# Click the '''Settings''' button at the top of the page.<br />
#:[[File:Settings.jpg]]<br />
# Click the '''Add new repository''' link at the bottom of the pop up.<br />
# Enter "ady624" in the '''Owner''' column.<br />
# Enter "webCoRE" in the '''Name''' column.<br />
# Enter "master" in the '''Branch''' column.<br />
# Click '''Save''' (do not hit the Enter key, it will exit the form without saving).<br />
#:[[File:Githubrepo.jpg]]<br />
# Click '''Update From Repo'''.<br />
# Select '''webCoRE (master)''' from the list.<br />
#:[[File:Update.jpg]]<br />
# Check "webCore.groovy" from the '''New (only in GitHub)''' box. (Do not update both at once.)<br />
# Check the '''Publish''' checkbox at the bottom of the pop up.<br />
# Click the '''Execute Update''' button.<br />
# Check "webCore Piston.groovy" from the '''New (only in GitHub)''' box.<br />
# Check the '''Publish''' checkbox at the bottom of the pop up.<br />
# Click the '''Execute Update''' button.<br />
<br />
Note: The webCoRE source code has only been copied to your SmartThings cloud account. You must continue to the next step of [[Enable webCoRE OAuth]].<br />
<br />
==Github Installation Troubleshooting==<br />
[[File:500error.png]]<br><br />
If you receive this error it may be because you installed and published both "webCore.groovy" and "webCore Piston.groovy" at the same time. Please do them individually (one at a time) per the instructions. Be sure to install/publish "webCore.groovy" first then "webCore Piston.groovy" after.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=GitHub_Install&diff=196GitHub Install2017-05-01T18:23:11Z<p>Whoismoses: /* Installing Source Code into SmartThings Cloud */</p>
<hr />
<div>=Summary=<br />
These instructions will help you install webCoRE via GitHub integration.<br />
<br />
=Installing Source Code into SmartThings Cloud=<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''My SmartApps'''.<br />
#:[[File:Mysmartapps.jpg]]<br />
# Click the '''Settings''' button at the top of the page.<br />
#:[[File:Settings.jpg]]<br />
# Click the '''Add new repository''' link at the bottom of the pop up.<br />
# Enter "ady624" in the '''Owner''' column.<br />
# Enter "webCoRE" in the '''Name''' column.<br />
# Enter "master" in the '''Branch''' column.<br />
# Click '''Save''' (do not hit the Enter key, it will exit the form without saving).<br />
#:[[File:Githubrepo.jpg]]<br />
# Click '''Update From Repo'''.<br />
# Select '''webCoRE (master)''' from the list.<br />
#:[[File:Update.jpg]]<br />
# Check "webCore.groovy" from the '''New (only in GitHub)''' box. (Do not update both at once.)<br />
# Check the '''Publish''' checkbox at the bottom of the pop up.<br />
# Click the '''Execute Update''' button.<br />
# Check "webCore Piston.groovy" from the '''New (only in GitHub)''' box.<br />
# Check the '''Publish''' checkbox at the bottom of the pop up.<br />
# Click the '''Execute Update''' button.<br />
<br />
Note: The webCoRE source code has only been copied to your SmartThings cloud account. You must continue to the next step of [[Enable webCoRE OAuth]].<br />
<br />
==Github Installation Troubleshooting==<br />
[[File:500error.png]]<br><br />
If you receive this error it may be resolved by completing steps 11-13 for each "webCore.groovy" and "webCore Piston.groovy" individually (one at a time). Be sure to install/publish "webCore.groovy" first then "webCore Piston.groovy" after.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=WebCoRE_todo&diff=169WebCoRE todo2017-04-20T15:53:18Z<p>Whoismoses: </p>
<hr />
<div>{{warning|Just because a feature is on this list, doesn't mean that [https://community.smartthings.com/users/ady624/summary ady624] will implement it.}}<br />
{{warning|This list may not be complete. If you find something that is not on the list that has not been implemented don't complain, add it!}}<br />
<br />
The following is a list of missing features or known issues:<br />
<br />
# Global variables<br />
# Timed conditions / triggers (<del>was*</del>, <del>changed*</del>, <del>changes*</del>, <del>stay*</del>) (04/20/2017)<br />
# Superglobal variables<br />
# Custom commands with parameters<br />
# Subscribe to Routines Events<br />
# IFTTT integration<br />
# AskAlexa integration<br />
# Masking phone numbers while sharing pistons<br />
# Copy&Paste support inside piston editor<br />
# Twilio integration<br />
# NFL integration<br />
# <del>Smart Home Monitor</del> (3/26/2017)<br />
# <del>Location Mode</del> (3/26/2017)<br />
# <del>Time Triggers (every x minutes/hours/days/etc do)</del> (4/12/2017)<br />
# <del>Color support</del> (4/12/2017)<br />
# <del>[[Task Cancellation Policy|TCP]]</del> (4/13/2017)<br />
# <del>[[Task Execution Policy|TEP]]</del> (4/13/2017)<br />
# <del>Execute other pistons</del> (4/15/2017)<br />
# <del>Wait until &lt;time&gt;</del> (4/15/2017)<br />
# <del>Execute Routines</del> (4/15/2017)<br />
# <del>Multiple choice conditions (any of, not any of)</del> (4/16/2017)<br />
# <del>Web service calls with location (needs clarification)</del> (4/17/2017)<br />
# <del>Task mode restrictions</del> (4/18/2017)<br />
# <del>Time conditions/restrictions (time is before/between/after)</del> (4/18/2017)<br />
# <del>Date conditions/restrictions (date is before/between/after)</del> (4/19/2017)<br />
# <del>Timed conditions (changed, was / were)</del> (4/20/2017)</div>Whoismoseshttps://wiki.webcore.co/index.php?title=WebCoRE_todo&diff=165WebCoRE todo2017-04-19T20:03:31Z<p>Whoismoses: </p>
<hr />
<div>{{warning|Just because a feature is on this list, doesn't mean that [https://community.smartthings.com/users/ady624/summary ady624] will implement it.}}<br />
{{warning|This list may not be complete. If you find something that is not on the list that has not been implemented don't complain, add it!}}<br />
<br />
The following is a list of missing features or known issues:<br />
<br />
# Global variables<br />
# Timed triggers (stays / stay)<br />
# Superglobal variables<br />
# Timed conditions (changed, was / were)<br />
# Custom commands with parameters<br />
# <del>Execute Routines</del> (4/15/2017)<br />
# Subscribe to Routines Events<br />
# IFTTT integration<br />
# AskAlexa integration<br />
# Masking phone numbers while sharing pistons<br />
# Copy&Paste support inside piston editor<br />
# Twilio integration<br />
# NFL integration<br />
# <del>Smart Home Monitor</del> (3/26/2017)<br />
# <del>Location Mode</del> (3/26/2017)<br />
# <del>Time Triggers (every x minutes/hours/days/etc do)</del> (4/12/2017)<br />
# <del>Color support</del> (4/12/2017)<br />
# <del>[[Task Cancellation Policy|TCP]]</del> (4/13/2017)<br />
# <del>[[Task Execution Policy|TEP]]</del> (4/13/2017)<br />
# <del>Execute other pistons</del> (4/15/2017)<br />
# <del>Wait until &lt;time&gt;</del> (4/15/2017)<br />
# <del>Multiple choice conditions (any of, not any of)</del> (4/16/2017)<br />
# <del>Web service calls with location (needs clarification)</del> (4/17/2017)<br />
# <del>Task mode restrictions</del> (4/18/2017)<br />
# <del>Time conditions/restrictions (time is before/between/after)</del> (4/18/2017)<br />
# <del>Date conditions/restrictions (date is before/between/after)</del> (4/19/2017)</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=135webCoRE2017-03-31T00:54:30Z<p>Whoismoses: /* Anatomy of a webCoRE Piston */</p>
<hr />
<div>{{warning|webCoRE is currently in the [https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha Alpha phase of the software release lifecycle] which means it might be unstable. Crashes, bugs, and potentially data loss are expected. Anyone is welcome to try it out, but it should not be used for production purposes.}}<br />
<br />
<br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions. webCoRE is currently a work in progress. Please review the [[webCoRE todo]] list.<br />
<br />
== Getting started ==<br />
A few steps need to be completed before you can use webCoRE. First, webCoRE needs to be installed in your SmartThings account, then automations need to be configured. These are called [[Piston|pistons]] and will be detailed later. So let's start by installing webCoRE, please follow the 5 steps below.<br />
<br />
== Installing webCoRE ==<br />
You must complete all of these steps.<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud<br />
# [[Install webCoRE]] in the SmartThings mobile app<br />
# [[Enabling webCoRE dashboard]]<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Understanding the basics ==<br />
webCoRE is comprised of the three main components listed below.<br />
<br />
=== The webCoRE child SmartApp (''webCoRE Piston'') ===<br />
The webCoRE child SmartApp is also known as a [[Piston|piston]]. It is responsible for executing the automation script that the user creates and does the heavy lifting in the whole webCoRE ecosystem. It is directly managed by the webCoRE parent SmartApp, which can create, maintain, and delete a Piston.<br />
<br />
=== The webCoRE parent SmartApp (''webCoRE'') ===<br />
The wabCoRE parent SmartApp is the component responsible for managing the child SmartApp instances and their relationship with the Dashboard. It is the middle man that allows adding new Pistons, maintaining them, or deleting them. It is also responsible with the security of the whole ecosystem, allowing password secured access from the Dashboard.<br />
<br />
=== The [[Dashboard|dashboard]] ===<br />
The Dashboard is an [https://en.wikipedia.org/wiki/HTML HTML] interface for webCoRE that allows users to manage their webCoRE installation. It is the central hub to controlling webCoRE, allowing the user to create, modify, test, and delete Pistons.<br />
<br />
==Anatomy of a webCoRE Piston==<br />
A piston is a script that contains a collection of statements, arranged so that the logic and flow of the piston perform tasks in a desired sequence. It is broken down into several sections, described below.<br />
<br />
===The ''settings'' section===<br />
This section allows configuration of how certain aspects of the piston function. These settings control low-level functionality and can alter the way a piston reacts to events. [todo: describe the settings]<br />
<br />
===The ''define'' section===<br />
A very powerful feature of webCoRE is the ability to use [[Variables|variables]]. Think of variables as temporary pockets where you can store information and are able to later retrieve and use this information for any purpose. Variables do just that, they store information that can be later used, either during the current piston run, or at a later time, when another event occurs.<br />
<br />
===Restrictions===<br />
<br />
===Execute Block===<br />
<br />
* [[If Block]] - Simple statement for checking conditions.<br />
* [[Action]] - Construct for executing an action.<br />
* [[Timer]] - <Todo><br />
* [[Switch]] - <Todo><br />
* [[For Loop]] - <Todo><br />
* [[For Each Loop]] - <Todo><br />
* [[While Loop]] - <Todo><br />
* [[Repeat]] - <Todo><br />
* [[Break]] - <Todo><br />
* [[Exit]] - <Todo><br />
<br />
===Other Details===<br />
# [[webCore Logging]]<br />
<br />
== Creating your first piston ==<br />
<br />
Once you finished the installation steps above, let's go ahead and create the first piston, the famous [[Hello World!|Hello World]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Hello_World!&diff=132Hello World!2017-03-28T14:34:32Z<p>Whoismoses: </p>
<hr />
<div><br />
[[File:hello_world.png]]</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Hello_World!&diff=131Hello World!2017-03-28T14:33:39Z<p>Whoismoses: Created page with " hello_world.png"</p>
<hr />
<div><br />
[[hello_world.png]]</div>Whoismoseshttps://wiki.webcore.co/index.php?title=File:Hello_world.png&diff=130File:Hello world.png2017-03-28T14:33:22Z<p>Whoismoses: </p>
<hr />
<div></div>Whoismoseshttps://wiki.webcore.co/index.php?title=WebCoRE_Logging&diff=129WebCoRE Logging2017-03-28T14:23:31Z<p>Whoismoses: </p>
<hr />
<div>The logging settings can be found in the webCoRE SmartApp under '''Settings --> Logging level'''.<br />
<br />
The log to console task will output to logs regardless of the option selected in settings.<br />
<br />
These settings will impact what logs get written to the SmartThings IDE Live Logging.<br />
<br />
* '''None''' - only error and warning messages will be displayed<br />
* '''Minimal''' - only error, warning, and info messages will be displayed<br />
* '''Medium''' - only error, warning, info and trace messages will be displayed<br />
* '''Full''' - all messages will be displayed (error, warning, info, trace, and debug)</div>Whoismoseshttps://wiki.webcore.co/index.php?title=WebCoRE_Logging&diff=128WebCoRE Logging2017-03-28T14:22:45Z<p>Whoismoses: Created page with "The logging settings can be found in the webCoRE SmartApp under '''Settings --> Logging level'''. The log to console task will output to logs regardless of the option selecte..."</p>
<hr />
<div>The logging settings can be found in the webCoRE SmartApp under '''Settings --> Logging level'''.<br />
<br />
The log to console task will output to logs regardless of the option selected in settings.<br />
<br />
These settings will impact what logs get written to the SmartThings IDE Live Logging.<br />
<br />
'''None''' - only error and warning messages will be displayed<br />
'''Minimal''' - only error, warning, and info messages will be displayed<br />
'''Medium''' - only error, warning, info and trace messages will be displayed<br />
'''Full''' - all messages will be displayed (error, warning, info, trace, and debug)</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=127webCoRE2017-03-28T14:20:56Z<p>Whoismoses: </p>
<hr />
<div>{{warning|webCoRE is currently in the [https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha Alpha phase of the software release lifecycle] which means it might be unstable. Crashes, bugs, and potentially data loss are expected. Anyone is welcome to try it out, but it should not be used for production purposes.}}<br />
<br />
<br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions. webCoRE is currently a work in progress. Please review the [[webCoRE todo]] list.<br />
<br />
== Getting started ==<br />
A few steps need to be completed before you can use webCoRE. First, webCoRE needs to be installed in your SmartThings account, then automations need to be configured. These are called [[Piston|pistons]] and will be detailed later. So let's start by installing webCoRE, please follow the 5 steps below.<br />
<br />
== Installing webCoRE ==<br />
You must complete all of these steps.<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud<br />
# [[Install webCoRE]] in the SmartThings mobile app<br />
# [[Enabling webCoRE dashboard]]<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Understanding the basics ==<br />
webCoRE is comprised of the three main components listed below.<br />
<br />
=== The webCoRE child SmartApp (''webCoRE Piston'') ===<br />
The webCoRE child SmartApp is also known as a [[Piston|piston]]. It is responsible for executing the automation script that the user creates and does the heavy lifting in the whole webCoRE ecosystem. It is directly managed by the webCoRE parent SmartApp, which can create, maintain, and delete a Piston.<br />
<br />
=== The webCoRE parent SmartApp (''webCoRE'') ===<br />
The wabCoRE parent SmartApp is the component responsible for managing the child SmartApp instances and their relationship with the Dashboard. It is the middle man that allows adding new Pistons, maintaining them, or deleting them. It is also responsible with the security of the whole ecosystem, allowing password secured access from the Dashboard.<br />
<br />
=== The [[Dashboard|dashboard]] ===<br />
The Dashboard is an [https://en.wikipedia.org/wiki/HTML HTML] interface for webCoRE that allows users to manage their webCoRE installation. It is the central hub to controlling webCoRE, allowing the user to create, modify, test, and delete Pistons.<br />
<br />
==Anatomy of a webCoRE Piston==<br />
A piston is a script that contains a collection of statements, arranged so that the logic and flow of the piston perform tasks in a desired sequence. It is broken down into several sections, described below.<br />
<br />
===The ''settings'' section===<br />
This section allows configuration of how certain aspects of the piston function. These settings control low-level functionality and can alter the way a piston reacts to events. [todo: describe the settings]<br />
<br />
===The ''define'' section===<br />
A very powerful feature of webCoRE is the ability to use [[Variables|variables]]. Think of variables as temporary pockets where you can store information and are able to later retrieve and use this information for any purpose. Variables do just that, they store information that can be later used, either during the current piston run, or at a later time, when another event occurs.<br />
<br />
===The ''execute'' section===<br />
<br />
===Restrictions===<br />
<br />
===Execute Block===<br />
<br />
===Other Details===<br />
# [[webCore Logging]]<br />
<br />
== Creating your first piston ==<br />
<br />
Once you finished the installation steps above, let's go ahead and create the first piston, the famous [[Hello World!|Hello World]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=GitHub_Install&diff=126GitHub Install2017-03-28T14:15:34Z<p>Whoismoses: </p>
<hr />
<div>=Summary=<br />
These instructions will help you install webCoRE via GitHub integration.<br />
<br />
=Installing Source Code into SmartThings Cloud=<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''My SmartApps'''.<br />
#:[[File:Mysmartapps.jpg]]<br />
# Click the '''Settings''' button at the top of the page.<br />
#:[[File:Settings.jpg]]<br />
# Click the '''Add new repository''' link at the bottom of the pop up.<br />
# Enter "ady624" in the '''Owner''' column.<br />
# Enter "webCoRE" in the '''Name''' column.<br />
# Enter "master" in the '''Branch''' column.<br />
# Click '''Save''' (do not hit the Enter key, it will exit the form without saving).<br />
#:[[File:Githubrepo.jpg]]<br />
# Click '''Update From Repo'''.<br />
# Select '''webCoRE (master)''' from the list.<br />
#:[[File:Update.jpg]]<br />
# Check both "webCore.groovy" and "webCore Piston.groovy" from the '''New (only in GitHub)''' box.<br />
# Check the '''Publish''' checkbox at the bottom of the pop up.<br />
# Click the '''Execute Update''' button.<br />
#:[[File:Newgithub.jpg|600px]]<br />
<br />
Note: The webCoRE source code has only been copied to your SmartThings cloud account. You must continue to the next step of [[Enable webCoRE OAuth]].<br />
<br />
==Github Installation Troubleshooting==<br />
[[File:500error.png]]<br><br />
If you receive this error it may be resolved by completing steps 11-13 for each "webCore.groovy" and "webCore Piston.groovy" individually (one at a time).</div>Whoismoseshttps://wiki.webcore.co/index.php?title=WebCoRE_todo&diff=124WebCoRE todo2017-03-27T20:51:53Z<p>Whoismoses: </p>
<hr />
<div>{{warning|Just because a feature is on this list, doesn't mean that [https://community.smartthings.com/users/ady624/summary ady624] will implement it.}}<br />
{{warning|This list may not be complete. If you find something that is not on the list that has not been implemented don't complain, add it!}}<br />
<br />
The following is a list of features that were available in CoRE that have not been implemented yet in webCoRE.<br />
<br />
# Timed Conditions (changed, was / were)<br />
# Timed Triggers (stays / stay)<br />
# Time Conditions (happens at, happens every hour, ...)<br />
# Custom Command with Parameters<br />
# <del>Smart Home Monitor</del> (3/26/2017)<br />
# <del>Location Mode</del> (3/26/2017)<br />
<br />
<br />
The following is a list of features that may be available in webCoRE that were never available in CoRE.<br />
<br />
# Masking phone numbers while sharing pistons.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=WebCoRE_todo&diff=123WebCoRE todo2017-03-27T20:49:06Z<p>Whoismoses: </p>
<hr />
<div>{{warning|Just because a feature is on this list, doesn't mean that [https://community.smartthings.com/users/ady624/summary ady624] will implement it.}}<br />
{{warning|This list may not be complete. If you find something that is not on the list that has not been implemented don't complain, add it!}}<br />
<br />
The following is a list of features that were available in CoRE that have not been implemented yet in webCoRE.<br />
<br />
# Timed Conditions (changed, was / were)<br />
# Timed Triggers (stays / stay)<br />
# Time Conditions (happens at, happens every hour, ...)<br />
<br />
<br />
The following is a list of features that may be available in webCoRE that were never available in CoRE.<br />
<br />
# Masking phone numbers while sharing pistons.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=WebCoRE_todo&diff=122WebCoRE todo2017-03-27T20:47:59Z<p>Whoismoses: Created page with "{{warning|Just because a feature is on this list, doesn't mean that [https://community.smartthings.com/users/ady624/summary ady624] will implement it.}} The following is a l..."</p>
<hr />
<div>{{warning|Just because a feature is on this list, doesn't mean that [https://community.smartthings.com/users/ady624/summary ady624] will implement it.}}<br />
<br />
<br />
The following is a list of features that were available in CoRE that have not been implemented yet in webCoRE.<br />
<br />
# Timed Conditions (changed, was / were)<br />
# Timed Triggers (stays / stay)<br />
# Time Conditions (happens at, happens every hour, ...)<br />
<br />
<br />
The following is a list of features that may be available in webCoRE that were never available in CoRE.<br />
<br />
# Masking phone numbers while sharing pistons.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=121webCoRE2017-03-27T20:47:22Z<p>Whoismoses: </p>
<hr />
<div>{{warning|webCoRE is currently in the [https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha Alpha phase of the software release lifecycle] which means it might be unstable. Crashes, bugs, and potentially data loss are expected. Anyone is welcome to try it out, but it should not be used for production purposes.}}<br />
<br />
<br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions. webCoRE is currently a work in progress. Please review the [[webCoRE todo]] list.<br />
<br />
== Getting started ==<br />
A few steps need to be completed before you can use webCoRE. First, webCoRE needs to be installed in your SmartThings account, then automations need to be configured. These are called [[Piston|pistons]] and will be detailed later. So let's start by installing webCoRE, please follow the 5 steps below.<br />
<br />
== Installing webCoRE ==<br />
You must complete all of these steps.<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud<br />
# [[Install webCoRE]] in the SmartThings mobile app<br />
# [[Enabling webCoRE dashboard]]<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Understanding the basics ==<br />
webCoRE is comprised of the three main components listed below.<br />
<br />
=== The webCoRE child SmartApp (''webCoRE Piston'') ===<br />
The webCoRE child SmartApp is also known as a [[Piston|piston]]. It is responsible for executing the automation script that the user creates and does the heavy lifting in the whole webCoRE ecosystem. It is directly managed by the webCoRE parent SmartApp, which can create, maintain, and delete a Piston.<br />
<br />
=== The webCoRE parent SmartApp (''webCoRE'') ===<br />
The wabCoRE parent SmartApp is the component responsible for managing the child SmartApp instances and their relationship with the Dashboard. It is the middle man that allows adding new Pistons, maintaining them, or deleting them. It is also responsible with the security of the whole ecosystem, allowing password secured access from the Dashboard.<br />
<br />
=== The [[Dashboard|dashboard]] ===<br />
The Dashboard is an [https://en.wikipedia.org/wiki/HTML HTML] interface for webCoRE that allows users to manage their webCoRE installation. It is the central hub to controlling webCoRE, allowing the user to create, modify, test, and delete Pistons.<br />
<br />
==Anatomy of a webCoRE Piston==<br />
A piston is a script that contains a collection of statements, arranged so that the logic and flow of the piston perform tasks in a desired sequence. It is broken down into several sections, described below.<br />
<br />
===The ''settings'' section===<br />
This section allows configuration of how certain aspects of the piston function. These settings control low-level functionality and can alter the way a piston reacts to events. [todo: describe the settings]<br />
<br />
===The ''define'' section===<br />
A very powerful feature of webCoRE is the ability to use [[Variables|variables]]. Think of variables as temporary pockets where you can store information and are able to later retrieve and use this information for any purpose. Variables do just that, they store information that can be later used, either during the current piston run, or at a later time, when another event occurs.<br />
<br />
===The ''execute'' section===<br />
<br />
===Restrictions===<br />
<br />
===Execute Block===<br />
<br />
== Creating your first piston ==<br />
<br />
Once you finished the installation steps above, let's go ahead and create the first piston, the famous [[Hello World!|Hello World]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=120webCoRE2017-03-27T20:46:37Z<p>Whoismoses: </p>
<hr />
<div>{{warning|webCoRE is currently in the [https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha Alpha phase of the software release lifecycle] which means it might be unstable. Crashes, bugs, and potentially data loss are expected. Anyone is welcome to try it out, but it should not be used for production purposes.}}<br />
<br />
<br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions. webCoRE is currently a work in progress. Please review the [[webCore_todo]] list.<br />
<br />
== Getting started ==<br />
A few steps need to be completed before you can use webCoRE. First, webCoRE needs to be installed in your SmartThings account, then automations need to be configured. These are called [[Piston|pistons]] and will be detailed later. So let's start by installing webCoRE, please follow the 5 steps below.<br />
<br />
== Installing webCoRE ==<br />
You must complete all of these steps.<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud<br />
# [[Install webCoRE]] in the SmartThings mobile app<br />
# [[Enabling webCoRE dashboard]]<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Understanding the basics ==<br />
webCoRE is comprised of the three main components listed below.<br />
<br />
=== The webCoRE child SmartApp (''webCoRE Piston'') ===<br />
The webCoRE child SmartApp is also known as a [[Piston|piston]]. It is responsible for executing the automation script that the user creates and does the heavy lifting in the whole webCoRE ecosystem. It is directly managed by the webCoRE parent SmartApp, which can create, maintain, and delete a Piston.<br />
<br />
=== The webCoRE parent SmartApp (''webCoRE'') ===<br />
The wabCoRE parent SmartApp is the component responsible for managing the child SmartApp instances and their relationship with the Dashboard. It is the middle man that allows adding new Pistons, maintaining them, or deleting them. It is also responsible with the security of the whole ecosystem, allowing password secured access from the Dashboard.<br />
<br />
=== The [[Dashboard|dashboard]] ===<br />
The Dashboard is an [https://en.wikipedia.org/wiki/HTML HTML] interface for webCoRE that allows users to manage their webCoRE installation. It is the central hub to controlling webCoRE, allowing the user to create, modify, test, and delete Pistons.<br />
<br />
==Anatomy of a webCoRE Piston==<br />
A piston is a script that contains a collection of statements, arranged so that the logic and flow of the piston perform tasks in a desired sequence. It is broken down into several sections, described below.<br />
<br />
===The ''settings'' section===<br />
This section allows configuration of how certain aspects of the piston function. These settings control low-level functionality and can alter the way a piston reacts to events. [todo: describe the settings]<br />
<br />
===The ''define'' section===<br />
A very powerful feature of webCoRE is the ability to use [[Variables|variables]]. Think of variables as temporary pockets where you can store information and are able to later retrieve and use this information for any purpose. Variables do just that, they store information that can be later used, either during the current piston run, or at a later time, when another event occurs.<br />
<br />
===The ''execute'' section===<br />
<br />
===Restrictions===<br />
<br />
===Execute Block===<br />
<br />
== Creating your first piston ==<br />
<br />
Once you finished the installation steps above, let's go ahead and create the first piston, the famous [[Hello World!|Hello World]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=GitHub_Install&diff=118GitHub Install2017-03-26T03:55:28Z<p>Whoismoses: /* Installing Source Code into SmartThings Cloud */</p>
<hr />
<div>=Summary=<br />
These instructions will help you install webCoRE via GitHub integration.<br />
<br />
=Installing Source Code into SmartThings Cloud=<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''My SmartApps'''.<br />
#:[[File:Mysmartapps.jpg]]<br />
# Click the '''Settings''' button at the top of the page.<br />
#:[[File:Settings.jpg]]<br />
# Click the '''Add new repository''' link at the bottom of the pop up.<br />
# Enter "ady624" in the '''Owner''' column.<br />
# Enter "webCoRE" in the '''Name''' column.<br />
# Enter "master" in the '''Branch''' column.<br />
# Click '''Save''' (do not hit the Enter key, it will exit the form without saving).<br />
#:[[File:Githubrepo.jpg]]<br />
# Click '''Update From Repo'''.<br />
# Select '''webCoRE (master)''' from the list.<br />
#:[[File:Update.jpg]]<br />
# Check both "webCore.groovy" and "webCore Piston.groovy" from the '''New (only in GitHub)''' box.<br />
# Check the '''Publish''' checkbox at the bottom of the pop up.<br />
# Click the '''Execute Update''' button.<br />
#:[[File:Newgithub.jpg|600px]]<br />
<br />
Note: The webCoRE source code has only been copied to your SmartThings cloud account. You must continue to the next step of [[Enable webCoRE OAuth]].<br />
<br />
=Special Cases=<br />
[[File:500error.png]]<br><br />
If you receive this error it may be resolved by completing steps 11-13 for each "webCore.groovy" and "webCore Piston.groovy" individually (one at a time).</div>Whoismoseshttps://wiki.webcore.co/index.php?title=GitHub_Install&diff=117GitHub Install2017-03-26T03:54:59Z<p>Whoismoses: /* Installing Source Code into SmartThings Cloud */</p>
<hr />
<div>=Summary=<br />
These instructions will help you install webCoRE via GitHub integration.<br />
<br />
=Installing Source Code into SmartThings Cloud=<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''My SmartApps'''.<br />
#:[[File:Mysmartapps.jpg]]<br />
# Click the '''Settings''' button at the top of the page.<br />
#:[[File:Settings.jpg]]<br />
# Click the '''Add new repository''' link at the bottom of the pop up.<br />
# Enter "ady624" in the '''Owner''' column.<br />
# Enter "webCoRE" in the '''Name''' column.<br />
# Enter "master" in the '''Branch''' column.<br />
# Click '''Save''' (do not hit the Enter key, it will exit the form without saving).<br />
#:[[File:Githubrepo.jpg]]<br />
# Click '''Update From Repo'''.<br />
# Select '''webCoRE (master)''' from the list.<br />
#:[[File:Update.jpg]]<br />
# Check both "webCore.groovy" and "webCore Piston.groovy" from the '''New (only in GitHub)''' box.<br />
# Check the '''Publish''' checkbox at the bottom of the pop up.<br />
# Click the '''Execute Update''' button.<br />
#:[[File:Newgithub.jpg|400px]]<br />
<br />
Note: The webCoRE source code has only been copied to your SmartThings cloud account. You must continue to the next step of [[Enable webCoRE OAuth]].<br />
<br />
=Special Cases=<br />
[[File:500error.png]]<br><br />
If you receive this error it may be resolved by completing steps 11-13 for each "webCore.groovy" and "webCore Piston.groovy" individually (one at a time).</div>Whoismoseshttps://wiki.webcore.co/index.php?title=GitHub_Install&diff=116GitHub Install2017-03-26T03:54:21Z<p>Whoismoses: /* Special Cases */</p>
<hr />
<div>=Summary=<br />
These instructions will help you install webCoRE via GitHub integration.<br />
<br />
=Installing Source Code into SmartThings Cloud=<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''My SmartApps'''.<br />
#:[[File:Mysmartapps.jpg]]<br />
# Click the '''Settings''' button at the top of the page.<br />
#:[[File:Settings.jpg]]<br />
# Click the '''Add new repository''' link at the bottom of the pop up.<br />
# Enter "ady624" in the '''Owner''' column.<br />
# Enter "webCoRE" in the '''Name''' column.<br />
# Enter "master" in the '''Branch''' column.<br />
# Click '''Save''' (do not hit the Enter key, it will exit the form without saving).<br />
#:[[File:Githubrepo.jpg]]<br />
# Click '''Update From Repo'''.<br />
# Select '''webCoRE (master)''' from the list.<br />
#:[[File:Update.jpg]]<br />
# Check both "webCore.groovy" and "webCore Piston.groovy" from the '''New (only in GitHub)''' box.<br />
# Check the '''Publish''' checkbox at the bottom of the pop up.<br />
# Click the '''Execute Update''' button.<br />
#:[[File:Newgithub.jpg|800px]]<br />
=Special Cases=<br />
[[File:500error.png]]<br><br />
If you receive this error it may be resolved by completing steps 11-13 for each "webCore.groovy" and "webCore Piston.groovy" individually (one at a time).</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=103webCoRE2017-03-25T14:14:59Z<p>Whoismoses: /* Anatomy of a webCoRE Piston */</p>
<hr />
<div>{{warning|webCoRE is currently in the [https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha Alpha phase of the software release lifecycle] which means it might be unstable. Crashes, bugs, and potentially data loss are expected. Anyone is welcome to try it out, but it should not be used for production purposes.}}<br />
<br />
<br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions.<br />
<br />
== Getting started ==<br />
A few steps need to be completed befoure you can use webCoRE. First, webCoRE needs to be installed in your SmartThings account, then automations need to be configured. These are called [[Piston|pistons]] and will be detailed later. So let's start by installing webCoRE, please follow the 5 steps below.<br />
<br />
== Installing webCoRE ==<br />
You must complete all of these steps.<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud<br />
# [[Install webCoRE]] in the SmartThings mobile app<br />
# [[Enabling webCoRE dashboard]]<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Understanding the basics ==<br />
webCoRE is comprised of the three main components listed below.<br />
<br />
=== The webCoRE child SmartApp (''webCoRE Piston'') ===<br />
The webCoRE child SmartApp is also known as a [[Piston|piston]]. It is responsible for executing the automation script that the user creates and does the heavy lifting in the whole webCoRE ecosystem. It is directly managed by the webCoRE parent SmartApp, which can create, maintain, and delete a Piston.<br />
<br />
=== The webCoRE parent SmartApp (''webCoRE'') ===<br />
The wabCoRE parent SmartApp is the component responsible for managing the child SmartApp instances and their relationship with the Dashboard. It is the middle man that allows adding new Pistons, maintaining them, or deleting them. It is also responsible with the security of the whole ecosystem, allowing password secured access from the Dashboard.<br />
<br />
=== The [[Dashboard|dashboard]] ===<br />
The Dashboard is an [https://en.wikipedia.org/wiki/HTML HTML] interface for webCoRE that allows users to manage their webCoRE installation. It is the central hub to controlling webCoRE, allowing the user to create, modify, test, and delete Pistons.<br />
<br />
==Anatomy of a webCoRE Piston==<br />
A piston is made of of several components. They are listed below.<br />
<br />
===Variables===<br />
Variables are used in the traditional sense of the word. They hold a value to be used during the execution logic of your piston.<br />
<br />
====Local Variables====<br />
Local variables are declared within a piston's define block. They are not visible beyond the scope of the piston, however they are available to concurrent and future executions of the same piston. If a variables is initialized in the pistons's define block the initialization will occur each time the piston is executed.<br />
<br />
====Global Variables====<br />
This feature is not currently implemented.<br />
<br />
====Variable Data Types====<br />
webCoRE supports a variety of data types, please review the [[webCoRE Variable Data Types]].<br />
<br />
===Restrictions===<br />
<br />
===Execute Block===<br />
<br />
== Creating your first piston ==<br />
<br />
Once you finished the installation steps above, let's go ahead and create the first piston, the famous [[Hello World!|Hello World]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Variable_data_types&diff=102Variable data types2017-03-25T14:14:28Z<p>Whoismoses: Created page with "webCoRE supports several variable data types. ===Dynamic=== This variable type can change based on the value being stored in it. [Is this correct?] ===String=== A variable o..."</p>
<hr />
<div>webCoRE supports several variable data types.<br />
<br />
===Dynamic===<br />
This variable type can change based on the value being stored in it. [Is this correct?]<br />
<br />
===String===<br />
A variable of type string can contain one to many alphanumeric characters, for example: <code>"1234"</code>.<br />
<br />
===Boolean===<br />
A variable of type boolean is a binary type. It's value can either be true or false (1 or 0).<br />
<br />
===Number (Integer)===<br />
A variable of type number (integer) can contain only [https://en.wikipedia.org/wiki/Whole_number whole numbers], for example: <code>"1"</code> or <code>3983</code>.<br />
<br />
===Number (Decimal)===<br />
A variable of type number (decimal) can contain [https://en.wikipedia.org/wiki/Rational_number rational numbers] in the decimal form, for example <code>6.3</code> or <code>100.18</code> or <code>209.292929</code>.<br />
<br />
===Date and Time===<br />
A variable of date and time represents a single point in time representing both date and time, for example <code>8/7/1980 08:39:29 AM</code>.<br />
<br />
===Date===<br />
A variable of date represents a single day, for example <code>8/7/1980</code>.<br />
<br />
===Date and Time===<br />
A variable of time represents a single point in time that can happen each day, for example <code>08:39:29 AM</code>.<br />
<br />
===Device===<br />
[todo, need specifics]</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=101webCoRE2017-03-25T13:57:13Z<p>Whoismoses: </p>
<hr />
<div>{{warning|webCoRE is currently in the [https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha Alpha phase of the software release lifecycle] which means it might be unstable. Crashes, bugs, and potentially data loss are expected. Anyone is welcome to try it out, but it should not be used for production purposes.}}<br />
<br />
<br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions.<br />
<br />
== Getting started ==<br />
A few steps need to be completed befoure you can use webCoRE. First, webCoRE needs to be installed in your SmartThings account, then automations need to be configured. These are called [[Piston|pistons]] and will be detailed later. So let's start by installing webCoRE, please follow the 5 steps below.<br />
<br />
== Installing webCoRE ==<br />
You must complete all of these steps.<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud<br />
# [[Install webCoRE]] in the SmartThings mobile app<br />
# [[Enabling webCoRE dashboard]]<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Understanding the basics ==<br />
webCoRE is comprised of the three main components listed below.<br />
<br />
=== The webCoRE child SmartApp (''webCoRE Piston'') ===<br />
The webCoRE child SmartApp is also known as a [[Piston|piston]]. It is responsible for executing the automation script that the user creates and does the heavy lifting in the whole webCoRE ecosystem. It is directly managed by the webCoRE parent SmartApp, which can create, maintain, and delete a Piston.<br />
<br />
=== The webCoRE parent SmartApp (''webCoRE'') ===<br />
The wabCoRE parent SmartApp is the component responsible for managing the child SmartApp instances and their relationship with the Dashboard. It is the middle man that allows adding new Pistons, maintaining them, or deleting them. It is also responsible with the security of the whole ecosystem, allowing password secured access from the Dashboard.<br />
<br />
=== The [[Dashboard|dashboard]] ===<br />
The Dashboard is an [https://en.wikipedia.org/wiki/HTML HTML] interface for webCoRE that allows users to manage their webCoRE installation. It is the central hub to controlling webCoRE, allowing the user to create, modify, test, and delete Pistons.<br />
<br />
==Anatomy of a webCoRE Piston==<br />
A piston is made of of several components. They are listed below.<br />
<br />
===Variables===<br />
Variables are used in the traditional sense of the word. They hold a value to be used during the execution logic of your piston.<br />
<br />
====Local Variables====<br />
Local variables are declared within a piston's define block. They are not visible beyond the scope of the piston, however they are available to concurrent and future executions of the same piston. If a variables is initialized in the pistons's define block the initialization will occur each time the piston is executed.<br />
<br />
====Global Variables====<br />
<Not implemented yet><br />
<br />
====Variable Data Types====<br />
webCoRE supports a variety of data types, please review the [[webCoRE Variable Data Types]].<br />
<br />
===Restrictions===<br />
<br />
===Execute Block===<br />
<br />
== Creating your first piston ==<br />
<br />
Once you finished the installation steps above, let's go ahead and create the first piston, the famous [[Hello World!|Hello World]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=61webCoRE2017-03-23T12:48:29Z<p>Whoismoses: </p>
<hr />
<div><br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions.<br />
<br />
webCoRE is currently in the [https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha Alpha phase of the software release lifecycle] which means it can be unstable. Crashes, bugs, and potentially data loss are expected.<br />
<br />
== Installing webCoRE ==<br />
<br />
You must complete all of these steps.<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud.<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud.<br />
# [[Install webCoRE]] in SmartThings mobile app.<br />
# [[Enabling webCoRE dashboard]].<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Updating webCoRE ==<br />
<br />
== Components ==<br />
<br />
=== [[Dashboard|Dashboard]] ===<br />
webCoRE uses a web interface for most interactions with the user. The Dashboard is the central hub to controlling webCoRE.<br />
<br />
=== [[Piston|Pistons]] ===<br />
The building block of webCoRE is called a piston. It's really what drives the engine, after all. A piston is a standalone automation process that executes tasks based on predefined logic.<br />
<br />
== Getting started ==<br />
During the SmartApp installation process, you will be asked to enter a security password. Make sure to remember it, as you will need it to initialize the dashboard. You can always change the security password by going to the SmartThings SmartApp's Settings and tapping on ''Security''. You will also be asked to select a list of devices that webCoRE will have access to. You can change this list at any time by going back to the SmartThings SmartApp's Settings menu and tapping on ''Available Devices''. Once you completed the installation procedure, tap the ''Dashboard'' menu. This will open the Dashboard in a web browser that will swiftly prompt you for the security password. Enter the password and click ''Authorize'' and you should now see the Dashboard.<br />
[more details here]</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=60webCoRE2017-03-23T12:46:41Z<p>Whoismoses: </p>
<hr />
<div><br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions.<br />
<br />
webCoRE is currently in the [[ALPHA https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha]] phase which means it can be unstable. Crashes, bugs, and potentially data loss are expected.<br />
<br />
== Installing webCoRE ==<br />
<br />
You must complete all of these steps.<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud.<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud.<br />
# [[Install webCoRE]] in SmartThings mobile app.<br />
# [[Enabling webCoRE dashboard]].<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Updating webCoRE ==<br />
<br />
== Components ==<br />
<br />
=== [[Dashboard|Dashboard]] ===<br />
webCoRE uses a web interface for most interactions with the user. The Dashboard is the central hub to controlling webCoRE.<br />
<br />
=== [[Piston|Pistons]] ===<br />
The building block of webCoRE is called a piston. It's really what drives the engine, after all. A piston is a standalone automation process that executes tasks based on predefined logic.<br />
<br />
== Getting started ==<br />
During the SmartApp installation process, you will be asked to enter a security password. Make sure to remember it, as you will need it to initialize the dashboard. You can always change the security password by going to the SmartThings SmartApp's Settings and tapping on ''Security''. You will also be asked to select a list of devices that webCoRE will have access to. You can change this list at any time by going back to the SmartThings SmartApp's Settings menu and tapping on ''Available Devices''. Once you completed the installation procedure, tap the ''Dashboard'' menu. This will open the Dashboard in a web browser that will swiftly prompt you for the security password. Enter the password and click ''Authorize'' and you should now see the Dashboard.<br />
[more details here]</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Enabling_webCoRE_dashboard&diff=56Enabling webCoRE dashboard2017-03-23T03:09:22Z<p>Whoismoses: </p>
<hr />
<div># From within the SmartThings app, tap the Automations icon at the bottom of the screen and select the SmartApps section.<br />
# Scroll down and tap the name of the webCoRE instance you are trying to access. This is typically webCoRE, unless you edited the name during the installation process.<br />
# Tap Dashboard.<br />
# You will be prompted to enter the security password, the same password you created when you installed webCoRE.<br />
<br />
Note: This will give you access to webCoRE on your mobile device. If you want to configure webCoRE on another device, such as a laptop, you must [[Enable webCoRE on Another Device]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Enabling_webCoRE_dashboard&diff=55Enabling webCoRE dashboard2017-03-23T03:07:53Z<p>Whoismoses: Undo revision 54 by Whoismoses (talk)</p>
<hr />
<div># From a browser go to [https://dashboard.webcore.co/register webCoRE]<br />
# From within the SmartThings app, tap the '''Automations''' icon at the bottom of the screen.<br />
# Scroll down and tap '''webCore'''.<br />
# Tap '''Register a browser'''<br />
# Go back to the browser you opened earlier, enter the code generated by your app.<br />
<br />
That's it, start creating pistons.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Enabling_webCoRE_dashboard&diff=54Enabling webCoRE dashboard2017-03-23T03:07:06Z<p>Whoismoses: Reverted edits by Whoismoses (talk) to last revision by ady624</p>
<hr />
<div># From within the SmartThings app, tap the '''Automations''' icon at the bottom of the screen and select the '''SmartApps''' section.<br />
# Scroll down and tap the name of the webCoRE instance you are trying to access. This is typically '''webCoRE''', unless you edited the name during the installation process.<br />
# Tap '''Dashboard'''.<br />
# You will be prompted to enter the security password, the same password you created when you installed webCoRE.<br />
<br />
Note: This will give you access to webCoRE on your mobile device. If you want to configure webCoRE on another device, such as a laptop, you must [[Enable webCoRE on Another Device]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Enabling_webCoRE_dashboard&diff=53Enabling webCoRE dashboard2017-03-23T03:05:50Z<p>Whoismoses: </p>
<hr />
<div># From a browser go to [https://dashboard.webcore.co/register webCoRE]<br />
# From within the SmartThings app, tap the '''Automations''' icon at the bottom of the screen.<br />
# Scroll down and tap '''webCore'''.<br />
# Tap '''Register a browser'''<br />
# Go back to the browser you opened earlier, enter the code generated by your app.<br />
<br />
That's it, start creating pistons.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Enabling_webCoRE_dashboard&diff=52Enabling webCoRE dashboard2017-03-23T03:05:22Z<p>Whoismoses: </p>
<hr />
<div># From a browser go to [https://dashboard.webcore.co/register webCoRE]<br />
# From within the SmartThings app, tap the '''Automations''' icon at the bottom of the screen.<br />
# Scroll down and tap '''webCore'''.<br />
# Tap '''Register a browser'''<br />
# Go back to the browser you opened earlier, enter the code generated by your app.<br />
<br />
Note: This will give you access to webCoRE on your mobile device. If you want to configure webCoRE on another device such as a laptop you must [[Enable webCoRE on Another Device]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=40webCoRE2017-03-22T22:38:30Z<p>Whoismoses: /* Installing webCoRE */</p>
<hr />
<div><br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions.<br />
<br />
== Installing webCoRE ==<br />
<br />
You must complete all of these steps.<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud.<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud.<br />
# [[Install webCoRE]] in SmartThings mobile app.<br />
# [[Enabling webCoRE dashboard]].<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Components ==<br />
<br />
=== [[Dashboard|Dashboard]] ===<br />
webCoRE uses a web interface for most interactions with the user. The Dashboard is the central hub to controlling webCoRE.<br />
<br />
=== [[Piston|Pistons]] ===<br />
The building block of webCoRE is called a piston. It's really what drives the engine, after all. A piston is a standalone automation process that executes tasks based on predefined logic.<br />
<br />
== Getting started ==<br />
During the SmartApp installation process, you will be asked to enter a security password. Make sure to remember it, as you will need it to initialize the dashboard. You can always change the security password by going to the SmartThings SmartApp's Settings and tapping on ''Security''. You will also be asked to select a list of devices that webCoRE will have access to. You can change this list at any time by going back to the SmartThings SmartApp's Settings menu and tapping on ''Available Devices''. Once you completed the installation procedure, tap the ''Dashboard'' menu. This will open the Dashboard in a web browser that will swiftly prompt you for the security password. Enter the password and click ''Authorize'' and you should now see the Dashboard.<br />
[more details here]</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Manual_Install&diff=39Manual Install2017-03-22T22:37:39Z<p>Whoismoses: /* Installing Source Code into SmartThings Cloud */</p>
<hr />
<div>=Summary=<br />
These instructions will help you manually install webCoRE. It is recommended to do [[GitHub Install]], however these steps will also work.<br />
<br />
=Installing Source Code into SmartThings Cloud=<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''My SmartApps'''.<br />
# Click the '''New SmartApp''' button.<br />
# Select the '''From Code''' tab.<br />
# Copy all of the code from [https://github.com/ady624/webCoRE/blob/master/smartapps/ady624/webcore.src/webcore.groovy webCoRE.groovy] into the box.<br />
# Click '''Create'''.<br />
# Click '''Save'''.<br />
# Click '''Publish'''.<br />
# Click on '''My SmartApps'''.<br />
# Click the '''New SmartApp''' button.<br />
# Select the '''From Code''' tab.<br />
# Copy all of the code from [https://github.com/ady624/webCoRE/blob/master/smartapps/ady624/webcore-piston.src/webcore-piston.groovy webCoRE-piston.groovy] into the box.<br />
# Click '''Create'''.<br />
# Click '''Save'''.<br />
# Click '''Publish'''.<br />
<br />
Note: The webCoRE source code has only been copied to your SmartThings cloud account. You must continue to the next step of [[Enable webCoRE OAuth]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Manual_Install&diff=38Manual Install2017-03-22T22:37:26Z<p>Whoismoses: /* Installing Source Code into SmartThings Cloud */</p>
<hr />
<div>=Summary=<br />
These instructions will help you manually install webCoRE. It is recommended to do [[GitHub Install]], however these steps will also work.<br />
<br />
=Installing Source Code into SmartThings Cloud=<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''My SmartApps'''.<br />
# Click the '''New SmartApp''' button.<br />
# Select the '''From Code''' tab.<br />
# Copy all of the code from [https://github.com/ady624/webCoRE/blob/master/smartapps/ady624/webcore.src/webcore.groovy webCoRE.groovy] into the box.<br />
# Click '''Create'''.<br />
# Click '''Save'''.<br />
# Click '''Publish'''.<br />
# Click on '''My SmartApps'''.<br />
# Click the '''New SmartApp''' button.<br />
# Select the '''From Code''' tab.<br />
# Copy all of the code from [https://github.com/ady624/webCoRE/blob/master/smartapps/ady624/webcore-piston.src/webcore-piston.groovy webCore-piston.groovy] into the box.<br />
# Click '''Create'''.<br />
# Click '''Save'''.<br />
# Click '''Publish'''.<br />
<br />
Note: The webCoRE source code has only been copied to your SmartThings cloud account. You must continue to the next step of [[Enable webCoRE OAuth]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Manual_Install&diff=37Manual Install2017-03-22T22:36:58Z<p>Whoismoses: Created page with "=Summary= These instructions will help you manually install webCoRE. It is recommended to do GitHub Install, however these steps will also work. =Installing Source Code i..."</p>
<hr />
<div>=Summary=<br />
These instructions will help you manually install webCoRE. It is recommended to do [[GitHub Install]], however these steps will also work.<br />
<br />
=Installing Source Code into SmartThings Cloud=<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''My SmartApps'''.<br />
# Click the '''New SmartApp''' button.<br />
# Select the '''From Code''' tab.<br />
# Copy all of the code from [https://github.com/ady624/webCoRE/blob/master/smartapps/ady624/webcore.src/webcore.groovy webCoRE.groovy] into the box.<br />
# Click '''Create'''.<br />
# Click '''Save'''.<br />
# Click '''Publish'''.<br />
# Click on '''My SmartApps'''.<br />
# Click the '''New SmartApp''' button.<br />
# Select the '''From Code''' tab.<br />
# Copy all of the code from [[https://github.com/ady624/webCoRE/blob/master/smartapps/ady624/webcore-piston.src/webcore-piston.groovy] into the box.<br />
# Click '''Create'''.<br />
# Click '''Save'''.<br />
# Click '''Publish'''.<br />
<br />
Note: The webCoRE source code has only been copied to your SmartThings cloud account. You must continue to the next step of [[Enable webCoRE OAuth]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Enable_webCoRE_on_Another_Device&diff=36Enable webCoRE on Another Device2017-03-22T22:29:49Z<p>Whoismoses: Created page with "You cannot bookmark the URL you launched from the SmartThing app. In order to use webCoRE on another device you must follow these instructions. # Login to the [http://develop..."</p>
<hr />
<div>You cannot bookmark the URL you launched from the SmartThing app. In order to use webCoRE on another device you must follow these instructions.<br />
<br />
# Login to the [http://developer.smartthings.com SmartThings web UI].<br />
# Click on '''Live Logging''' at the top in the header.<br />
# Open your SmartThings app on your mobile device.<br />
# From within the SmartThings app, tap the '''Automations''' icon at the bottom of the screen.<br />
# Scroll down and tap '''webCore'''.<br />
# Back in '''Live Logging''' you will see a URL show up in the logs, it will begin with "*** DO NOT SHARE THIS LINK WITH ANYONE ***".<br />
# Bookmark this URL.<br />
<br />
That's it, start creating pistons.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=35webCoRE2017-03-22T22:22:50Z<p>Whoismoses: /* Installing webCoRE */</p>
<hr />
<div><br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions.<br />
<br />
== Installing webCoRE ==<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud.<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud.<br />
# [[Install webCoRE]] in SmartThings mobile app.<br />
# [[Enabling webCoRE dashboard]].<br />
# [[Enable webCoRE on Another Device]]<br />
<br />
== Components ==<br />
<br />
=== [[Dashboard|Dashboard]] ===<br />
webCoRE uses a web interface for most interactions with the user. The Dashboard is the central hub to controlling webCoRE.<br />
<br />
=== [[Piston|Pistons]] ===<br />
The building block of webCoRE is called a piston. It's really what drives the engine, after all. A piston is a standalone automation process that executes tasks based on predefined logic.<br />
<br />
== Getting started ==<br />
During the SmartApp installation process, you will be asked to enter a security password. Make sure to remember it, as you will need it to initialize the dashboard. You can always change the security password by going to the SmartThings SmartApp's Settings and tapping on ''Security''. You will also be asked to select a list of devices that webCoRE will have access to. You can change this list at any time by going back to the SmartThings SmartApp's Settings menu and tapping on ''Available Devices''. Once you completed the installation procedure, tap the ''Dashboard'' menu. This will open the Dashboard in a web browser that will swiftly prompt you for the security password. Enter the password and click ''Authorize'' and you should now see the Dashboard.<br />
[more details here]</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Enabling_webCoRE_dashboard&diff=34Enabling webCoRE dashboard2017-03-22T22:22:23Z<p>Whoismoses: Created page with "# From within the SmartThings app, tap the '''Automations''' icon at the bottom of the screen. # Scroll down and tap '''webCore'''. # Tap '''webCoRE Dashboard'''. # Enter your..."</p>
<hr />
<div># From within the SmartThings app, tap the '''Automations''' icon at the bottom of the screen.<br />
# Scroll down and tap '''webCore'''.<br />
# Tap '''webCoRE Dashboard'''.<br />
# Enter your password.<br />
<br />
Note: This will give you access to webCoRE on your mobile device. If you want to configure webCoRE on another device such as a laptop you must [[Enable webCoRE on Another Device]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Enable_webCoRE_OAuth&diff=33Enable webCoRE OAuth2017-03-22T22:19:15Z<p>Whoismoses: </p>
<hr />
<div># Navigate to the '''My SmartApps''' page if you are not already there.<br />
# Click the edit button to the left of '''ady624 : webCoRE''', it looks like a rounded square with a pencil in it.<br />
# Scroll down and click on '''OAuth'''.<br />
# Click the '''Enable OAuth in SmartApp''' button.<br />
# Click the '''Update''' button at the bottom of the page.<br />
<br />
Note: You have now enabled OAuth for the webCoRE app. Do not complete this step for the '''ady624 : webCoRE Piston''' app. You must continue on to the next step of [[Install webCoRE]] in the SmartThings mobile app.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Install_webCoRE&diff=32Install webCoRE2017-03-22T22:18:50Z<p>Whoismoses: </p>
<hr />
<div># Open the SmartThings app on your mobile device.<br />
# Tap the '''Marketplace''' icon at the bottom of the screen. If you are in a Room or Device within the app you will need to go back to '''My Home'''.<br />
# Tap the '''SmartApps''' header at the top of the page.<br />
# Scroll down and tap '''My Apps'''.<br />
# Scroll down until you find '''webCoRE''' and tap it. Do not tap '''webCoRE Piston'''. If you can't find '''webCore''' you likely skipped [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud.<br />
# Tap '''Next'''.<br />
# Choose a password and expiration length then tap '''Next'''.<br />
# Scroll through the list and select all of the devices you want webCoRE to have access to. If you do not do this, you will not be able to use those devices in webCoRE.<br />
# Tap '''Next'''.<br />
# Tap '''Done'''.<br />
<br />
Note: You have now installed the webCoRE SmartApp into your SmartThings mobile app. Unlike CoRE, webCoRE is entirely configured through a web browser. In order to continue you must continue to the next installation step of [[Enabling webCoRE dashboard]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Install_webCoRE&diff=31Install webCoRE2017-03-22T22:17:46Z<p>Whoismoses: </p>
<hr />
<div># Open the SmartThings app on your mobile device.<br />
# Tap the '''Marketplace''' icon at the bottom of the screen. If you are in a Room or Device within the app you will need to go back to '''My Home'''.<br />
# Tap the '''SmartApps''' header at the top of the page.<br />
# Scroll down and tap '''My Apps'''.<br />
# Scroll down until you find '''webCoRE''' and tap it. Do not tap '''webCoRE Piston'''.<br />
# Tap '''Next'''.<br />
# Choose a password and expiration length then tap '''Next'''.<br />
# Scroll through the list and select all of the devices you want webCoRE to have access to. If you do not do this, you will not be able to use those devices in webCoRE.<br />
# Tap '''Next'''.<br />
# Tap '''Done'''.<br />
<br />
Note: You have now installed the webCoRE SmartApp into your SmartThings mobile app. Unlike CoRE, webCoRE is entirely configured through a web browser. In order to continue you must continue to the next installation step of [[Enabling webCoRE dashboard]].</div>Whoismoseshttps://wiki.webcore.co/index.php?title=webCoRE&diff=30webCoRE2017-03-22T22:16:51Z<p>Whoismoses: /* Installing webCoRE */</p>
<hr />
<div><br />
== General ==<br />
The ''web Community's own Rule Engine'' (or for short, webCoRE) is a general rule engine for SmartThings. It works by allowing users to create scripts that are interpreted and executed by the SmartThings SmartApp, allowing for complex decisions.<br />
<br />
== Installing webCoRE ==<br />
<br />
# [[GitHub Install]] or [[Manual Install]] of webCoRE source code into the SmartThings Cloud.<br />
# [[Enable webCoRE OAuth]] in the SmartThings cloud.<br />
# [[Install webCoRE]] in SmartThings mobile app.<br />
# [[Enabling webCoRE dashboard]].<br />
<br />
== Components ==<br />
<br />
=== [[Dashboard|Dashboard]] ===<br />
webCoRE uses a web interface for most interactions with the user. The Dashboard is the central hub to controlling webCoRE.<br />
<br />
=== [[Piston|Pistons]] ===<br />
The building block of webCoRE is called a piston. It's really what drives the engine, after all. A piston is a standalone automation process that executes tasks based on predefined logic.<br />
<br />
== Getting started ==<br />
During the SmartApp installation process, you will be asked to enter a security password. Make sure to remember it, as you will need it to initialize the dashboard. You can always change the security password by going to the SmartThings SmartApp's Settings and tapping on ''Security''. You will also be asked to select a list of devices that webCoRE will have access to. You can change this list at any time by going back to the SmartThings SmartApp's Settings menu and tapping on ''Available Devices''. Once you completed the installation procedure, tap the ''Dashboard'' menu. This will open the Dashboard in a web browser that will swiftly prompt you for the security password. Enter the password and click ''Authorize'' and you should now see the Dashboard.<br />
[more details here]</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Install_webCoRE&diff=29Install webCoRE2017-03-22T22:16:24Z<p>Whoismoses: </p>
<hr />
<div># Open the SmartThings app on your mobile device.<br />
# Tap the '''Marketplace''' icon at the bottom of the screen. If you are in a Room or Device within the app you will need to go back to '''My Home'''.<br />
# Tap the '''SmartApps''' header at the top of the page.<br />
# Scroll down and tap '''My Apps'''.<br />
# Scroll down until you find '''webCoRE''' and tap it. Do not tap '''webCoRE Piston'''.<br />
# Tap '''Next'''.<br />
# Choose a password and expiration length then tap '''Next'''.<br />
# Scroll through the list and select all of the devices you want webCoRE to have access to. If you do not do this, you will not be able to use those devices in webCoRE.<br />
# Tap '''Next'''.<br />
# Tap '''Done'''.<br />
<br />
Note: You have now installed the webCoRE SmartApp into your SmartThings mobile app.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Install_webCoRE&diff=28Install webCoRE2017-03-22T22:13:04Z<p>Whoismoses: Created page with "# Open the SmartThings app on your mobile device. # Tap the '''Marketplace''' icon at the bottom of the screen. If you are in a Room or Device within the app you will need to..."</p>
<hr />
<div># Open the SmartThings app on your mobile device.<br />
# Tap the '''Marketplace''' icon at the bottom of the screen. If you are in a Room or Device within the app you will need to go back to '''My Home'''.<br />
# Tap the '''SmartApps''' header at the top of the page.<br />
# Scroll down and tap '''My Apps'''.<br />
# Scroll down until you find '''webCoRE''' and tap it. Do not tap '''webCoRE Piston'''.<br />
# Tap '''Next'''.<br />
# Choose a password and expiration length then tap '''Next'''.</div>Whoismoseshttps://wiki.webcore.co/index.php?title=Enable_webCoRE_OAuth&diff=27Enable webCoRE OAuth2017-03-22T22:05:14Z<p>Whoismoses: </p>
<hr />
<div># Navigate to the '''My SmartApps''' page if you are not already there.<br />
# Click the edit button to the left of '''ady624 : webCoRE''', it looks like a rounded square with a pencil in it.<br />
# Scroll down and click on '''OAuth'''.<br />
# Click the '''Enable OAuth in SmartApp''' button.<br />
# Click the '''Update''' button at the bottom of the page.<br />
<br />
You have now enabled OAuth for the webCoRE app. Do not complete this step for the '''ady624 : webCoRE Piston''' app. You must continue on to the next step of [[Install webCoRE]] in the SmartThings mobile app.</div>Whoismoses