https://docs.hubitat.com/api.php?action=feedcontributions&user=Cschwer&feedformat=atomHubitat Documentation - User contributions [en]2024-03-26T03:28:07ZUser contributionsMediaWiki 1.31.0https://docs.hubitat.com/index.php?title=Common_Methods_Object&diff=3072Common Methods Object2020-07-15T19:32:06Z<p>Cschwer: /* Additional to be documented */</p>
<hr />
<div>These methods can be used in both Apps and Drivers<br />
<br />
===<code>celsiusToFahrenheit</code>===<br />
:Converts a given Celsius temperature to Fahrenheit.<br />
<br />
:;Signature<br />
:: <code>BigDecimal celsiusToFahrenheit(BigDecimal val)</code><br />
<br />
:;Parameters<br />
:: A temperature in Celsius.<br />
<br />
:;Returns<br />
:: The specified temperature in Fahrenheit.<br />
<br />
===<code>fahrenheitToCelsius</code>===<br />
:Converts a given Fahrenheit temperature to Celsius<br />
<br />
:;Signature<br />
:: <code>BigDecimal fahrenheitToCelsius(BigDecimal val)</code><br />
<br />
:;Parameters<br />
:: A temperature in Fahrenheit.<br />
<br />
:;Returns<br />
:: The specified temperature in Celsius.<br />
<br />
===<code>getLocation</code>===<br />
:;Signature<br />
:: <code>Location getLocation()</code><br />
<br />
===<code>getSunriseAndSunset</code>===<br />
:Returns the sunset and sunrise values for the current day. (Common method since 2.1.0)<br />
<br />
:;Signature<br />
:: <code>Map getSunriseAndSunset()</code><br />
:: <code>Map getSunriseAndSunset(Map options)</code><br />
<br />
:;Parameters<br />
:: options - Map with optional offset for sunrise or sunset, possible values are sunriseOffset and sunsetOffset and can either be a number of minutes or a String of the format Hours:Minutes<br />
<br />
:;Returns<br />
:: Map with with key values 'sunrise' and 'sunset' of type Date<br />
<br />
:;Examples<br />
<br />
// get today's sunrise and sunset<br />
def riseAndSet = getSunriseAndSunset()<br />
log.debug riseAndSet.sunrise<br />
log.debug riseAndSet.sunset<br />
<br />
// get sunrise time offset by 1 minute early, and get sunset offset by 1 hour, 5 minutes later<br />
def offsetRiseAndSet = getSunriseAndSunset(sunriseOffset: -1, sunsetOffset: "1:05")<br />
<br />
===<code>getTemperatureScale</code>===<br />
:Get the current temperature scale set for the hub.<br />
<br />
:;Signature<br />
:: <code>String getTemperatureScale()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
:: String - "F" or "C" based on the setting in the hub.<br />
<br />
===<code>now</code>===<br />
:;Signature<br />
:: long now()<br />
<br />
===<code>timeToday</code>===<br />
: Get a Date object with today's date and the time specified<br />
<br />
:;Signature<br />
:: <code>Date timeToday(String timeString, TimeZone timeZone = null)</code><br />
<br />
:;Parameters<br />
:: timeString - The time to use, can be either "HH:mm" or and ISO8601 date/time string<br />
:: timeZone - (Optional) The timezone to use for the new Date.<br />
<br />
:;Returns<br />
:: Date - A Date object with today's date and the time that was passed as timeString<br />
<br />
<br />
===<code>timeOfDayIsBetween</code>===<br />
:Check if a date is between two dates.<br />
<br />
:;Signature<br />
:: <code>boolean timeOfDayIsBetween(Date start, Date stop, Date value[, TimeZone timeZone])</code><br />
<br />
:;Parameters<br />
<br />
:: start - The date to start comparison against.<br />
:: stop - The date to stop comparison against.<br />
:: value - The date to compare<br />
:: timezone - (Optional) The timezone to use for the comparison<br />
<br />
:;Returns<br />
:: boolean - true if the value date is between the start and stop dates, otherwise returns false.<br />
<br />
<br />
===<code>unschedule</code>===<br />
:Remove any scheduled tasks. If method is called without paramters, all schedules will be removed.<br />
<br />
:;Signature<br />
:: <code>void unschedule()</code><br />
:: <code>void unschedule(handlerMethod)</code><br />
<br />
:;Parameters<br />
:: handlerMethod - Only remove schedules for this handlerMethod<br />
<br />
===<code>asynchttpGet</code>===<br />
:Send an http GET request and return control to the calling code. Any response from the call will be passed to the callback method.<br />
<br />
:;Signature<br />
:: <code>void asynchttpGet(callbackMethod, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
:: callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
:: params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPost</code>===<br />
:;Signature<br />
::<code>void asynchttpPost(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPatch</code>===<br />
:;Signature<br />
::<code>void asynchttpPatch(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http PATCH call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>httpGet</code>===<br />
:Send an http GET request. Any response from the call will be passed to the closure.<br />
<br />
:;Signature<br />
:: <code>void httpGet(String uri, Closure closure)</code><br />
:: <code>void httpGet(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPost</code>===<br />
:;Signature<br />
:: <code>void httpPost(String uri, String body, Closure closure)</code><br />
:: <code>void httpPost(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPostJson</code>===<br />
:Similar to httpPost except that the contentType parameter is set to "application/json"<br />
:;Signature<br />
:: <code>void httpPostJson(String uri, String stringBody, Closure closure)</code><br />
:: <code>void httpPostJson(String uri, Map mapBody, Closure closure)</code><br />
:: <code>void httpPostJson(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::stringBody - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::mapBody - The body of the request as a Map.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it as JSON.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.8) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPut</code>===<br />
:;Signature<br />
:: <code>void httpPut(String uri, String body, Closure closure)</code><br />
:: <code>void httpPut(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPatch (Since 2.1.7)</code>===<br />
:;Signature<br />
:: <code>void httpPatch(String uri, String body, Closure closure)</code><br />
:: <code>void httpPatch(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>runIn</code>===<br />
:;Signature<br />
::<code>void runIn(Long delayInSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
::delayInSeconds - How long to wait in seconds until the handler should be called, don't expect that it will be called in exactly that time.<br />
::handlerMethod - The name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a scheduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
runIn(50, 'myMethod', [data: ["myKey":"myValue"]])<br />
</pre><br />
<br />
===<code>runInMillis</code>===<br />
:;Signature<br />
:: <code>void runInMillis(Long delayInMilliSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
:: delayInMilliseconds - How long to wait until the handler should be called, don't expect that it will be called in exactly that time.<br />
:: handlerMethod - the name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a schduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
private processQueue(Map queue) {<br />
if (isQueueEmpty(queue)) {<br />
sendEvent name: 'lifxdiscovery', value: 'complete'<br />
return<br />
}<br />
def data = getNext(queue)<br />
sendPacket data.ipAddress, data.packet<br />
runInMillis(queue.delay, 'processQueue', [data: queue])<br />
}<br />
<br />
runInMillis(50, 'processQueue', [data: queue])<br />
</pre><br />
<br />
===<code>pauseExecution</code>===<br />
:;Signature<br />
:: <code> void pauseExecution(Long millisecs)</code><br />
<br />
:;Parameters<br />
:: millisecs - The amount of time in milliseconds to pause.<br />
<br />
===<code>textToSpeech</code>===<br />
:Converts text to speech.<br />
<br />
:;Signature<br />
:: <code> Map textToSpeech(String stringToBeSynthesized, String voice = null)</code><br />
<br />
:;Parameters<br />
::stringToBeSynthesized - The text to be converted to audio. The text may contain supported [https://docs.aws.amazon.com/polly/latest/dg/supportedtags.html SSML tags].<br />
::voice - The name of a voice supported by Amazon Polly, you can find a list of voices [https://docs.aws.amazon.com/polly/latest/dg/voicelist.html here]. If not specified the default system setting is used.<br />
<br />
:;Returns<br />
:: Map - Returns a Map with two entries, <code>uri</code> which contains a URI to the MP3 file and <code>duration</code> is the length of the MP3 in seconds.<br />
<br />
===<code>getTTSVoices</code>===<br />
:Returns a list of the supported text-to-speech voices.<br />
<br />
:;Signature<br />
:: <code> Map getTTSVoices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
:: Map - Returns a Map with three entries <code>name</code> which is the name of a voice that can be specified to <code>textToSpeech</code>, <code>gender</code> which contains either Male or Female, and <code>language</code> which contains the language of this voice.<br />
<br />
===<code>toDateTime</code>===<br />
:;Signature<br />
:: <code>Date toDateTime(String dateTimeString)</code><br />
<br />
:;Parameters<br />
::dateTimeString - A date/time string in ISO8601 format. ("yyyy-MM-dd", "yyyyMMdd'T'HHmmssX", "yyyy-MM-dd'T'HH:mm:ssX", "yyyy-MM-dd'T'HH:mm:ss.SSSX")<br />
<br />
<br />
===<code>schedule</code>===<br />
:;Signature<br />
:: <code>void schedule(String expression, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
::expression - a [http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html 7] parameter [http://www.quartz-scheduler.org/ quartz] cron string where the expression is: "Seconds" "Minutes" "Hours" "Day Of Month" "Month" "Day Of Week" "Year"<br />
::handlerMethod - method to run at given schedule<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
<br />
:;Example<br />
// run 'mymethod' every tenth minute.<br />
schedule('0 */10 * ? * *', mymethod)<br />
<br />
==<code>Additional to be documented</code>==<br />
<br />
'''Signature:'''<br />
void httpPutJson(String uri, String body, Closure closure)<br />
void httpPutJson(String uri, Map body, Closure closure)<br />
void httpPutJson(Map params, Closure closure)<br />
void httpDelete(Map params, Closure closure)<br />
String getMACFromIP(String ipAddr)<br />
String convertTemperatureIfNeeded(BigDecimal value, String scale, Integer precision)<br />
Object parseJson(String stringToParse)<br />
Object parseJsonFromBase64(String stringToParse)<br />
GPathResult parseXML(String stringToParse)<br />
Map parseLanMessage(String stringToParse)<br />
void runEvery1Minute(String handlerMethod, Map options = null)<br />
void runEvery5Minutes(String handlerMethod, Map options = null)<br />
void runEvery10Minutes(String handlerMethod, Map options = null)<br />
void runEvery15Minutes(String handlerMethod, Map options = null)<br />
void runEvery30Minutes(String handlerMethod, Map options = null)<br />
void runEvery1Hour(String handlerMethod, Map options = null)<br />
void runEvery3Hours(String handlerMethod, Map options = null)<br />
void runOnce(Date dateTime, String handlerMethod, Map options = null)<br />
void runOnce(String dateTime, String handlerMethod, Map options = null)<br />
void schedule(Date dateTime, String handlerMethod, Map options = null)<br />
void asynchttpPut(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpDelete(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpHead(String callbackMethod = null, Map params, Map data = null)<br />
String encrypt(String value)<br />
String decrypt(String value)<br />
void sendLocationEvent(Map properties)<br />
Date timeTodayAfter(String startTimeString, String timeString, TimeZone timeZone = null) (Common method since 2.1.0)<br />
Long timeOffset(Number minutes) (Common method since 2.1.0)<br />
Long timeOffset(String hoursAndMinutesString) (Common method since 2.1.0)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Common_Methods_Object&diff=3071Common Methods Object2020-07-15T19:24:23Z<p>Cschwer: </p>
<hr />
<div>These methods can be used in both Apps and Drivers<br />
<br />
===<code>celsiusToFahrenheit</code>===<br />
:Converts a given Celsius temperature to Fahrenheit.<br />
<br />
:;Signature<br />
:: <code>BigDecimal celsiusToFahrenheit(BigDecimal val)</code><br />
<br />
:;Parameters<br />
:: A temperature in Celsius.<br />
<br />
:;Returns<br />
:: The specified temperature in Fahrenheit.<br />
<br />
===<code>fahrenheitToCelsius</code>===<br />
:Converts a given Fahrenheit temperature to Celsius<br />
<br />
:;Signature<br />
:: <code>BigDecimal fahrenheitToCelsius(BigDecimal val)</code><br />
<br />
:;Parameters<br />
:: A temperature in Fahrenheit.<br />
<br />
:;Returns<br />
:: The specified temperature in Celsius.<br />
<br />
===<code>getLocation</code>===<br />
:;Signature<br />
:: <code>Location getLocation()</code><br />
<br />
===<code>getSunriseAndSunset</code>===<br />
:Returns the sunset and sunrise values for the current day. (Common method since 2.1.0)<br />
<br />
:;Signature<br />
:: <code>Map getSunriseAndSunset()</code><br />
:: <code>Map getSunriseAndSunset(Map options)</code><br />
<br />
:;Parameters<br />
:: options - Map with optional offset for sunrise or sunset, possible values are sunriseOffset and sunsetOffset and can either be a number of minutes or a String of the format Hours:Minutes<br />
<br />
:;Returns<br />
:: Map with with key values 'sunrise' and 'sunset' of type Date<br />
<br />
:;Examples<br />
<br />
// get today's sunrise and sunset<br />
def riseAndSet = getSunriseAndSunset()<br />
log.debug riseAndSet.sunrise<br />
log.debug riseAndSet.sunset<br />
<br />
// get sunrise time offset by 1 minute early, and get sunset offset by 1 hour, 5 minutes later<br />
def offsetRiseAndSet = getSunriseAndSunset(sunriseOffset: -1, sunsetOffset: "1:05")<br />
<br />
===<code>getTemperatureScale</code>===<br />
:Get the current temperature scale set for the hub.<br />
<br />
:;Signature<br />
:: <code>String getTemperatureScale()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
:: String - "F" or "C" based on the setting in the hub.<br />
<br />
===<code>now</code>===<br />
:;Signature<br />
:: long now()<br />
<br />
===<code>timeToday</code>===<br />
: Get a Date object with today's date and the time specified<br />
<br />
:;Signature<br />
:: <code>Date timeToday(String timeString, TimeZone timeZone = null)</code><br />
<br />
:;Parameters<br />
:: timeString - The time to use, can be either "HH:mm" or and ISO8601 date/time string<br />
:: timeZone - (Optional) The timezone to use for the new Date.<br />
<br />
:;Returns<br />
:: Date - A Date object with today's date and the time that was passed as timeString<br />
<br />
<br />
===<code>timeOfDayIsBetween</code>===<br />
:Check if a date is between two dates.<br />
<br />
:;Signature<br />
:: <code>boolean timeOfDayIsBetween(Date start, Date stop, Date value[, TimeZone timeZone])</code><br />
<br />
:;Parameters<br />
<br />
:: start - The date to start comparison against.<br />
:: stop - The date to stop comparison against.<br />
:: value - The date to compare<br />
:: timezone - (Optional) The timezone to use for the comparison<br />
<br />
:;Returns<br />
:: boolean - true if the value date is between the start and stop dates, otherwise returns false.<br />
<br />
<br />
===<code>unschedule</code>===<br />
:Remove any scheduled tasks. If method is called without paramters, all schedules will be removed.<br />
<br />
:;Signature<br />
:: <code>void unschedule()</code><br />
:: <code>void unschedule(handlerMethod)</code><br />
<br />
:;Parameters<br />
:: handlerMethod - Only remove schedules for this handlerMethod<br />
<br />
===<code>asynchttpGet</code>===<br />
:Send an http GET request and return control to the calling code. Any response from the call will be passed to the callback method.<br />
<br />
:;Signature<br />
:: <code>void asynchttpGet(callbackMethod, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
:: callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
:: params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPost</code>===<br />
:;Signature<br />
::<code>void asynchttpPost(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPatch</code>===<br />
:;Signature<br />
::<code>void asynchttpPatch(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http PATCH call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>httpGet</code>===<br />
:Send an http GET request. Any response from the call will be passed to the closure.<br />
<br />
:;Signature<br />
:: <code>void httpGet(String uri, Closure closure)</code><br />
:: <code>void httpGet(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPost</code>===<br />
:;Signature<br />
:: <code>void httpPost(String uri, String body, Closure closure)</code><br />
:: <code>void httpPost(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPostJson</code>===<br />
:Similar to httpPost except that the contentType parameter is set to "application/json"<br />
:;Signature<br />
:: <code>void httpPostJson(String uri, String stringBody, Closure closure)</code><br />
:: <code>void httpPostJson(String uri, Map mapBody, Closure closure)</code><br />
:: <code>void httpPostJson(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::stringBody - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::mapBody - The body of the request as a Map.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it as JSON.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.8) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPut</code>===<br />
:;Signature<br />
:: <code>void httpPut(String uri, String body, Closure closure)</code><br />
:: <code>void httpPut(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPatch (Since 2.1.7)</code>===<br />
:;Signature<br />
:: <code>void httpPatch(String uri, String body, Closure closure)</code><br />
:: <code>void httpPatch(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>runIn</code>===<br />
:;Signature<br />
::<code>void runIn(Long delayInSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
::delayInSeconds - How long to wait in seconds until the handler should be called, don't expect that it will be called in exactly that time.<br />
::handlerMethod - The name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a scheduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
runIn(50, 'myMethod', [data: ["myKey":"myValue"]])<br />
</pre><br />
<br />
===<code>runInMillis</code>===<br />
:;Signature<br />
:: <code>void runInMillis(Long delayInMilliSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
:: delayInMilliseconds - How long to wait until the handler should be called, don't expect that it will be called in exactly that time.<br />
:: handlerMethod - the name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a schduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
private processQueue(Map queue) {<br />
if (isQueueEmpty(queue)) {<br />
sendEvent name: 'lifxdiscovery', value: 'complete'<br />
return<br />
}<br />
def data = getNext(queue)<br />
sendPacket data.ipAddress, data.packet<br />
runInMillis(queue.delay, 'processQueue', [data: queue])<br />
}<br />
<br />
runInMillis(50, 'processQueue', [data: queue])<br />
</pre><br />
<br />
===<code>pauseExecution</code>===<br />
:;Signature<br />
:: <code> void pauseExecution(Long millisecs)</code><br />
<br />
:;Parameters<br />
:: millisecs - The amount of time in milliseconds to pause.<br />
<br />
===<code>textToSpeech</code>===<br />
:Converts text to speech.<br />
<br />
:;Signature<br />
:: <code> Map textToSpeech(String stringToBeSynthesized, String voice = null)</code><br />
<br />
:;Parameters<br />
::stringToBeSynthesized - The text to be converted to audio. The text may contain supported [https://docs.aws.amazon.com/polly/latest/dg/supportedtags.html SSML tags].<br />
::voice - The name of a voice supported by Amazon Polly, you can find a list of voices [https://docs.aws.amazon.com/polly/latest/dg/voicelist.html here]. If not specified the default system setting is used.<br />
<br />
:;Returns<br />
:: Map - Returns a Map with two entries, <code>uri</code> which contains a URI to the MP3 file and <code>duration</code> is the length of the MP3 in seconds.<br />
<br />
===<code>getTTSVoices</code>===<br />
:Returns a list of the supported text-to-speech voices.<br />
<br />
:;Signature<br />
:: <code> Map getTTSVoices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
:: Map - Returns a Map with three entries <code>name</code> which is the name of a voice that can be specified to <code>textToSpeech</code>, <code>gender</code> which contains either Male or Female, and <code>language</code> which contains the language of this voice.<br />
<br />
===<code>toDateTime</code>===<br />
:;Signature<br />
:: <code>Date toDateTime(String dateTimeString)</code><br />
<br />
:;Parameters<br />
::dateTimeString - A date/time string in ISO8601 format. ("yyyy-MM-dd", "yyyyMMdd'T'HHmmssX", "yyyy-MM-dd'T'HH:mm:ssX", "yyyy-MM-dd'T'HH:mm:ss.SSSX")<br />
<br />
<br />
===<code>schedule</code>===<br />
:;Signature<br />
:: <code>void schedule(String expression, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
::expression - a [http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html 7] parameter [http://www.quartz-scheduler.org/ quartz] cron string where the expression is: "Seconds" "Minutes" "Hours" "Day Of Month" "Month" "Day Of Week" "Year"<br />
::handlerMethod - method to run at given schedule<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
<br />
:;Example<br />
// run 'mymethod' every tenth minute.<br />
schedule('0 */10 * ? * *', mymethod)<br />
<br />
==<code>Additional to be documented</code>==<br />
<br />
'''Signature:'''<br />
void httpPutJson(String uri, String body, Closure closure)<br />
void httpPutJson(String uri, Map body, Closure closure)<br />
void httpPutJson(Map params, Closure closure)<br />
void httpDelete(Map params, Closure closure)<br />
String getMACFromIP(String ipAddr)<br />
String convertTemperatureIfNeeded(BigDecimal value, String scale, Integer precision)<br />
Object parseJson(String stringToParse)<br />
GPathResult parseXML(String stringToParse)<br />
Map parseLanMessage(String stringToParse)<br />
void runEvery1Minute(String handlerMethod, Map options = null)<br />
void runEvery5Minutes(String handlerMethod, Map options = null)<br />
void runEvery10Minutes(String handlerMethod, Map options = null)<br />
void runEvery15Minutes(String handlerMethod, Map options = null)<br />
void runEvery30Minutes(String handlerMethod, Map options = null)<br />
void runEvery1Hour(String handlerMethod, Map options = null)<br />
void runEvery3Hours(String handlerMethod, Map options = null)<br />
void runOnce(Date dateTime, String handlerMethod, Map options = null)<br />
void runOnce(String dateTime, String handlerMethod, Map options = null)<br />
void schedule(Date dateTime, String handlerMethod, Map options = null)<br />
void asynchttpPut(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpDelete(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpHead(String callbackMethod = null, Map params, Map data = null)<br />
String encrypt(String value)<br />
String decrypt(String value)<br />
void sendLocationEvent(Map properties)<br />
Date timeTodayAfter(String startTimeString, String timeString, TimeZone timeZone = null) (Common method since 2.1.0)<br />
Long timeOffset(Number minutes) (Common method since 2.1.0)<br />
Long timeOffset(String hoursAndMinutesString) (Common method since 2.1.0)</div>Cschwerhttps://docs.hubitat.com/index.php?title=MQTT_Interface&diff=3069MQTT Interface2020-07-14T01:45:04Z<p>Cschwer: /* Hubitat Provided Methods (Since 2.1.2) */</p>
<hr />
<div>=Overview=<br />
Hubitat allows for opening and maintaining a connection to an MQTT broker from the hub. All code needs to be contained in a driver, there is no option to open an MQTT client connection from an app. Hubitat provides methods to connect and disconnect to the broker, subscribe and publish messages to topics. In addition it is required to create a method in the driver that accepts incoming messages (parse) and another method that will be called with any status updates for the client connection (mqttClientStatus).<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods (Since 2.1.2) ==<br />
<br />
===<code>connect</code>===<br />
<br />
:;Signature<br />
:: <code>void connect(String broker, String clientId, String username, String password)</code><br />
:: <code>void connect(String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
:::''cleanSession'' - Option to set the clean_session flag for the connection (Since 2.2.2)<br />
:::''tlsVersion'' - The TLS version to use when connecting to broker, possible values are 1.0, 1.1, 1.2 Defaults to 1.2 if not specified (Since 2.2.2)<br />
:::''caCertificate'' - The CA certificate for the TLS/SSL connection in PEM format (Since 2.2.2)<br />
:::''clientCertificate'' - The client certificate (X.509) for the TLS connection in PEM format. Optional but requires privateKey is specifed (Since 2.2.2)<br />
:::''privateKey'' - The private key for the TLS connection in PEM format. Optional but requires clientCertificate if specified (Since 2.2.2)<br />
<br />
:;Examples<br />
<br />
<pre><br />
// Connect to MQTT broker<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
</pre><br />
<br />
<pre><br />
// Connect to MQTT broker with last will<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", <br />
"mqtttest456", <br />
null, <br />
null, <br />
lastWillTopic: "/my/last/will", <br />
lastWillQos: 0, <br />
lastWillMessage: "I died")<br />
</pre><br />
<br />
<pre><br />
// connect to MQTT broker with TLS and certificate (AWS IOT Core)<br />
// Note, all 4 parameters (tlsVersion, privateKey, caCertificate, clientCertificate) are required for TLS secure connection<br />
// if any are missing the connection won't work or will fall back to non secure<br />
String clientCert = """-----BEGIN CERTIFICATE-----<br />
MIIDWjCCAkKgAwIBAgIVANPd/DAZc5xaB3y6tuyA4Vi2pdyfMA0GCSqGSIb3DQEB<br />
...<br />
7qr3/l5YwtmArBPXAS4s60bfFwEVrLEpS9QPAIMnAFNWRkuwDNR1EZ3TcP12Ew==<br />
-----END CERTIFICATE-----"""<br />
<br />
String caCert = """-----BEGIN CERTIFICATE-----<br />
MIIEkjCCA3qgAwIBAgITBn+USionzfP6wq4rAfkI7rnExjANBgkqhkiG9w0BAQsF<br />
...<br />
akcjMS9cmvqtmg5iUaQqqcT5NJ0hGA==<br />
-----END CERTIFICATE-----"""<br />
<br />
String privateKey = """-----BEGIN RSA PRIVATE KEY-----<br />
MIIEpQIBAAKCAQEA3D1ZquBWJDtLOpVlDwYHW0ayaE+T9ZPV/bq39NT1KaKG+1w3<br />
...<br />
AeuFNEqh9ExHLMPw/McjOKQ+4oG42ZGox7WekbIWMt0CZvlbFYE0Ha0=<br />
-----END RSA PRIVATE KEY-----"""<br />
<br />
interfaces.mqtt.connect("ssl://q65g7jujvagsuy-ats.iot.us-east-2.amazonaws.com", <br />
'testClient', <br />
null, <br />
null, <br />
tlsVersion: "1.2", <br />
privateKey: privateKey, <br />
caCertificate: caCert, <br />
clientCertificate: clientCert)<br />
</pre><br />
<br />
===<code>disconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void disconnect()</code><br />
<br />
===<code>subscribe</code>===<br />
:;Signature<br />
:: <code>void subscribe(String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>isConnected</code>===<br />
:;Signature<br />
:: <code> boolean isConnected()</code><br />
<br />
:;Returns<br />
:: boolean - true if client is connected, false otherwise.<br />
<br />
===<code>unsubscribe</code>===<br />
:;Signature<br />
:: <code>void unsubscribe(String topicFilter)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>publish</code>===<br />
:;Signature<br />
:: <code>void publish(String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMessage</code>===<br />
:;Signature<br />
:: <code>Map parseMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
:;Examples<br />
<br />
// parse message<br />
interfaces.mqtt.parseMessage(description)<br />
<br />
==Hubitat Provided Methods (Deprecated) ==<br />
<br />
===<code>mqttConnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password)</code><br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
<br />
:;Examples<br />
<br />
// Connect to MQTT broker<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
<br />
// Connect to MQTT broker with last will<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest456", null, null, lastWillTopic: "/my/last/will", lastWillQos: 0, lastWillMessage: "I died")<br />
<br />
<br />
===<code>mqttDisconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttDisconnect(DeviceWrapper device)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
<br />
===<code>mqttSubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttSubscribe(DeviceWrapper device, String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>mqttUnsubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttUnsubscribe(DeviceWrapper device, String topicFilter)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>mqttPublish</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttPublish(DeviceWrapper device, String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMqttMessage</code>===<br />
:;Signature<br />
:: <code>Map hubitat.helper.InterfaceUtils.alphaV1parseMqttMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
==User defined methods==<br />
<br />
===<code>parse(String message)</code>=== <br />
This method is called with any incoming messages from the subscribed topics of the MQTT broker. This is a standard method for drivers.<br />
<br />
===<code>mqttClientStatus(String message)</code>=== <br />
This method is called with any status messages from the MQTT client connection (disconnections, errors during connect, etc)<br />
The string that is passed to this method with start with "Error" if an error occurred or "Status" if this is just a status message.</div>Cschwerhttps://docs.hubitat.com/index.php?title=MQTT_Interface&diff=3068MQTT Interface2020-07-12T14:18:27Z<p>Cschwer: /* Hubitat Provided Methods (Since 2.1.2) */</p>
<hr />
<div>=Overview=<br />
Hubitat allows for opening and maintaining a connection to an MQTT broker from the hub. All code needs to be contained in a driver, there is no option to open an MQTT client connection from an app. Hubitat provides methods to connect and disconnect to the broker, subscribe and publish messages to topics. In addition it is required to create a method in the driver that accepts incoming messages (parse) and another method that will be called with any status updates for the client connection (mqttClientStatus).<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods (Since 2.1.2) ==<br />
<br />
===<code>connect</code>===<br />
<br />
:;Signature<br />
:: <code>void connect(String broker, String clientId, String username, String password)</code><br />
:: <code>void connect(String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
:::''cleanSession'' - Option to set the clean_session flag for the connection (Since 2.2.2)<br />
:::''tlsVersion'' - The TLS version to use when connecting to broker, possible values are 1.0, 1.1, 1.2 (Since 2.2.2)<br />
:::''caCertificate'' - The CA certificate for the TLS connection in PEM format (Since 2.2.2)<br />
:::''clientCertificate'' - The client certificate (X.509) for the TLS connection in PEM format (Since 2.2.2)<br />
:::''privateKey'' - The private key for the TLS connection in PEM format (Since 2.2.2)<br />
<br />
:;Examples<br />
<br />
<pre><br />
// Connect to MQTT broker<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
</pre><br />
<br />
<pre><br />
// Connect to MQTT broker with last will<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", <br />
"mqtttest456", <br />
null, <br />
null, <br />
lastWillTopic: "/my/last/will", <br />
lastWillQos: 0, <br />
lastWillMessage: "I died")<br />
</pre><br />
<br />
<pre><br />
// connect to MQTT broker with TLS and certificate (AWS IOT Core)<br />
// Note, all 4 parameters (tlsVersion, privateKey, caCertificate, clientCertificate) are required for TLS secure connection<br />
// if any are missing the connection won't work or will fall back to non secure<br />
String clientCert = """-----BEGIN CERTIFICATE-----<br />
MIIDWjCCAkKgAwIBAgIVANPd/DAZc5xaB3y6tuyA4Vi2pdyfMA0GCSqGSIb3DQEB<br />
...<br />
7qr3/l5YwtmArBPXAS4s60bfFwEVrLEpS9QPAIMnAFNWRkuwDNR1EZ3TcP12Ew==<br />
-----END CERTIFICATE-----"""<br />
<br />
String caCert = """-----BEGIN CERTIFICATE-----<br />
MIIEkjCCA3qgAwIBAgITBn+USionzfP6wq4rAfkI7rnExjANBgkqhkiG9w0BAQsF<br />
...<br />
akcjMS9cmvqtmg5iUaQqqcT5NJ0hGA==<br />
-----END CERTIFICATE-----"""<br />
<br />
String privateKey = """-----BEGIN RSA PRIVATE KEY-----<br />
MIIEpQIBAAKCAQEA3D1ZquBWJDtLOpVlDwYHW0ayaE+T9ZPV/bq39NT1KaKG+1w3<br />
...<br />
AeuFNEqh9ExHLMPw/McjOKQ+4oG42ZGox7WekbIWMt0CZvlbFYE0Ha0=<br />
-----END RSA PRIVATE KEY-----"""<br />
<br />
interfaces.mqtt.connect("ssl://q65g7jujvagsuy-ats.iot.us-east-2.amazonaws.com", <br />
'testClient', <br />
null, <br />
null, <br />
tlsVersion: "1.2", <br />
privateKey: privateKey, <br />
caCertificate: caCert, <br />
clientCertificate: clientCert)<br />
</pre><br />
<br />
===<code>disconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void disconnect()</code><br />
<br />
===<code>subscribe</code>===<br />
:;Signature<br />
:: <code>void subscribe(String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>isConnected</code>===<br />
:;Signature<br />
:: <code> boolean isConnected()</code><br />
<br />
:;Returns<br />
:: boolean - true if client is connected, false otherwise.<br />
<br />
===<code>unsubscribe</code>===<br />
:;Signature<br />
:: <code>void unsubscribe(String topicFilter)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>publish</code>===<br />
:;Signature<br />
:: <code>void publish(String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMessage</code>===<br />
:;Signature<br />
:: <code>Map parseMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
:;Examples<br />
<br />
// parse message<br />
interfaces.mqtt.parseMessage(description)<br />
<br />
==Hubitat Provided Methods (Deprecated) ==<br />
<br />
===<code>mqttConnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password)</code><br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
<br />
:;Examples<br />
<br />
// Connect to MQTT broker<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
<br />
// Connect to MQTT broker with last will<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest456", null, null, lastWillTopic: "/my/last/will", lastWillQos: 0, lastWillMessage: "I died")<br />
<br />
<br />
===<code>mqttDisconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttDisconnect(DeviceWrapper device)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
<br />
===<code>mqttSubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttSubscribe(DeviceWrapper device, String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>mqttUnsubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttUnsubscribe(DeviceWrapper device, String topicFilter)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>mqttPublish</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttPublish(DeviceWrapper device, String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMqttMessage</code>===<br />
:;Signature<br />
:: <code>Map hubitat.helper.InterfaceUtils.alphaV1parseMqttMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
==User defined methods==<br />
<br />
===<code>parse(String message)</code>=== <br />
This method is called with any incoming messages from the subscribed topics of the MQTT broker. This is a standard method for drivers.<br />
<br />
===<code>mqttClientStatus(String message)</code>=== <br />
This method is called with any status messages from the MQTT client connection (disconnections, errors during connect, etc)<br />
The string that is passed to this method with start with "Error" if an error occurred or "Status" if this is just a status message.</div>Cschwerhttps://docs.hubitat.com/index.php?title=MQTT_Interface&diff=3067MQTT Interface2020-07-12T14:17:54Z<p>Cschwer: /* Hubitat Provided Methods (Since 2.1.2) */</p>
<hr />
<div>=Overview=<br />
Hubitat allows for opening and maintaining a connection to an MQTT broker from the hub. All code needs to be contained in a driver, there is no option to open an MQTT client connection from an app. Hubitat provides methods to connect and disconnect to the broker, subscribe and publish messages to topics. In addition it is required to create a method in the driver that accepts incoming messages (parse) and another method that will be called with any status updates for the client connection (mqttClientStatus).<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods (Since 2.1.2) ==<br />
<br />
===<code>connect</code>===<br />
<br />
:;Signature<br />
:: <code>void connect(String broker, String clientId, String username, String password)</code><br />
:: <code>void connect(String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
:::''cleanSession'' - Option to set the clean_session flag for the connection (Since 2.2.2)<br />
:::''tlsVersion'' - The TLS version to use when connecting to broker, possible values are 1.0, 1.1, 1.2 (Since 2.2.2)<br />
:::''caCertificate'' - The CA certificate for the TLS connection in PEM format (Since 2.2.2)<br />
:::''clientCertificate'' - The client certificate (X.509) for the TLS connection in PEM format (Since 2.2.2)<br />
:::''privateKey'' - The private key for the TLS connection in PEM format (Since 2.2.2)<br />
<br />
:;Examples<br />
<br />
<pre><br />
// Connect to MQTT broker<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
</pre><br />
<br />
<pre><br />
// Connect to MQTT broker with last will<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", <br />
"mqtttest456", <br />
null, <br />
null, <br />
lastWillTopic: "/my/last/will", <br />
lastWillQos: 0, <br />
lastWillMessage: "I died")<br />
</pre><br />
<br />
<pre><br />
// connect to MQTT broker with TLS and certificate (AWS IOT Core)<br />
// Note, all 4 parameters (tlsVersion, privateKey, caCertificate, clientCertificate) are required for TLS secure connection, if any are the connection won't work or will fall back to non secure<br />
String clientCert = """-----BEGIN CERTIFICATE-----<br />
MIIDWjCCAkKgAwIBAgIVANPd/DAZc5xaB3y6tuyA4Vi2pdyfMA0GCSqGSIb3DQEB<br />
...<br />
7qr3/l5YwtmArBPXAS4s60bfFwEVrLEpS9QPAIMnAFNWRkuwDNR1EZ3TcP12Ew==<br />
-----END CERTIFICATE-----"""<br />
<br />
String caCert = """-----BEGIN CERTIFICATE-----<br />
MIIEkjCCA3qgAwIBAgITBn+USionzfP6wq4rAfkI7rnExjANBgkqhkiG9w0BAQsF<br />
...<br />
akcjMS9cmvqtmg5iUaQqqcT5NJ0hGA==<br />
-----END CERTIFICATE-----"""<br />
<br />
String privateKey = """-----BEGIN RSA PRIVATE KEY-----<br />
MIIEpQIBAAKCAQEA3D1ZquBWJDtLOpVlDwYHW0ayaE+T9ZPV/bq39NT1KaKG+1w3<br />
...<br />
AeuFNEqh9ExHLMPw/McjOKQ+4oG42ZGox7WekbIWMt0CZvlbFYE0Ha0=<br />
-----END RSA PRIVATE KEY-----"""<br />
<br />
interfaces.mqtt.connect("ssl://q65g7jujvagsuy-ats.iot.us-east-2.amazonaws.com", <br />
'testClient', <br />
null, <br />
null, <br />
tlsVersion: "1.2", <br />
privateKey: privateKey, <br />
caCertificate: caCert, <br />
clientCertificate: clientCert)<br />
</pre><br />
<br />
===<code>disconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void disconnect()</code><br />
<br />
===<code>subscribe</code>===<br />
:;Signature<br />
:: <code>void subscribe(String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>isConnected</code>===<br />
:;Signature<br />
:: <code> boolean isConnected()</code><br />
<br />
:;Returns<br />
:: boolean - true if client is connected, false otherwise.<br />
<br />
===<code>unsubscribe</code>===<br />
:;Signature<br />
:: <code>void unsubscribe(String topicFilter)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>publish</code>===<br />
:;Signature<br />
:: <code>void publish(String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMessage</code>===<br />
:;Signature<br />
:: <code>Map parseMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
:;Examples<br />
<br />
// parse message<br />
interfaces.mqtt.parseMessage(description)<br />
<br />
==Hubitat Provided Methods (Deprecated) ==<br />
<br />
===<code>mqttConnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password)</code><br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
<br />
:;Examples<br />
<br />
// Connect to MQTT broker<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
<br />
// Connect to MQTT broker with last will<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest456", null, null, lastWillTopic: "/my/last/will", lastWillQos: 0, lastWillMessage: "I died")<br />
<br />
<br />
===<code>mqttDisconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttDisconnect(DeviceWrapper device)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
<br />
===<code>mqttSubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttSubscribe(DeviceWrapper device, String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>mqttUnsubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttUnsubscribe(DeviceWrapper device, String topicFilter)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>mqttPublish</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttPublish(DeviceWrapper device, String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMqttMessage</code>===<br />
:;Signature<br />
:: <code>Map hubitat.helper.InterfaceUtils.alphaV1parseMqttMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
==User defined methods==<br />
<br />
===<code>parse(String message)</code>=== <br />
This method is called with any incoming messages from the subscribed topics of the MQTT broker. This is a standard method for drivers.<br />
<br />
===<code>mqttClientStatus(String message)</code>=== <br />
This method is called with any status messages from the MQTT client connection (disconnections, errors during connect, etc)<br />
The string that is passed to this method with start with "Error" if an error occurred or "Status" if this is just a status message.</div>Cschwerhttps://docs.hubitat.com/index.php?title=MQTT_Interface&diff=3066MQTT Interface2020-07-11T01:40:04Z<p>Cschwer: /* connect */</p>
<hr />
<div>=Overview=<br />
Hubitat allows for opening and maintaining a connection to an MQTT broker from the hub. All code needs to be contained in a driver, there is no option to open an MQTT client connection from an app. Hubitat provides methods to connect and disconnect to the broker, subscribe and publish messages to topics. In addition it is required to create a method in the driver that accepts incoming messages (parse) and another method that will be called with any status updates for the client connection (mqttClientStatus).<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods (Since 2.1.2) ==<br />
<br />
===<code>connect</code>===<br />
<br />
:;Signature<br />
:: <code>void connect(String broker, String clientId, String username, String password)</code><br />
:: <code>void connect(String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
:::''cleanSession'' - Option to set the clean_session flag for the connection (Since 2.2.2)<br />
:::''tlsVersion'' - The TLS version to use when connecting to broker, possible values are 1.0, 1.1, 1.2 (Since 2.2.2)<br />
:::''caCertificate'' - The CA certificate for the TLS connection in PEM format (Since 2.2.2)<br />
:::''clientCertificate'' - The client certificate (X.509) for the TLS connection in PEM format (Since 2.2.2)<br />
:::''privateKey'' - The private key for the TLS connection in PEM format (Since 2.2.2)<br />
<br />
:;Examples<br />
<br />
<pre><br />
// Connect to MQTT broker<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
</pre><br />
<br />
<pre><br />
// Connect to MQTT broker with last will<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", <br />
"mqtttest456", <br />
null, <br />
null, <br />
lastWillTopic: "/my/last/will", <br />
lastWillQos: 0, <br />
lastWillMessage: "I died")<br />
</pre><br />
<br />
<pre><br />
// connect to MQTT broker with TLS and certificate (AWS IOT Core)<br />
String clientCert = """-----BEGIN CERTIFICATE-----<br />
MIIDWjCCAkKgAwIBAgIVANPd/DAZc5xaB3y6tuyA4Vi2pdyfMA0GCSqGSIb3DQEB<br />
...<br />
7qr3/l5YwtmArBPXAS4s60bfFwEVrLEpS9QPAIMnAFNWRkuwDNR1EZ3TcP12Ew==<br />
-----END CERTIFICATE-----"""<br />
<br />
String caCert = """-----BEGIN CERTIFICATE-----<br />
MIIEkjCCA3qgAwIBAgITBn+USionzfP6wq4rAfkI7rnExjANBgkqhkiG9w0BAQsF<br />
...<br />
akcjMS9cmvqtmg5iUaQqqcT5NJ0hGA==<br />
-----END CERTIFICATE-----"""<br />
<br />
String privateKey = """-----BEGIN RSA PRIVATE KEY-----<br />
MIIEpQIBAAKCAQEA3D1ZquBWJDtLOpVlDwYHW0ayaE+T9ZPV/bq39NT1KaKG+1w3<br />
...<br />
AeuFNEqh9ExHLMPw/McjOKQ+4oG42ZGox7WekbIWMt0CZvlbFYE0Ha0=<br />
-----END RSA PRIVATE KEY-----"""<br />
<br />
interfaces.mqtt.connect("ssl://q65g7jujvagsuy-ats.iot.us-east-2.amazonaws.com", <br />
'testClient', <br />
null, <br />
null, <br />
tlsVersion: "1.2", <br />
privateKey:privateKey, <br />
caCertificate: caCert, <br />
clientCertificate: clientCert)<br />
</pre><br />
<br />
===<code>disconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void disconnect()</code><br />
<br />
===<code>subscribe</code>===<br />
:;Signature<br />
:: <code>void subscribe(String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>isConnected</code>===<br />
:;Signature<br />
:: <code> boolean isConnected()</code><br />
<br />
:;Returns<br />
:: boolean - true if client is connected, false otherwise.<br />
<br />
===<code>unsubscribe</code>===<br />
:;Signature<br />
:: <code>void unsubscribe(String topicFilter)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>publish</code>===<br />
:;Signature<br />
:: <code>void publish(String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMessage</code>===<br />
:;Signature<br />
:: <code>Map parseMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
:;Examples<br />
<br />
// parse message<br />
interfaces.mqtt.parseMessage(description)<br />
<br />
==Hubitat Provided Methods (Deprecated) ==<br />
<br />
===<code>mqttConnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password)</code><br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
<br />
:;Examples<br />
<br />
// Connect to MQTT broker<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
<br />
// Connect to MQTT broker with last will<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest456", null, null, lastWillTopic: "/my/last/will", lastWillQos: 0, lastWillMessage: "I died")<br />
<br />
<br />
===<code>mqttDisconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttDisconnect(DeviceWrapper device)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
<br />
===<code>mqttSubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttSubscribe(DeviceWrapper device, String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>mqttUnsubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttUnsubscribe(DeviceWrapper device, String topicFilter)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>mqttPublish</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttPublish(DeviceWrapper device, String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMqttMessage</code>===<br />
:;Signature<br />
:: <code>Map hubitat.helper.InterfaceUtils.alphaV1parseMqttMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
==User defined methods==<br />
<br />
===<code>parse(String message)</code>=== <br />
This method is called with any incoming messages from the subscribed topics of the MQTT broker. This is a standard method for drivers.<br />
<br />
===<code>mqttClientStatus(String message)</code>=== <br />
This method is called with any status messages from the MQTT client connection (disconnections, errors during connect, etc)<br />
The string that is passed to this method with start with "Error" if an error occurred or "Status" if this is just a status message.</div>Cschwerhttps://docs.hubitat.com/index.php?title=MQTT_Interface&diff=3065MQTT Interface2020-07-10T14:14:33Z<p>Cschwer: /* Hubitat Provided Methods (Since 2.1.2) */</p>
<hr />
<div>=Overview=<br />
Hubitat allows for opening and maintaining a connection to an MQTT broker from the hub. All code needs to be contained in a driver, there is no option to open an MQTT client connection from an app. Hubitat provides methods to connect and disconnect to the broker, subscribe and publish messages to topics. In addition it is required to create a method in the driver that accepts incoming messages (parse) and another method that will be called with any status updates for the client connection (mqttClientStatus).<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods (Since 2.1.2) ==<br />
<br />
===<code>connect</code>===<br />
<br />
:;Signature<br />
:: <code>void connect(String broker, String clientId, String username, String password)</code><br />
:: <code>void connect(String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
:::''cleanSession'' - Option to set the clean_session flag for the connection (Since 2.2.2)<br />
:::''tlsVersion'' - The TLS version to use when connecting to broker, possible values are 1.0, 1.1, 1.2 (Since 2.2.2)<br />
:::''caCertificate'' - The CA certificate for the TLS connection (Since 2.2.2)<br />
:::''clientCertificate'' - The client certificate (X.509) for the TLS connection (Since 2.2.2)<br />
:::''privateKey'' - The private key for the TLS connection (Since 2.2.2)<br />
<br />
:;Examples<br />
<br />
// Connect to MQTT broker<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
<br />
// Connect to MQTT broker with last will<br />
interfaces.mqtt.connect("tcp://test.mosquitto.org:1883", "mqtttest456", null, null, lastWillTopic: "/my/last/will", lastWillQos: 0, lastWillMessage: "I died")<br />
<br />
===<code>disconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void disconnect()</code><br />
<br />
===<code>subscribe</code>===<br />
:;Signature<br />
:: <code>void subscribe(String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>isConnected</code>===<br />
:;Signature<br />
:: <code> boolean isConnected()</code><br />
<br />
:;Returns<br />
:: boolean - true if client is connected, false otherwise.<br />
<br />
===<code>unsubscribe</code>===<br />
:;Signature<br />
:: <code>void unsubscribe(String topicFilter)</code><br />
<br />
:;Parameters<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>publish</code>===<br />
:;Signature<br />
:: <code>void publish(String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMessage</code>===<br />
:;Signature<br />
:: <code>Map parseMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
:;Examples<br />
<br />
// parse message<br />
interfaces.mqtt.parseMessage(description)<br />
<br />
==Hubitat Provided Methods (Deprecated) ==<br />
<br />
===<code>mqttConnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password)</code><br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttConnect(DeviceWrapper device, String broker, String clientId, String username, String password, options (name/value pairs))</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: broker - The url of the broker to connect to.<br />
:: clientId - The client id to use when connecting to the broker.<br />
:: username - The username to use when connecting to the broker, use null if no username is necessary.<br />
:: password - The password to use when connecting to the broker, use null if no password is necessary.<br />
:: options - Optional parameters to configure the MQTT connection. Possible values: <br />
:::''byteInterface'' - defaults to 'false'. If set to true, messages are handled as byte arrays and will be hex string encoded.<br />
:::''lastWillTopic'' - The topic to publish to if connection is lost (Since 2.1.2)<br />
:::''lastWillQos'' - The qos to use for publishing last will message, possible values are 0,1 or 2 (Since 2.1.2)<br />
:::''lastWillMessage'' - The message to publish if connection is lost (Since 2.1.2)<br />
:::''lastWillRetain'' - Option to set last will message to retained, defaults to false (Since 2.1.2)<br />
<br />
:;Examples<br />
<br />
// Connect to MQTT broker<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest123", null, null)<br />
<br />
// Connect to MQTT broker with last will<br />
hubitat.helper.InterfaceUtils.alphaV1mqttConnect(device, "tcp://test.mosquitto.org:1883", "mqtttest456", null, null, lastWillTopic: "/my/last/will", lastWillQos: 0, lastWillMessage: "I died")<br />
<br />
<br />
===<code>mqttDisconnect</code>===<br />
<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttDisconnect(DeviceWrapper device)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
<br />
===<code>mqttSubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttSubscribe(DeviceWrapper device, String topicFilter, int qos = 1)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic / filter to subscribe to.<br />
:: qos - (optional, defaults to 1) The qos to use when subscribing.<br />
<br />
===<code>mqttUnsubscribe</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttUnsubscribe(DeviceWrapper device, String topicFilter)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topicFilter - The topic filter to unsubscribe from.<br />
<br />
===<code>mqttPublish</code>===<br />
:;Signature<br />
:: <code>void hubitat.helper.InterfaceUtils.alphaV1mqttPublish(DeviceWrapper device, String topic, String payload, int qos = 1, boolean retained = false)</code><br />
<br />
:;Parameters<br />
:: device - The current device that is calling the method.<br />
:: topic - The topic to publish the message to.<br />
:: payload - The body of the message.<br />
:: qos - (optional, defaults to 1) The qos to use when publishing the message.<br />
:: retained - (optional, defaults to false) Retain message in queue if subscriber is not listening.<br />
<br />
===<code>parseMqttMessage</code>===<br />
:;Signature<br />
:: <code>Map hubitat.helper.InterfaceUtils.alphaV1parseMqttMessage(String stringToParse)</code><br />
<br />
:;Parameters<br />
:: stringToParse - The string coming from the MQTT brokers subscribed topic.<br />
<br />
:;Returns<br />
:: Map - the string passed as a parameter is split into a Map and returned.<br />
<br />
==User defined methods==<br />
<br />
===<code>parse(String message)</code>=== <br />
This method is called with any incoming messages from the subscribed topics of the MQTT broker. This is a standard method for drivers.<br />
<br />
===<code>mqttClientStatus(String message)</code>=== <br />
This method is called with any status messages from the MQTT client connection (disconnections, errors during connect, etc)<br />
The string that is passed to this method with start with "Error" if an error occurred or "Status" if this is just a status message.</div>Cschwerhttps://docs.hubitat.com/index.php?title=Add_Device&diff=3064Add Device2020-06-30T20:26:34Z<p>Cschwer: </p>
<hr />
<div>Discovering Devices is the process for pairing your Zigbee and Z-Wave mesh devices. Other devices, such as [[Lutron Integration|Lutron]] and [[Hue Bridge Integration|Philips Hue Bridge]], are connected using integration apps which can be found in the Apps section of your Web Interface. Remember that as you connect Zigbee and Z-Wave devices, they will have a limited range, and If they are too far from your hub, you will need to add repeating devices (devices that plug in to the wall or are AC mains powered) to make the connection.<br />
<br />
Here's how to Discover your devices:<br />
<br />
#Put your device in pairing mode (See the manufacturer’s instructions, but it probably involves pressing a small, inconvenient button a couple times).<br />
#Choose the ''Discover Devices'' link in your Hubitat Web Interface home page or from the kabob menu at the top right.[[File:Hubitat Elevation Home - Device Discovery v2.1.png|none|thumb|600x600px]]<br />
#Select which type of device you want to pair, Zigbee, Z-Wave, Iris v1 Zigbee.[[File:New device Discovery.png|none|thumb|566x566px]]<br />
<br />
For Zigbee and Iris v1 Zigbee devices, the hub will go into "Pairing" or "Join" mode after you click either button. You can restart it by clicking the restart button, stop it at any time as well.<br />
<br />
For Z-Wave Devices, you have two options:<br />
[[File:Z-Wave options.png|none|thumb|827x827px]]<br />
You can "Start Z-Wave Pairing" and this will put the hub into "Inclusion Mode" for 60 seconds. However, it is good practice to Exclude a Z-Wave device before trying to add it to Hubitat Elevation<sup>®</sup>. After each Z-Wave device is found, you need to start Z-Wave pairing again.<br />
<br />
===To Exclude a Device:===<br />
Click the "Start Z-Wave Exclusion" button. Press the appropriate button or button combination on the device (see manufacturer's instructions). and you should see a message "Unknown Z-Wave Device was excluded". This means this device no longer is associated with a previous Z-Wave network and can now be paired with Hubitat Elevation<sup>®</sup>.<br />
[[File:Z-wave exclude start.png|none|thumb|822x822px]]<br />
[[File:Z-wave excluded.png|none|thumb|815x815px]]<br />
<br />
===Naming a Device===<br />
After Hubitat Elevation<sup>®</sup> discovers your device, you can give it a "Label" or a friendly name that you can use to identify the device.<br />
[[File:Found device.png|none|thumb]]<br />
<br />
==='''TROUBLESHOOTING'''===<br />
If your device does not pair, here are some potential culprits:<br />
<br />
#'''Is your device compatible?''' Hubitat Elevation<sup>®</sup> includes Z-Wave and Zigbee radios that work with a wide variety of Zigbee and Z-Wave devices. Check this list of known compatible devices. Devices running on different protocols, such as Lutron and Philips Hue Bridge, require a bridge that must be paired using an integration app. Lutron and the Hue Bridge have discovery processes their own. The Lutron and Hue bridges are not added to Hubitat Elevation<sup>®</sup> via the discovery process.<br />
#'''Is your device out of range?''' Z-wave and Zigbee radios have a limited range that is further reduced by obstructions, included metal, wood, concrete, plaster and drywall. It is important to build out a mesh network that includes plugged-in or AC mains powered devices that act as repeaters and boost the range and signal strength of your hub. Battery operated devices do not function as signal repeaters. '''Note''': ''You should not use Zigbee lightbulbs to repeat signals, since their performance for that task is poor among anything but another lightbulb, which will result in an unstable Zigbee radio mesh for your other Zigbee devices. See the [[How to Build a Solid Zigbee Mesh]] and [[How to Build a Solid Z-Wave Mesh]] documents for further details.''<br />
#'''Is this a Z-Wave device from another hub?''' Unless it is a new device, Z-Wave devices must be excluded from their previous hub before they can be joined with a new hub. Ideally you should perform a device exclusion '''and''' a factory reset before attempting to join it to the new Z-Wave network. If the procedure to factory reset is not available, then you should at least perform device exclusion. To do this, go the '''Settings''' in the Hubitat Elevation<sup>®</sup> Web Interface and choose '''Z-Wave Details'''. Choose Z-Wave Exclude and follow the manufacturer instructions that were included with you Z-Wave device.<br />
#'''Is your device in pairing mode?''' All devices are different. Check the device manual to make you have followed the proper procedure to put it in pairing mode.<br />
#'''Did your Z-Wave device fail to be included properly?''' Run a general Z-Wave Exclusion (see Step 3 above), then try joining it again.<br />
#'''Is the device battery dead?''' Try pairing with a fresh battery.<br />
#'''Are there Zigbee bulbs interfering?''' Certain Zigbee bulbs may interfere with the routing of the Zigbee network traffic. If you're having trouble with Zigbee device discovery, try temporarily removing nearby bulbs to see if this alleviates the issue. Be sure to add AC powered Zigbee repeaters. Do not rely on Zigbee lightbulbs to repeat signals, since their performance for that task is poor among anything but another lightbulb, which will result in an unstable Zigbee radio mesh for your other Zigbee devices. Sengled is the only known manufacturer that make Zigbee lightbulbs which do not attempt to repeat signals to other devices. Therefor they are the only known Zigbee smart bulbs that do not require special attention. See the [[How to Build a Solid Zigbee Mesh]] and [[How to Build a Solid Z-Wave Mesh]] documents for further details.<br />
<br />
#</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes_2.2.1&diff=3044Release Notes 2.2.12020-06-05T22:04:50Z<p>Cschwer: Created page with " '''Hubitat Elevation Platform update 2.2.1 is now available:''' Please note, the process takes about a minute to download (depending on your Internet connection) and extract..."</p>
<hr />
<div><br />
'''Hubitat Elevation Platform update 2.2.1 is now available:'''<br />
<br />
Please note, the process takes about a minute to download (depending on your Internet connection) and extract the hub update, and 1-2 minutes to perform the update after you click 'Update Hub'. We recommend that you periodically download a backup of your setup from the Settings page, Backup and Restore.<br />
<br />
'''Changes from 2.2.0''':<br />
<br />
''Drivers and Devices''<br />
<br />
* New drivers:<br />
** Aeotec Dual Nano Switch (ZW132)<br />
** Aeotec Smart Energy Switch (DSC06106)<br />
** Aurora Zigbee Switch (smart socket, smart double socket)<br />
** Aurora Zigbee Button Controller (AU-A1ZBRC)<br />
** Ring Alarm Range Extender<br />
** Ring Alarm Motion Sensor<br />
** Ring Alarm Contact Sensor<br />
** Ring Alarm Smoke/CO Listener<br />
** HomeSeer Floodlight Sensor (HS-FLS100+)<br />
** HomeSeer Multi-Sensor HSM200<br />
** Everspring Illumination Sensor (ST815)<br />
** RGBGenie Z-Wave Micro Controller (ZW-4001)<br />
** Remotec Z-Wave-to-AC IR Extender (ZXT-120)<br />
** Inovelli Z-Wave Smart Scene Dimmer S2 (LZW30)<br />
** Inovelli Bulb Multi-Color (LZW42)<br />
** Inovelli Bulb Multi-White (LZW41)<br />
* New compatible devices<br />
** Sunricher In-Wall Dimmer (SR-ZV9101SAC-HP) using RGBGenie Z-Wave Micro Controller<br />
** Sunricher In-Wall Dimmer (SR-ZV9101SAC-HP) using RGBGenie Z-Wave Micro Controller <br />
* New driver features<br />
** Add physical/digital to Aeon dual micro driver<br />
** Lutron thermostat: Added supportedThermostatModes, supportedThermostatFanModes<br />
** Add transition time option to virtual shade driver<br />
<br />
''New App Features''<br />
<br />
* Simple Automation Rule:<br />
** Added Turn on and set color.<br />
* Rule 4.0: <br />
** Added support for read/write of local files. See this post.<br />
** Add support for supportedThermostatModes, supportedThermostatFanModes.<br />
<br />
''Bug Fixes''<br />
<br />
* Rule 4.0:<br />
** Fixed bug with Toggle Color Temperature setting level.<br />
** Fixed bug with multiple trigger events with mode.<br />
** Fixed bug where offset to sensor value not added as it should be when setting variable from sensor value.<br />
** Fixed null pointer error for malformed variable reference.<br />
** Fixed all selection for power source condition.<br />
* Z-Wave command class multicmdv1.MultiCmdEncap:<br />
** Fixed payload not parsed within encapsulatedCommands method.<br />
** Added encapsulate method.<br />
* Thermostat Scheduler: Fixed bug with Manual setpoint change.<br />
* Notifier and HSM Rule: Fixed “Once in every x minutes” to only allow 59 minutes.<br />
* Yale Zigbee Lock: fix code errors with encryption enabled.<br />
<br />
''Platform Changes''<br />
<br />
* Unit is now returned with device attribute state.<br />
* New method to remove access token for oauth app: revokeAccessToken()<br />
* New method to remove data values from devices: removeDataValue(String name)<br />
* Z-Wave device data is populated before calls to installed() and configure() for newly added devices.<br />
* Async Http GET, POST etc will now return a base64 encoded string if the response is binary data.<br />
* Apps can now subscribe to all device events.<br />
* Fixed headers map in App web requests: system was not placing headers in the correct headers map, instead it was placing them into the request map.<br />
* Added getSetting() method to DeviceWraper and InstalledAppWrapper.<br />
* All Z-Wave drivers: switchBinarySet and switchMultilevelSet commands will replace basicSet for devices that support the switchBinary and or switchMultilevel classes, this is a requirement of Z-Wave certification.<br />
* New File Manager for local file storage. This feature is currently in beta.</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes&diff=3043Release Notes2020-06-05T22:04:21Z<p>Cschwer: </p>
<hr />
<div>Hubitat release notes are specific to each version. Select your version from the list below to see the release notes for it.<br />
<br />
[[Release_Notes_1.1.5| 1.1.5]]<br />
<br />
[[Release_Notes_1.1.6| 1.1.6]]<br />
<br />
[[Release_Notes_2.0.0| 2.0.0]]<br />
<br />
[[Release_Notes_2.0.1| 2.0.1]]<br />
<br />
[[Release_Notes_2.0.2| 2.0.2]]<br />
<br />
[[Release_Notes_2.0.3| 2.0.3]]<br />
<br />
[[Release_Notes_2.0.4| 2.0.4]]<br />
<br />
[[Release_Notes_2.0.5| 2.0.5]]<br />
<br />
[[Release_Notes_2.0.6| 2.0.6]]<br />
<br />
[[Release_Notes_2.0.7| 2.0.7]]<br />
<br />
[[Release_Notes_2.0.8| 2.0.8]]<br />
<br />
[[Release_Notes_2.0.9| 2.0.9]]<br />
<br />
[[Release_Notes_2.1.0| 2.1.0]]<br />
<br />
[[Release_Notes_2.1.1| 2.1.1]]<br />
<br />
[[Release_Notes_2.1.2| 2.1.2]]<br />
<br />
[[Release_Notes_2.1.3| 2.1.3]]<br />
<br />
[[Release_Notes_2.1.4| 2.1.4]]<br />
<br />
[[Release_Notes_2.1.5| 2.1.5]]<br />
<br />
[[Release_Notes_2.1.6| 2.1.6]]<br />
<br />
[[Release_Notes_2.1.7| 2.1.7]]<br />
<br />
[[Release_Notes_2.1.8| 2.1.8]]<br />
<br />
[[Release_Notes_2.1.9| 2.1.9]]<br />
<br />
[[Release_Notes_2.2.0| 2.2.0]]<br />
<br />
[[Release_Notes_2.2.1| 2.2.1]]</div>Cschwerhttps://docs.hubitat.com/index.php?title=Device_Object&diff=3005Device Object2020-06-02T15:42:11Z<p>Cschwer: </p>
<hr />
<div>The Device object (Technically com.hubitat.app.DeviceWrapper, com.hubitat.app.ChildDeviceWrapper and com.hubitat.app.ParentDeviceWrapper) is composed of methods that allow you to interact with the settings and values of a device. This object is available to Apps that have been given access via a device selection input, as child devices of Apps and other devices and a driver also has access to this via the device object.<br />
<br />
<br />
===<code>currentValue</code>===<br />
:Retrieve the current value of an attribute. By default this value is cached during a single run of the driver.<br />
<br />
:;Signature<br />
:: <code>Object currentValue(String attributeName)</code><br />
:: <code> Object currentValue(String attributeName, boolean skipCache)</code><br />
<br />
:;Parameters<br />
::attributeName - The attribute to get the current value of.<br />
::skipCache - Optional, do not use the cached value of the attribute, instead force the system to read the latest from the database.<br />
<br />
:;Returns<br />
::The current value of an attribute.<br />
<br />
<br />
===<code>events</code>===<br />
:Retrieve a list of events for the device. By default the maximum number of events returned in the list is 10 which can be overridden by the max option.<br />
<br />
:;Signature<br />
:: <code>List<Event> events()</code><br />
:: <code>List<Event> events(Map options)</code><br />
<br />
:;Parameters<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::List of Event objects for the device<br />
<br />
<br />
===<code>eventsSince</code>===<br />
:Retrieve a list of events since a date/time.<br />
<br />
:;Signature<br />
:: <code>List<Event> eventsSince(Date startDate)</code><br />
:: <code>List<Event> eventsSince(Date startDate, Map options)</code><br />
<br />
:;Parameters<br />
:: startDate - The date/time to list events since.<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::A list of Events (defaults to 10 events unless otherwise specified in options)<br />
<br />
:;Examples<br />
<br />
// Get events since 8:00 am today<br />
def events = eventsSince(timeToday("08:00"))<br />
<br />
// Get a maximum of 5 events<br />
def events = eventsSince(timeToday("08:00"), [max:5])<br />
<br />
===<code>getName</code>===<br />
:Retrieve the name of the device.<br />
<br />
:;Signature<br />
:: <code>String getName()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The name of the device<br />
<br />
===<code>setName</code>===<br />
:Update the name of the device.<br />
<br />
:;Signature<br />
:: <code>void setName(String name)</code><br />
<br />
:;Parameters<br />
::name - the new name for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
===<code>getLabel</code>===<br />
:Retrieve the label of the device.<br />
<br />
:;Signature<br />
:: <code>String getLabel()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The label of the device<br />
<br />
===<code>setLabel</code>===<br />
:Update the label of the device.<br />
<br />
:;Signature<br />
:: <code>void setLabel(String label)</code><br />
<br />
:;Parameters<br />
::label - the new label for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
===<code>hasAttribute</code>===<br />
:Determines if the device has the specified attribute. This works for both built-in and custom attributes.<br />
<br />
:;Signature<br />
::<code>Boolean hasAttribute(String attribute)</code><br />
<br />
:;Parameters<br />
::attribute- The attribute to check for.<br />
<br />
:;Returns<br />
::True if the attribute exists, false otherwise.<br />
<br />
===<code>hasCapability</code>===<br />
:Determines if the device has the specified capability.<br />
<br />
:;Signature<br />
::<code>Boolean hasCapability(String capability)</code><br />
<br />
:;Parameters<br />
::capability - The capability to check for.<br />
<br />
:;Returns<br />
::True if the capability exists, false otherwise.<br />
<br />
===<code>hasCommand</code>===<br />
:Determines if the device has the specified command. This works for both built-in and custom commands.<br />
<br />
:;Signature<br />
::<code> Boolean hasCommand(String command)</code><br />
<br />
:;Parameters<br />
::command - The command to check for.<br />
<br />
:;Returns<br />
::True if the command exists, false otherwise.<br />
<br />
===<code>updateSetting</code>===<br />
:Updates the value of a setting (preference) to the specified value. If the setting does not exist, this method will create it.<br />
<br />
:;Signature<br />
::<code>void updateSetting(String name, Long value)</code><br />
::<code>void updateSetting(String name, Boolean value)</code><br />
::<code>void updateSetting(String name, String value)</code><br />
::<code>void updateSetting(String name, Double value)</code><br />
::<code>void updateSetting(String name, Date value)</code><br />
::<code>void updateSetting(String name, List value)</code><br />
<br />
:;Parameters<br />
::name - The name of the setting to update<br />
::value - The value to store in the setting<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>getData</code>===<br />
:Get all data values for this device.<br />
<br />
:;Signature<br />
:: <code>Map getData()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::Map - All data values.<br />
<br />
===<code>getDataValue</code>===<br />
:Get a data value that was set for this device.<br />
<br />
:;Signature<br />
:: <code>String getDataValue(String name)</code><br />
<br />
:;Parameters<br />
::name - The String value of the data item.<br />
<br />
:;Returns<br />
::String - The value of the data.<br />
<br />
===<code>getDeviceDataByName</code>===<br />
:DEPRECATED: See getDataValue, this method is a wrapper for getDataValue.<br />
<br />
===<code>updateDataValue</code>===<br />
:Update or create a data value for this device.<br />
<br />
:;Signature<br />
:: <code>void updateDataValue(String name, String value)</code><br />
<br />
:;Parameters<br />
::name - The name of the data item to store.<br />
::value - The value of the data item to store.<br />
<br />
:;Returns<br />
::None.<br />
<br />
===<code>removeDataValue</code>===<br />
:Remove a data value from a device.<br />
<br />
:;Signature<br />
:: <code>void removeDataValue(String name)</code> (Since 2.2.1)<br />
<br />
:;Parameters<br />
::name - The name of the data item to remove.<br />
<br />
:;Returns<br />
::None.<br />
<br />
==<code>Additional to be documented</code>==<br />
List<Event> eventsBetween(Date startDate, Date endDate)<br />
List<Event> eventsBetween(Date startDate, Date endDate, Map options = null)<br />
List<State> statesSince(String attributeName, Date startDate)<br />
List<State> statesSince(String attributeName, Date startDate, Map options = null)<br />
void sendEvent(Map properties)<br />
void updateSetting(String name, Map options)<br />
void removeSetting(String name)<br />
void clearSetting(String name)<br />
Long getIdAsLong()<br />
String getId()<br />
String getEndpointId()<br />
String getZigbeeId()<br />
Hub getHub()<br />
String getStatus()<br />
String getDisplayName()<br />
void setDisplayName(String displayName)<br />
String getDeviceNetworkId()<br />
void setDeviceNetworkId(String dni)<br />
State currentState(String attributeName)<br />
State currentState(String attributeName, boolean skipCache)<br />
Object latestValue(String attributeName)<br />
Object latestValue(String attributeName, boolean skipCache)<br />
State latestState(String attributeName)<br />
State latestState(String attributeName, boolean skipCache)<br />
List<State> getCurrentStates()<br />
List<Command> getSupportedCommands()<br />
List<Attribute> getSupportedAttributes()<br />
List<Capability> getCapabilities()<br />
Date getLastActivity()<br />
Long getParentDeviceId()<br />
Long getParentAppId()<br />
Boolean getIsComponent()<br />
boolean isDisabled()</div>Cschwerhttps://docs.hubitat.com/index.php?title=Device_Object&diff=3004Device Object2020-06-02T15:41:57Z<p>Cschwer: </p>
<hr />
<div>The Device object (Technically com.hubitat.app.DeviceWrapper, com.hubitat.app.ChildDeviceWrapper and com.hubitat.app.ParentDeviceWrapper) is composed of methods that allow you to interact with the settings and values of a device. This object is available to Apps that have been given access via a device selection input, as child devices of Apps and other devices and a driver also has access to this via the device object.<br />
<br />
<br />
===<code>currentValue</code>===<br />
:Retrieve the current value of an attribute. By default this value is cached during a single run of the driver.<br />
<br />
:;Signature<br />
:: <code>Object currentValue(String attributeName)</code><br />
:: <code> Object currentValue(String attributeName, boolean skipCache)</code><br />
<br />
:;Parameters<br />
::attributeName - The attribute to get the current value of.<br />
::skipCache - Optional, do not use the cached value of the attribute, instead force the system to read the latest from the database.<br />
<br />
:;Returns<br />
::The current value of an attribute.<br />
<br />
<br />
===<code>events</code>===<br />
:Retrieve a list of events for the device. By default the maximum number of events returned in the list is 10 which can be overridden by the max option.<br />
<br />
:;Signature<br />
:: <code>List<Event> events()</code><br />
:: <code>List<Event> events(Map options)</code><br />
<br />
:;Parameters<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::List of Event objects for the device<br />
<br />
<br />
===<code>eventsSince</code>===<br />
:Retrieve a list of events since a date/time.<br />
<br />
:;Signature<br />
:: <code>List<Event> eventsSince(Date startDate)</code><br />
:: <code>List<Event> eventsSince(Date startDate, Map options)</code><br />
<br />
:;Parameters<br />
:: startDate - The date/time to list events since.<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::A list of Events (defaults to 10 events unless otherwise specified in options)<br />
<br />
:;Examples<br />
<br />
// Get events since 8:00 am today<br />
def events = eventsSince(timeToday("08:00"))<br />
<br />
// Get a maximum of 5 events<br />
def events = eventsSince(timeToday("08:00"), [max:5])<br />
<br />
===<code>getName</code>===<br />
:Retrieve the name of the device.<br />
<br />
:;Signature<br />
:: <code>String getName()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The name of the device<br />
<br />
===<code>setName</code>===<br />
:Update the name of the device.<br />
<br />
:;Signature<br />
:: <code>void setName(String name)</code><br />
<br />
:;Parameters<br />
::name - the new name for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
===<code>getLabel</code>===<br />
:Retrieve the label of the device.<br />
<br />
:;Signature<br />
:: <code>String getLabel()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The label of the device<br />
<br />
===<code>setLabel</code>===<br />
:Update the label of the device.<br />
<br />
:;Signature<br />
:: <code>void setLabel(String label)</code><br />
<br />
:;Parameters<br />
::label - the new label for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
===<code>hasAttribute</code>===<br />
:Determines if the device has the specified attribute. This works for both built-in and custom attributes.<br />
<br />
:;Signature<br />
::<code>Boolean hasAttribute(String attribute)</code><br />
<br />
:;Parameters<br />
::attribute- The attribute to check for.<br />
<br />
:;Returns<br />
::True if the attribute exists, false otherwise.<br />
<br />
===<code>hasCapability</code>===<br />
:Determines if the device has the specified capability.<br />
<br />
:;Signature<br />
::<code>Boolean hasCapability(String capability)</code><br />
<br />
:;Parameters<br />
::capability - The capability to check for.<br />
<br />
:;Returns<br />
::True if the capability exists, false otherwise.<br />
<br />
===<code>hasCommand</code>===<br />
:Determines if the device has the specified command. This works for both built-in and custom commands.<br />
<br />
:;Signature<br />
::<code> Boolean hasCommand(String command)</code><br />
<br />
:;Parameters<br />
::command - The command to check for.<br />
<br />
:;Returns<br />
::True if the command exists, false otherwise.<br />
<br />
===<code>updateSetting</code>===<br />
:Updates the value of a setting (preference) to the specified value. If the setting does not exist, this method will create it.<br />
<br />
:;Signature<br />
::<code>void updateSetting(String name, Long value)</code><br />
::<code>void updateSetting(String name, Boolean value)</code><br />
::<code>void updateSetting(String name, String value)</code><br />
::<code>void updateSetting(String name, Double value)</code><br />
::<code>void updateSetting(String name, Date value)</code><br />
::<code>void updateSetting(String name, List value)</code><br />
<br />
:;Parameters<br />
::name - The name of the setting to update<br />
::value - The value to store in the setting<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>getData</code>===<br />
:Get all data values for this device.<br />
<br />
:;Signature<br />
:: <code>Map getData()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::Map - All data values.<br />
<br />
===<code>getDataValue</code>===<br />
:Get a data value that was set for this device.<br />
<br />
:;Signature<br />
:: <code>String getDataValue(String name)</code><br />
<br />
:;Parameters<br />
::name - The String value of the data item.<br />
<br />
:;Returns<br />
::String - The value of the data.<br />
<br />
===<code>getDeviceDataByName</code>===<br />
:DEPRECATED: See getDataValue, this method is a wrapper for getDataValue.<br />
<br />
===<code>updateDataValue</code>===<br />
:Update or create a data value for this device.<br />
<br />
:;Signature<br />
:: <code>void updateDataValue(String name, String value)</code><br />
<br />
:;Parameters<br />
::name - The name of the data item to store.<br />
::value - The value of the data item to store.<br />
<br />
:;Returns<br />
::None.<br />
<br />
===<code>removeDataValue</code>===<br />
:Remove a data value from a device.<br />
<br />
:;Signature<br />
:: <code>void removeDataValue(String name)</code> (Since 2.2.1)<br />
<br />
:;Parameters<br />
::name - The name of the data item to remove.<br />
<br />
:;Returns<br />
::None.<br />
<br />
==<code>Additional to be documented</code>==<br />
List<Event> eventsBetween(Date startDate, Date endDate)<br />
List<Event> eventsBetween(Date startDate, Date endDate, Map options = null)<br />
List<State> statesSince(String attributeName, Date startDate)<br />
List<State> statesSince(String attributeName, Date startDate, Map options = null)<br />
void sendEvent(Map properties)<br />
void updateSetting(String name, Map options)<br />
void removeSetting(String name)<br />
void clearSetting(String name)<br />
Long getIdAsLong()<br />
String getId()<br />
String getEndpointId()<br />
String getZigbeeId()<br />
Hub getHub()<br />
Map getData()<br />
String getStatus()<br />
String getDisplayName()<br />
void setDisplayName(String displayName)<br />
String getDeviceNetworkId()<br />
void setDeviceNetworkId(String dni)<br />
State currentState(String attributeName)<br />
State currentState(String attributeName, boolean skipCache)<br />
Object latestValue(String attributeName)<br />
Object latestValue(String attributeName, boolean skipCache)<br />
State latestState(String attributeName)<br />
State latestState(String attributeName, boolean skipCache)<br />
List<State> getCurrentStates()<br />
List<Command> getSupportedCommands()<br />
List<Attribute> getSupportedAttributes()<br />
List<Capability> getCapabilities()<br />
Date getLastActivity()<br />
Long getParentDeviceId()<br />
Long getParentAppId()<br />
Boolean getIsComponent()<br />
boolean isDisabled()</div>Cschwerhttps://docs.hubitat.com/index.php?title=Driver_Object&diff=3003Driver Object2020-06-02T15:39:14Z<p>Cschwer: </p>
<hr />
<div>=Overview=<br />
<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods==<br />
<br />
===<code>sendHubCommand</code>===<br />
:Use this method to send a HubAction immediately.<br />
<br />
:;Signature<br />
:: <code>void sendHubCommand(HubAction hubAction)</code><br />
<br />
:;Parameters<br />
::hubAction - The HubAction object to send.<br />
<br />
:;Returns<br />
:: none<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties = [:])</code><br />
:: <code>ChildDeviceWrapper addChildDevice(String typeName, String deviceNetworkId, Map properties = [:])</code><br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>getParent</code>===<br />
:Returns the parent Device (ParentDeviceWrapper) or App (InstalledAppWrapper) when called from a child device.<br />
<br />
:;Signature<br />
:: <code>Object getParent()</code><br />
'''Returns:'''<br />
The ParentDeviceWrapper or InstalledAppWrapper<br />
<br />
===<code>getDataValue</code>===<br />
:Get a data value that was set for this device.<br />
<br />
:;Signature<br />
:: <code>String getDataValue(String name)</code><br />
<br />
:;Parameters<br />
::name - The String value of the data item.<br />
<br />
:;Returns<br />
::String - The value of the data.<br />
<br />
===<code>getDeviceDataByName</code>===<br />
:DEPRECATED: See getDataValue, this method is a wrapper for getDataValue.<br />
<br />
===<code>updateDataValue</code>===<br />
:Update or create a data value for this device.<br />
<br />
:;Signature<br />
:: <code>void updateDataValue(String name, String value)</code><br />
<br />
:;Parameters<br />
::name - The name of the data item to store.<br />
::value - The value of the data item to store.<br />
<br />
:;Returns<br />
::None.<br />
<br />
===<code>removeDataValue</code>===<br />
:Remove a data value from a device.<br />
<br />
:;Signature<br />
:: <code>void removeDataValue(String name)</code> (Since 2.2.1)<br />
<br />
:;Parameters<br />
::name - The name of the data item to remove.<br />
<br />
:;Returns<br />
::None.<br />
<br />
==User defined methods==<br />
<br />
===<code>installed</code>===<br />
:This method is called when the device is first created.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of a device are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
==<code>Additional to be documented</code>==<br />
Map getState()<br />
Zwave getZwave()<br />
Zigbee getZigbee()<br />
HubAction response(String cmd)<br />
HubAction response(hubitat.zwave.Command cmd)<br />
HubMultiAction response(List cmds)<br />
Short getZwaveHubNodeId()<br />
void sendEvent(Map properties)<br />
List<Event> eventsSince(Date startDate, Map options = null)<br />
void telnetConnect(Map options, String ip, int port, String username, String password)<br />
void telnetConnect(String ip, int port, String username, String password)<br />
void telnetClose()<br />
Map createEvent(Map options)<br />
List<String> delayBetween(List<String> cmds, Long delay)<br />
List<String> delayBetween(List<String> cmds)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Driver_Object&diff=3002Driver Object2020-06-02T15:35:26Z<p>Cschwer: /* Hubitat Provided Methods */</p>
<hr />
<div>=Overview=<br />
<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods==<br />
<br />
===<code>sendHubCommand</code>===<br />
:Use this method to send a HubAction immediately.<br />
<br />
:;Signature<br />
:: <code>void sendHubCommand(HubAction hubAction)</code><br />
<br />
:;Parameters<br />
::hubAction - The HubAction object to send.<br />
<br />
:;Returns<br />
:: none<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties = [:])</code><br />
:: <code>ChildDeviceWrapper addChildDevice(String typeName, String deviceNetworkId, Map properties = [:])</code><br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>getParent</code>===<br />
:Returns the parent Device (ParentDeviceWrapper) or App (InstalledAppWrapper) when called from a child device.<br />
<br />
:;Signature<br />
:: <code>Object getParent()</code><br />
'''Returns:'''<br />
The ParentDeviceWrapper or InstalledAppWrapper<br />
<br />
===<code>getDataValue</code>===<br />
:Get a data value that was set for this device.<br />
<br />
:;Signature<br />
:: <code>String getDataValue(String name)</code><br />
<br />
:;Parameters<br />
::name - The String value of the data item.<br />
<br />
:;Returns<br />
::String - The value of the data.<br />
<br />
===<code>updateDataValue</code>===<br />
:Update or create a data value for this device.<br />
<br />
:;Signature<br />
:: <code>void updateDataValue(String name, String value)</code><br />
<br />
:;Parameters<br />
::name - The name of the data item to store.<br />
::value - The value of the data item to store.<br />
<br />
:;Returns<br />
::None.<br />
<br />
===<code>removeDataValue</code>===<br />
:Remove a data value from a device.<br />
<br />
:;Signature<br />
:: <code>void removeDataValue(String name)</code> (Since 2.2.1)<br />
<br />
:;Parameters<br />
::name - The name of the data item to remove.<br />
<br />
:;Returns<br />
::None.<br />
<br />
==User defined methods==<br />
<br />
===<code>installed</code>===<br />
:This method is called when the device is first created.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of a device are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
==<code>Additional to be documented</code>==<br />
Map getState()<br />
Zwave getZwave()<br />
Zigbee getZigbee()<br />
String getDeviceDataByName(String name)<br />
HubAction response(String cmd)<br />
HubAction response(hubitat.zwave.Command cmd)<br />
HubMultiAction response(List cmds)<br />
Short getZwaveHubNodeId()<br />
void sendEvent(Map properties)<br />
List<Event> eventsSince(Date startDate, Map options = null)<br />
void telnetConnect(Map options, String ip, int port, String username, String password)<br />
void telnetConnect(String ip, int port, String username, String password)<br />
void telnetClose()<br />
Map createEvent(Map options)<br />
List<String> delayBetween(List<String> cmds, Long delay)<br />
List<String> delayBetween(List<String> cmds)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Driver_Object&diff=3001Driver Object2020-06-02T15:26:37Z<p>Cschwer: /* Additional to be documented */</p>
<hr />
<div>=Overview=<br />
<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods==<br />
<br />
===<code>sendHubCommand</code>===<br />
:Use this method to send a HubAction immediately.<br />
<br />
:;Signature<br />
:: <code>void sendHubCommand(HubAction hubAction)</code><br />
<br />
:;Parameters<br />
::hubAction - The HubAction object to send.<br />
<br />
:;Returns<br />
:: none<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties = [:])</code><br />
:: <code>ChildDeviceWrapper addChildDevice(String typeName, String deviceNetworkId, Map properties = [:])</code><br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>getParent</code>===<br />
:Returns the parent Device (ParentDeviceWrapper) or App (InstalledAppWrapper) when called from a child device.<br />
<br />
:;Signature<br />
:: <code>Object getParent()</code><br />
'''Returns:'''<br />
The ParentDeviceWrapper or InstalledAppWrapper<br />
<br />
===<code>getDataValue</code>===<br />
:Get a data value that was set for this device.<br />
<br />
:;Signature<br />
:: <code>String getDataValue(String name)</code><br />
<br />
:;Parameters<br />
::name - The String value of the data item.<br />
<br />
:;Returns<br />
::String - The value of the data.<br />
<br />
===<code>updateDataValue</code>===<br />
:Update or create a data value for this device.<br />
<br />
:;Signature<br />
:: <code>void updateDataValue(String name, String value)</code><br />
<br />
:;Parameters<br />
::name - The name of the data item to store.<br />
::value - The value of the data item to store.<br />
<br />
:;Returns<br />
::None.<br />
<br />
<br />
<br />
<br />
<br />
==User defined methods==<br />
<br />
===<code>installed</code>===<br />
:This method is called when the device is first created.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of a device are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
==<code>Additional to be documented</code>==<br />
Map getState()<br />
Zwave getZwave()<br />
Zigbee getZigbee()<br />
String getDeviceDataByName(String name)<br />
HubAction response(String cmd)<br />
HubAction response(hubitat.zwave.Command cmd)<br />
HubMultiAction response(List cmds)<br />
Short getZwaveHubNodeId()<br />
void sendEvent(Map properties)<br />
List<Event> eventsSince(Date startDate, Map options = null)<br />
void telnetConnect(Map options, String ip, int port, String username, String password)<br />
void telnetConnect(String ip, int port, String username, String password)<br />
void telnetClose()<br />
Map createEvent(Map options)<br />
List<String> delayBetween(List<String> cmds, Long delay)<br />
List<String> delayBetween(List<String> cmds)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Driver_Object&diff=3000Driver Object2020-06-02T15:26:18Z<p>Cschwer: </p>
<hr />
<div>=Overview=<br />
<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods==<br />
<br />
===<code>sendHubCommand</code>===<br />
:Use this method to send a HubAction immediately.<br />
<br />
:;Signature<br />
:: <code>void sendHubCommand(HubAction hubAction)</code><br />
<br />
:;Parameters<br />
::hubAction - The HubAction object to send.<br />
<br />
:;Returns<br />
:: none<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties = [:])</code><br />
:: <code>ChildDeviceWrapper addChildDevice(String typeName, String deviceNetworkId, Map properties = [:])</code><br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>getParent</code>===<br />
:Returns the parent Device (ParentDeviceWrapper) or App (InstalledAppWrapper) when called from a child device.<br />
<br />
:;Signature<br />
:: <code>Object getParent()</code><br />
'''Returns:'''<br />
The ParentDeviceWrapper or InstalledAppWrapper<br />
<br />
===<code>getDataValue</code>===<br />
:Get a data value that was set for this device.<br />
<br />
:;Signature<br />
:: <code>String getDataValue(String name)</code><br />
<br />
:;Parameters<br />
::name - The String value of the data item.<br />
<br />
:;Returns<br />
::String - The value of the data.<br />
<br />
===<code>updateDataValue</code>===<br />
:Update or create a data value for this device.<br />
<br />
:;Signature<br />
:: <code>void updateDataValue(String name, String value)</code><br />
<br />
:;Parameters<br />
::name - The name of the data item to store.<br />
::value - The value of the data item to store.<br />
<br />
:;Returns<br />
::None.<br />
<br />
<br />
<br />
<br />
<br />
==User defined methods==<br />
<br />
===<code>installed</code>===<br />
:This method is called when the device is first created.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of a device are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
==<code>Additional to be documented</code>==<br />
Map getState()<br />
Zwave getZwave()<br />
Zigbee getZigbee()<br />
void updateDataValue(String name, String value)<br />
String getDeviceDataByName(String name)<br />
HubAction response(String cmd)<br />
HubAction response(hubitat.zwave.Command cmd)<br />
HubMultiAction response(List cmds)<br />
Short getZwaveHubNodeId()<br />
void sendEvent(Map properties)<br />
List<Event> eventsSince(Date startDate, Map options = null)<br />
void telnetConnect(Map options, String ip, int port, String username, String password)<br />
void telnetConnect(String ip, int port, String username, String password)<br />
void telnetClose()<br />
Map createEvent(Map options)<br />
List<String> delayBetween(List<String> cmds, Long delay)<br />
List<String> delayBetween(List<String> cmds)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Driver_Object&diff=2999Driver Object2020-06-02T15:24:02Z<p>Cschwer: </p>
<hr />
<div>=Overview=<br />
<br />
<br />
=Methods=<br />
<br />
==Hubitat Provided Methods==<br />
<br />
===<code>sendHubCommand</code>===<br />
:Use this method to send a HubAction immediately.<br />
<br />
:;Signature<br />
:: <code>void sendHubCommand(HubAction hubAction)</code><br />
<br />
:;Parameters<br />
::hubAction - The HubAction object to send.<br />
<br />
:;Returns<br />
:: none<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties = [:])</code><br />
:: <code>ChildDeviceWrapper addChildDevice(String typeName, String deviceNetworkId, Map properties = [:])</code><br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>getParent</code>===<br />
:Returns the parent Device (ParentDeviceWrapper) or App (InstalledAppWrapper) when called from a child device.<br />
<br />
:;Signature<br />
:: <code>Object getParent()</code><br />
'''Returns:'''<br />
The ParentDeviceWrapper or InstalledAppWrapper<br />
<br />
===<code>getDataValue</code>===<br />
:Get a data value that was set for this device.<br />
<br />
:;Signature<br />
:: <code>String getDataValue(String name)</code><br />
<br />
:;Parameters<br />
::String - The name of the data value to retrieve.<br />
<br />
:;Returns<br />
::String - The value of the data.<br />
<br />
<br />
==User defined methods==<br />
<br />
===<code>installed</code>===<br />
:This method is called when the device is first created.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of a device are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
==<code>Additional to be documented</code>==<br />
Map getState()<br />
Zwave getZwave()<br />
Zigbee getZigbee()<br />
void updateDataValue(String name, String value)<br />
String getDeviceDataByName(String name)<br />
HubAction response(String cmd)<br />
HubAction response(hubitat.zwave.Command cmd)<br />
HubMultiAction response(List cmds)<br />
Short getZwaveHubNodeId()<br />
void sendEvent(Map properties)<br />
List<Event> eventsSince(Date startDate, Map options = null)<br />
void telnetConnect(Map options, String ip, int port, String username, String password)<br />
void telnetConnect(String ip, int port, String username, String password)<br />
void telnetClose()<br />
Map createEvent(Map options)<br />
List<String> delayBetween(List<String> cmds, Long delay)<br />
List<String> delayBetween(List<String> cmds)</div>Cschwerhttps://docs.hubitat.com/index.php?title=App_Object&diff=2970App Object2020-05-12T14:39:44Z<p>Cschwer: /* subscribe */</p>
<hr />
<div>==Provided Methods==<br />
===<code>createAccessToken</code>===<br />
:Creates an OAuth access token that can be used as part of the OAuth functionality of a properly configured app. The function will return the token, but will also automatically set the state variable <code>state.accessToken</code> to the return value. This value can then be passed to any API Endpoint (for example those defined in the <code>mappings</code> section of an app) using a query string parameter called <code>access_token</code>.<br />
<br />
:;Signature<br />
:: <code>String createAccessToken()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The OAuth access token.<br />
<br />
===<code>getApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat cloud API.<br />
<br />
:;Signature<br />
:: <code>String getApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The base URL of the Hubitat cloud API, generally https<span>://</span>cloud.hubitat.com/api<br />
<br />
===<code>getFullApiServerUrl</code>===<br />
:Returns the full URL of the Hubitat cloud API for a specific App.<br />
<br />
:;Signature<br />
:: <code>String getFullApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The URL of the Hubitat cloud API for the app, generally https<span>://</span>cloud.hubitat.com/api/<code>hubid</code>/apps/<code>appid</code><br />
<br />
===<code>getLocalApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat local API.<br />
<br />
:;Signature<br />
:: <code>String getLocalApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The base URL of the Hubitat local API, generally https<span>://</span><code>hubip</code>/apps/api<br />
<br />
===<code>getFullLocalApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat local API for a specific App.<br />
<br />
:;Signature<br />
:: <code>String getFullLocalApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::he URL of the Hubitat local API for the app, generally generally https<span>://</span><code>hubip</code>/apps/api/<code>appid</code><br />
<br />
===<code>getHubUID</code>===<br />
:Retrieves a unique identifier that represents your hub.<br />
<br />
:;Signature<br />
:: <code>String getHubUID()</code><br />
<br />
:;Parameters<br />
:: None<br />
<br />
:;Returns<br />
:: A UUID that uniquely identifies your hub.<br />
<br />
===<code>subscribe</code>===<br />
:Subscribe to events sent from a device, app or location.<br />
<br />
:;Signature<br />
:: <code>void subscribe(InstalledAppWrapper app, handlerMethod)</code><br />
:: <code>void subscribe(Location location, handlerMethod)</code><br />
:: <code>void subscribe(DeviceWrapper device, String handlerMethod, Map options = null)</code> (Since 2.2.1)<br />
:: <code>void subscribe(DeviceWrapperList devices, String handlerMethod, Map options = null)</code> (Since 2.2.1)<br />
:: <code>void subscribe(DeviceWrapper device, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(DeviceWrapperList devices, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(Location location, String attributeName, handlerMethod, Map options = null)</code><br />
<br />
<br />
:;Parameters<br />
::app - Installed App to subscribe to.<br />
::location - Location to subscribe to.<br />
::device - Device to subscribe to.<br />
::handlerMethod - The method to run when an event is received.<br />
::attributeName - The name of the attribute to subscribe to.<br />
::options - Optional values to configure the subscribe. Possible values:<br />
:::''filterEvents'' - Used for device subscriptions. Set to false to receive all events, defaults to true and events that do not have a changed value will not be processed.<br />
<br />
===<code>unsubscribe</code>===<br />
:Unsubscribe from events sent from a device or all event subscriptions.<br />
<br />
:;Signature<br />
:: <code>void unsubscribe()</code><br />
:: <code>void unsubscribe(DeviceWrapper device)</code><br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList)</code><br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName)</code> (Since 2.0.7)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(InstalledAppWrapper installedApp)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location, String attributeName)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(String handlerMethod)</code> (Since 2.1.2)<br />
<br />
:;Parameters<br />
::device - The device to unsubscribe from.<br />
::deviceList - A list of devices to unsubscribe from.<br />
::attributeName - which attribute you want to unsubscribe from.<br />
::handlerMethod - The name of a method which was subscribed to a device event.<br />
::location - The location to unsubscribe from.<br />
::installedApp - The installed app to unsubscribe from.<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId)</code> (deprecated)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId, Map properties)</code> (deprecated)<br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::hubId - present for backwards compatibility, pass 1.<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
:: <code>List<ChildDeviceWrapper> getAllChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
==User Defined Methods==<br />
===<code>installed</code>===<br />
:This method is called when the app is first installed.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of an installed app are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
===<code>uninstalled</code>===<br />
:This method is called when the app is uninstalled. This method can be used to do any cleanup that is necessary.<br />
<br />
:;Signature<br />
:: <code>void uninstalled()</code><br />
<br />
== <code>Additional to be documented</code> ==<br />
Map getState()<br />
String apiServerUrl(String url)<br />
String localApiServerUrl(String url)<br />
String fullLocalApiServerUrl(String url)<br />
void setLocationMode(String mode)<br />
void pause(Long millisecs)<br />
InstalledAppWrapper getParent()<br />
InstalledAppWrapper addChildApp(String namespace, String name, String label, Map properties = null)<br />
void deleteChildApp(Long childAppId)<br />
DeviceWrapper getSubscribedDeviceById(Long deviceId)<br />
void sendEvent(Map properties)<br />
void sendEvent(DeviceWrapper device, Map properties)<br />
void sendEvent(String dni, Map properties)<br />
List<Event> getLocationEventsSince(String attributeName, Date startDate, Map options = null)<br />
void subscribe(Object thing, String attributeName, handlerMethod, Map options = null)<br />
void subscribe(location, handlerMethod)<br />
List<InstalledApp> getAllChildApps()<br />
List<InstalledApp> getChildApps()<br />
InstalledAppWrapper getChildAppById(Long childAppId)<br />
InstalledAppWrapper getChildAppByLabel(String childAppLabel)</div>Cschwerhttps://docs.hubitat.com/index.php?title=App_Object&diff=2969App Object2020-05-12T14:39:02Z<p>Cschwer: /* subscribe */</p>
<hr />
<div>==Provided Methods==<br />
===<code>createAccessToken</code>===<br />
:Creates an OAuth access token that can be used as part of the OAuth functionality of a properly configured app. The function will return the token, but will also automatically set the state variable <code>state.accessToken</code> to the return value. This value can then be passed to any API Endpoint (for example those defined in the <code>mappings</code> section of an app) using a query string parameter called <code>access_token</code>.<br />
<br />
:;Signature<br />
:: <code>String createAccessToken()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The OAuth access token.<br />
<br />
===<code>getApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat cloud API.<br />
<br />
:;Signature<br />
:: <code>String getApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The base URL of the Hubitat cloud API, generally https<span>://</span>cloud.hubitat.com/api<br />
<br />
===<code>getFullApiServerUrl</code>===<br />
:Returns the full URL of the Hubitat cloud API for a specific App.<br />
<br />
:;Signature<br />
:: <code>String getFullApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The URL of the Hubitat cloud API for the app, generally https<span>://</span>cloud.hubitat.com/api/<code>hubid</code>/apps/<code>appid</code><br />
<br />
===<code>getLocalApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat local API.<br />
<br />
:;Signature<br />
:: <code>String getLocalApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The base URL of the Hubitat local API, generally https<span>://</span><code>hubip</code>/apps/api<br />
<br />
===<code>getFullLocalApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat local API for a specific App.<br />
<br />
:;Signature<br />
:: <code>String getFullLocalApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::he URL of the Hubitat local API for the app, generally generally https<span>://</span><code>hubip</code>/apps/api/<code>appid</code><br />
<br />
===<code>getHubUID</code>===<br />
:Retrieves a unique identifier that represents your hub.<br />
<br />
:;Signature<br />
:: <code>String getHubUID()</code><br />
<br />
:;Parameters<br />
:: None<br />
<br />
:;Returns<br />
:: A UUID that uniquely identifies your hub.<br />
<br />
===<code>subscribe</code>===<br />
:Subscribe to events sent from a device, app or location.<br />
<br />
:;Signature<br />
:: <code>void subscribe(InstalledAppWrapper app, handlerMethod)</code><br />
:: <code>void subscribe(Location location, handlerMethod)</code><br />
:: <code>void subscribe(DeviceWrapper device, String handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(DeviceWrapperList devices, String handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(DeviceWrapper device, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(DeviceWrapperList devices, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(Location location, String attributeName, handlerMethod, Map options = null)</code><br />
<br />
<br />
:;Parameters<br />
::app - Installed App to subscribe to.<br />
::location - Location to subscribe to.<br />
::device - Device to subscribe to.<br />
::handlerMethod - The method to run when an event is received.<br />
::attributeName - The name of the attribute to subscribe to.<br />
::options - Optional values to configure the subscribe. Possible values:<br />
:::''filterEvents'' - Used for device subscriptions. Set to false to receive all events, defaults to true and events that do not have a changed value will not be processed.<br />
<br />
===<code>unsubscribe</code>===<br />
:Unsubscribe from events sent from a device or all event subscriptions.<br />
<br />
:;Signature<br />
:: <code>void unsubscribe()</code><br />
:: <code>void unsubscribe(DeviceWrapper device)</code><br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList)</code><br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName)</code> (Since 2.0.7)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(InstalledAppWrapper installedApp)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location, String attributeName)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(String handlerMethod)</code> (Since 2.1.2)<br />
<br />
:;Parameters<br />
::device - The device to unsubscribe from.<br />
::deviceList - A list of devices to unsubscribe from.<br />
::attributeName - which attribute you want to unsubscribe from.<br />
::handlerMethod - The name of a method which was subscribed to a device event.<br />
::location - The location to unsubscribe from.<br />
::installedApp - The installed app to unsubscribe from.<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId)</code> (deprecated)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId, Map properties)</code> (deprecated)<br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::hubId - present for backwards compatibility, pass 1.<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
:: <code>List<ChildDeviceWrapper> getAllChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
==User Defined Methods==<br />
===<code>installed</code>===<br />
:This method is called when the app is first installed.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of an installed app are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
===<code>uninstalled</code>===<br />
:This method is called when the app is uninstalled. This method can be used to do any cleanup that is necessary.<br />
<br />
:;Signature<br />
:: <code>void uninstalled()</code><br />
<br />
== <code>Additional to be documented</code> ==<br />
Map getState()<br />
String apiServerUrl(String url)<br />
String localApiServerUrl(String url)<br />
String fullLocalApiServerUrl(String url)<br />
void setLocationMode(String mode)<br />
void pause(Long millisecs)<br />
InstalledAppWrapper getParent()<br />
InstalledAppWrapper addChildApp(String namespace, String name, String label, Map properties = null)<br />
void deleteChildApp(Long childAppId)<br />
DeviceWrapper getSubscribedDeviceById(Long deviceId)<br />
void sendEvent(Map properties)<br />
void sendEvent(DeviceWrapper device, Map properties)<br />
void sendEvent(String dni, Map properties)<br />
List<Event> getLocationEventsSince(String attributeName, Date startDate, Map options = null)<br />
void subscribe(Object thing, String attributeName, handlerMethod, Map options = null)<br />
void subscribe(location, handlerMethod)<br />
List<InstalledApp> getAllChildApps()<br />
List<InstalledApp> getChildApps()<br />
InstalledAppWrapper getChildAppById(Long childAppId)<br />
InstalledAppWrapper getChildAppByLabel(String childAppLabel)</div>Cschwerhttps://docs.hubitat.com/index.php?title=HubAction_Object&diff=2968HubAction Object2020-05-08T16:00:29Z<p>Cschwer: /* Constructor */</p>
<hr />
<div>===<code>Classpath</code>===<br />
hubitat.device.HubAction<br />
<br />
<br />
===<code>Constructor</code>===<br />
<br />
Create a HubAction object. While protocol is optional, it is recommended that it be provided. If it is not specified the system will default to the LAN protocol.<br />
<br />
:;Signature<br />
:: <code>HubAction()</code><br />
:: <code>HubAction(String request)</code><br />
:: <code>HubAction(String request, Protocol protocol, String dni)</code><br />
:: <code>HubAction(String request, Protocol protocol, String dni, Map options)</code><br />
:: <code>HubAction(String request, Protocol protocol)</code><br />
:: <code>HubAction(String request, Protocol protocol, Map options)</code><br />
:: <code>HubAction(Map params)</code><br />
:: <code>HubAction(Map params, String dni)</code><br />
:: <code>HubAction(Map params, String dni, Map options)</code><br />
<br />
:;Parameters<br />
:: request - The command to send as a String, this can be a ZigBee, Z-Wave or Lan message to send.<br />
:: protocol - The protocol to use when sending the message. See the Protocol documentation for more info.<br />
:: dni - The device network Id to use when sending the message. <br />
:: options - Optional settings when sending the command. See examples for usage. Possible values:<br />
:::''callback'' - A method name to pass the response from the HubAction back to. If not specified the response will be handed to the parse method of a Device or will be discarded if this HubAction was called from an App.<br />
:::''destinationAddress'' - The destination address to use when sending LAN messages. In the format ip:port, if no port is specified it defaults to 80.<br />
:::''destinationPort'' - The port number to use when sending UPNP discovery messages. Defaults to 1900.<br />
:::''type'' - The type of message to send if its not a standard HTTP request.<br />
::::''HubAction.LAN_TYPE_UDPCLIENT'' - Send message as a UDP package.<br />
::::''HubAction.LAN_TYPE_RAW'' - Send message as a raw TCP message.<br />
:::''secureCode'' - Used as part of a wake on lan request.<br />
:::''encoding''<br />
:::''ignoreResponse'' - (true/false) Used as part of UDP messages, instructs the system to ignore any response from the device to this message.<br />
:::''parseWarning'' - (true/false) Used as part of UDP messages, instructs the system to send any error message back to the parse method or callback method of the device. (Since 2.2.0)<br />
:::''timeout'' - Used as part of UPD or TCP messages. Sets the timeout for response from the device, defaults to 10 seconds, acceptable range is 1 to 300.<br />
:: params - a list of parameters for sending a Lan message. Possible values:<br />
:::''method'' - The http method to use, ie GET, POST, etc.<br />
:::''path'' - The path to access on the http endpoint.<br />
:::''query'' - Any query parameters to use when calling the path.<br />
:::''body'' - The request body to send.<br />
:::''headers'' - Additional headers to use in the http request.<br />
<br />
:;Examples<br />
<br />
//Create and send a Z-Wave message<br />
def hubAction = new hubitat.device.HubAction(new hubitat.zwave.commands.basicv1.BasicGet().format(), hubitat.device.Protocol.ZWAVE)<br />
sendHubCommand(hubAction)<br />
<br />
// Protocol.LAN examples<br />
<br />
// Send UDP Message<br />
new HubAction("My UDP Message", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT])<br />
<br />
// Send Binary UDP Message <br />
new HubAction("48756269746174", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT, encoding: HubAction.Encoding.HEX_STRING])<br />
<br />
// Send Wake On Lan to mac address 00:11:22:33:44:55<br />
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN)<br />
<br />
// Send Wake On Lan to mac address 00:11:22:33:44:55 with secure code<br />
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN, [secureCode: "112233"])<br />
<br />
// Send a UPnP SSDP discovery message<br />
new HubAction("lan discovery urn<span>:</span>schemas-somecompany-com:device:deviceName:1", Protocol.LAN)<br />
<br />
===<code>getAction</code>===<br />
<br />
Can be used to get the request value of the HubAction.<br />
<br />
:;Signature<br />
:: <code>String getAction()</code><br />
<br />
===<code>getCallbackMethod</code>===<br />
<br />
:;Signature<br />
:: <code>String getCallbackMethod()</code><br />
<br />
===<code>getURI</code>===<br />
<br />
:;Signature<br />
:: <code>URI getURI()</code></div>Cschwerhttps://docs.hubitat.com/index.php?title=Device_Object&diff=2967Device Object2020-05-08T15:51:51Z<p>Cschwer: </p>
<hr />
<div>The Device object (Technically com.hubitat.app.DeviceWrapper, com.hubitat.app.ChildDeviceWrapper and com.hubitat.app.ParentDeviceWrapper) is composed of methods that allow you to interact with the settings and values of a device. This object is available to Apps that have been given access via a device selection input, as child devices of Apps and other devices and a driver also has access to this via the device object.<br />
<br />
<br />
===<code>currentValue</code>===<br />
:Retrieve the current value of an attribute. By default this value is cached during a single run of the driver.<br />
<br />
:;Signature<br />
:: <code>Object currentValue(String attributeName)</code><br />
:: <code> Object currentValue(String attributeName, boolean skipCache)</code><br />
<br />
:;Parameters<br />
::attributeName - The attribute to get the current value of.<br />
::skipCache - Optional, do not use the cached value of the attribute, instead force the system to read the latest from the database.<br />
<br />
:;Returns<br />
::The current value of an attribute.<br />
<br />
<br />
===<code>events</code>===<br />
:Retrieve a list of events for the device. By default the maximum number of events returned in the list is 10 which can be overridden by the max option.<br />
<br />
:;Signature<br />
:: <code>List<Event> events()</code><br />
:: <code>List<Event> events(Map options)</code><br />
<br />
:;Parameters<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::List of Event objects for the device<br />
<br />
<br />
===<code>eventsSince</code>===<br />
:Retrieve a list of events since a date/time.<br />
<br />
:;Signature<br />
:: <code>List<Event> eventsSince(Date startDate)</code><br />
:: <code>List<Event> eventsSince(Date startDate, Map options)</code><br />
<br />
:;Parameters<br />
:: startDate - The date/time to list events since.<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::A list of Events (defaults to 10 events unless otherwise specified in options)<br />
<br />
:;Examples<br />
<br />
// Get events since 8:00 am today<br />
def events = eventsSince(timeToday("08:00"))<br />
<br />
// Get a maximum of 5 events<br />
def events = eventsSince(timeToday("08:00"), [max:5])<br />
<br />
===<code>getName</code>===<br />
:Retrieve the name of the device.<br />
<br />
:;Signature<br />
:: <code>String getName()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The name of the device<br />
<br />
===<code>setName</code>===<br />
:Update the name of the device.<br />
<br />
:;Signature<br />
:: <code>void setName(String name)</code><br />
<br />
:;Parameters<br />
::name - the new name for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
===<code>getLabel</code>===<br />
:Retrieve the label of the device.<br />
<br />
:;Signature<br />
:: <code>String getLabel()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The label of the device<br />
<br />
===<code>setLabel</code>===<br />
:Update the label of the device.<br />
<br />
:;Signature<br />
:: <code>void setLabel(String label)</code><br />
<br />
:;Parameters<br />
::label - the new label for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
===<code>hasAttribute</code>===<br />
:Determines if the device has the specified attribute. This works for both built-in and custom attributes.<br />
<br />
:;Signature<br />
::<code>Boolean hasAttribute(String attribute)</code><br />
<br />
:;Parameters<br />
::attribute- The attribute to check for.<br />
<br />
:;Returns<br />
::True if the attribute exists, false otherwise.<br />
<br />
===<code>hasCapability</code>===<br />
:Determines if the device has the specified capability.<br />
<br />
:;Signature<br />
::<code>Boolean hasCapability(String capability)</code><br />
<br />
:;Parameters<br />
::capability - The capability to check for.<br />
<br />
:;Returns<br />
::True if the capability exists, false otherwise.<br />
<br />
===<code>hasCommand</code>===<br />
:Determines if the device has the specified command. This works for both built-in and custom commands.<br />
<br />
:;Signature<br />
::<code> Boolean hasCommand(String command)</code><br />
<br />
:;Parameters<br />
::command - The command to check for.<br />
<br />
:;Returns<br />
::True if the command exists, false otherwise.<br />
<br />
===<code>updateSetting</code>===<br />
:Updates the value of a setting (preference) to the specified value. If the setting does not exist, this method will create it.<br />
<br />
:;Signature<br />
::<code>void updateSetting(String name, Long value)</code><br />
::<code>void updateSetting(String name, Boolean value)</code><br />
::<code>void updateSetting(String name, String value)</code><br />
::<code>void updateSetting(String name, Double value)</code><br />
::<code>void updateSetting(String name, Date value)</code><br />
::<code>void updateSetting(String name, List value)</code><br />
<br />
:;Parameters<br />
::name - The name of the setting to update<br />
::value - The value to store in the setting<br />
<br />
:;Returns<br />
::None<br />
<br />
==<code>Additional to be documented</code>==<br />
List<Event> eventsBetween(Date startDate, Date endDate)<br />
List<Event> eventsBetween(Date startDate, Date endDate, Map options = null)<br />
List<State> statesSince(String attributeName, Date startDate)<br />
List<State> statesSince(String attributeName, Date startDate, Map options = null)<br />
void sendEvent(Map properties)<br />
void updateSetting(String name, Map options)<br />
void removeSetting(String name)<br />
void clearSetting(String name)<br />
Long getIdAsLong()<br />
String getId()<br />
String getEndpointId()<br />
String getZigbeeId()<br />
Hub getHub()<br />
Map getData()<br />
void updateDataValue(String name, String value)<br />
String getDataValue(String name)<br />
String getDeviceDataByName(String name)<br />
String getStatus()<br />
String getDisplayName()<br />
void setDisplayName(String displayName)<br />
String getDeviceNetworkId()<br />
void setDeviceNetworkId(String dni)<br />
State currentState(String attributeName)<br />
State currentState(String attributeName, boolean skipCache)<br />
Object latestValue(String attributeName)<br />
Object latestValue(String attributeName, boolean skipCache)<br />
State latestState(String attributeName)<br />
State latestState(String attributeName, boolean skipCache)<br />
List<State> getCurrentStates()<br />
List<Command> getSupportedCommands()<br />
List<Attribute> getSupportedAttributes()<br />
List<Capability> getCapabilities()<br />
Date getLastActivity()<br />
Long getParentDeviceId()<br />
Long getParentAppId()<br />
Boolean getIsComponent()<br />
boolean isDisabled()</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes_2.2.0&diff=2954Release Notes 2.2.02020-04-21T17:45:42Z<p>Cschwer: Created page with " '''Hubitat Elevation Platform update 2.2.0 is now available:''' Please note, the process takes about a minute to download (depending on your Internet connection) and extract..."</p>
<hr />
<div><br />
'''Hubitat Elevation Platform update 2.2.0 is now available:'''<br />
<br />
Please note, the process takes about a minute to download (depending on your Internet connection) and extract the hub update, and 1-2 minutes to perform the update after you click 'Update Hub'. We recommend that you periodically download a backup of your setup from the Settings page, Backup and Restore.<br />
<br />
'''Changes from 2.1.9''':<br />
<br />
''Drivers and Devices''<br />
<br />
* New drivers:<br />
** Shelly WiFi Dimmer<br />
** Shelly WiFi Switch<br />
** Lutron VCRX (Visor Control Receiver)<br />
** Leviton DZ6HD Z-Wave Dimmer<br />
** Leviton VRCS1 Z-Wave Controller<br />
* New driver features:<br />
** Alfred Z-Wave Lock, now supports lock codes on DB1 and newer firmware firmware DB2 locks.<br />
** Generic Z-Wave Button Controller, add doubleTapable support.<br />
<br />
''New App Features''<br />
<br />
* Simple Lighting has been renamed to Simple Automation Rules<br />
** Additional reciprocal action options added.<br />
* Maker API: Add evt.type for events (physical/digital)<br />
* Rule 4.0: <br />
** Made GV references faster in UI.<br />
** Added setScheduledSetpoints for Thermostat Scheduler actions.<br />
* Button Controller has been unretired.<br />
* Thermostat Scheduler:<br />
** Added optional thermostat refresh interval.<br />
** Added optional logging.<br />
** Reworked user interface.<br />
** Added external command to set thermostat to current scheduled setpoints.<br />
** Sets only appropriate setpoint for heat or cool thermostat modes.<br />
** Enforces required setpoint separation in user interface.<br />
* Mode Lighting: Allow choice for non-physical on<br />
* Dashboards now allow language localization for English, Spanish and Italian<br />
<br />
''Bug Fixes''<br />
<br />
* Rule 4.0:<br />
** Fixed Cancel Rule Timers for Waits.<br />
** FIxed 0 offset for Sunrise and Sunset.<br />
** Fixed sorting of buttons for button devices with more than 9 buttons.<br />
** Fixed Time of Day condition bug for button device trigger.<br />
** Fixed display bug with time for Thermostat Scheduler actions.<br />
** Fixed missing action: Stop dimmer fade.<br />
* Rule Machine: Fixed attempt to clone a deleted rule.<br />
* Honeywell T6 Pro Z-Wave Thermostat: fix operating state not updating.<br />
* Zooz 4-in-1 Sensor: Format battery level as integer.<br />
* Aeotec TriSensor: Format battery level as integer.<br />
* Hubitat Safety Monitor: Fixed disarm after disarmAll issue.<br />
* Lock Code Manager: <br />
** Fixed static limit of 30 users, now reads code slots from each lock.<br />
** Relaxed code retry timing to accommodate slower lock response times.<br />
* Virtual Lock Driver: Fixed lock codes starting with 0 not working.<br />
* Notifier: <br />
** Fixed bug with Any Lock Code.<br />
** Fixed UI selector for selecting Lock for Lock Codes.<br />
* Thermostat Scheduler: <br />
** Fixed bugs with required setpoint separation.<br />
** Fixed period sorting for 12 pm times.<br />
<br />
''Platform Changes''<br />
<br />
* Changes to the overnight cleanup process to make it less processor intensive.<br />
* Overnight backup will happen immediately after the cleanup has finished.<br />
* Added an additional option “parseWarning” to UDP messages, if set to true any warning messages will be returned to the parse method or callback method instead of being sent to the live logs.<br />
* Orphaned Zigbee devices (IE, deleted but never excluded or factory reset) will now create a new device using the default “Driver” device when they first communicate with the Hub.</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes&diff=2953Release Notes2020-04-21T17:41:48Z<p>Cschwer: </p>
<hr />
<div>Hubitat release notes are specific to each version. Select your version from the list below to see the release notes for it.<br />
<br />
[[Release_Notes_1.1.5| 1.1.5]]<br />
<br />
[[Release_Notes_1.1.6| 1.1.6]]<br />
<br />
[[Release_Notes_2.0.0| 2.0.0]]<br />
<br />
[[Release_Notes_2.0.1| 2.0.1]]<br />
<br />
[[Release_Notes_2.0.2| 2.0.2]]<br />
<br />
[[Release_Notes_2.0.3| 2.0.3]]<br />
<br />
[[Release_Notes_2.0.4| 2.0.4]]<br />
<br />
[[Release_Notes_2.0.5| 2.0.5]]<br />
<br />
[[Release_Notes_2.0.6| 2.0.6]]<br />
<br />
[[Release_Notes_2.0.7| 2.0.7]]<br />
<br />
[[Release_Notes_2.0.8| 2.0.8]]<br />
<br />
[[Release_Notes_2.0.9| 2.0.9]]<br />
<br />
[[Release_Notes_2.1.0| 2.1.0]]<br />
<br />
[[Release_Notes_2.1.1| 2.1.1]]<br />
<br />
[[Release_Notes_2.1.2| 2.1.2]]<br />
<br />
[[Release_Notes_2.1.3| 2.1.3]]<br />
<br />
[[Release_Notes_2.1.4| 2.1.4]]<br />
<br />
[[Release_Notes_2.1.5| 2.1.5]]<br />
<br />
[[Release_Notes_2.1.6| 2.1.6]]<br />
<br />
[[Release_Notes_2.1.7| 2.1.7]]<br />
<br />
[[Release_Notes_2.1.8| 2.1.8]]<br />
<br />
[[Release_Notes_2.1.9| 2.1.9]]<br />
<br />
[[Release_Notes_2.2.0| 2.2.0]]</div>Cschwerhttps://docs.hubitat.com/index.php?title=Device_Object&diff=2932Device Object2020-04-08T15:30:12Z<p>Cschwer: </p>
<hr />
<div>The Device object (Technically DeviceWrapper, ChildDeviceWrapper and ParentDeviceWrapper) is composed of methods that allow you to interact with the settings and values of a device. This object is available to Apps that have been given access via a device selection input, as child devices of Apps and other devices and a driver also has access to this via the device object.<br />
<br />
<br />
===<code>currentValue</code>===<br />
:Retrieve the current value of an attribute. By default this value is cached during a single run of the driver.<br />
<br />
:;Signature<br />
:: <code>Object currentValue(String attributeName)</code><br />
:: <code> Object currentValue(String attributeName, boolean skipCache)</code><br />
<br />
:;Parameters<br />
::attributeName - The attribute to get the current value of.<br />
::skipCache - Optional, do not use the cached value of the attribute, instead force the system to read the latest from the database.<br />
<br />
:;Returns<br />
::The current value of an attribute.<br />
<br />
<br />
===<code>events</code>===<br />
:Retrieve a list of events for the device. By default the maximum number of events returned in the list is 10 which can be overridden by the max option.<br />
<br />
:;Signature<br />
:: <code>List<Event> events()</code><br />
:: <code>List<Event> events(Map options)</code><br />
<br />
:;Parameters<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::List of Event objects for the device<br />
<br />
<br />
===<code>eventsSince</code>===<br />
:Retrieve a list of events since a date/time.<br />
<br />
:;Signature<br />
:: <code>List<Event> eventsSince(Date startDate)</code><br />
:: <code>List<Event> eventsSince(Date startDate, Map options)</code><br />
<br />
:;Parameters<br />
:: startDate - The date/time to list events since.<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::A list of Events (defaults to 10 events unless otherwise specified in options)<br />
<br />
:;Examples<br />
<br />
// Get events since 8:00 am today<br />
def events = eventsSince(timeToday("08:00"))<br />
<br />
// Get a maximum of 5 events<br />
def events = eventsSince(timeToday("08:00"), [max:5])<br />
<br />
===<code>getName</code>===<br />
:Retrieve the name of the device.<br />
<br />
:;Signature<br />
:: <code>String getName()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The name of the device<br />
<br />
===<code>setName</code>===<br />
:Update the name of the device.<br />
<br />
:;Signature<br />
:: <code>void setName(String name)</code><br />
<br />
:;Parameters<br />
::name - the new name for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
===<code>getLabel</code>===<br />
:Retrieve the label of the device.<br />
<br />
:;Signature<br />
:: <code>String getLabel()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The label of the device<br />
<br />
===<code>setLabel</code>===<br />
:Update the label of the device.<br />
<br />
:;Signature<br />
:: <code>void setLabel(String label)</code><br />
<br />
:;Parameters<br />
::label - the new label for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
===<code>hasAttribute</code>===<br />
:Determines if the device has the specified attribute. This works for both built-in and custom attributes.<br />
<br />
:;Signature<br />
::<code>Boolean hasAttribute(String attribute)</code><br />
<br />
:;Parameters<br />
::attribute- The attribute to check for.<br />
<br />
:;Returns<br />
::True if the attribute exists, false otherwise.<br />
<br />
===<code>hasCapability</code>===<br />
:Determines if the device has the specified capability.<br />
<br />
:;Signature<br />
::<code>Boolean hasCapability(String capability)</code><br />
<br />
:;Parameters<br />
::capability - The capability to check for.<br />
<br />
:;Returns<br />
::True if the capability exists, false otherwise.<br />
<br />
===<code>hasCommand</code>===<br />
:Determines if the device has the specified command. This works for both built-in and custom commands.<br />
<br />
:;Signature<br />
::<code> Boolean hasCommand(String command)</code><br />
<br />
:;Parameters<br />
::command - The command to check for.<br />
<br />
:;Returns<br />
::True if the command exists, false otherwise.<br />
<br />
===<code>updateSetting</code>===<br />
:Updates the value of a setting (preference) to the specified value. If the setting does not exist, this method will create it.<br />
<br />
:;Signature<br />
::<code>void updateSetting(String name, Long value)</code><br />
::<code>void updateSetting(String name, Boolean value)</code><br />
::<code>void updateSetting(String name, String value)</code><br />
::<code>void updateSetting(String name, Double value)</code><br />
::<code>void updateSetting(String name, Date value)</code><br />
::<code>void updateSetting(String name, List value)</code><br />
<br />
:;Parameters<br />
::name - The name of the setting to update<br />
::value - The value to store in the setting<br />
<br />
:;Returns<br />
::None<br />
<br />
==<code>Additional to be documented</code>==<br />
List<Event> eventsBetween(Date startDate, Date endDate)<br />
List<Event> eventsBetween(Date startDate, Date endDate, Map options = null)<br />
List<State> statesSince(String attributeName, Date startDate)<br />
List<State> statesSince(String attributeName, Date startDate, Map options = null)<br />
void sendEvent(Map properties)<br />
void updateSetting(String name, Map options)<br />
void removeSetting(String name)<br />
void clearSetting(String name)<br />
Long getIdAsLong()<br />
String getId()<br />
String getEndpointId()<br />
String getZigbeeId()<br />
Hub getHub()<br />
Map getData()<br />
void updateDataValue(String name, String value)<br />
String getDataValue(String name)<br />
String getDeviceDataByName(String name)<br />
String getStatus()<br />
String getDisplayName()<br />
void setDisplayName(String displayName)<br />
String getDeviceNetworkId()<br />
void setDeviceNetworkId(String dni)<br />
State currentState(String attributeName)<br />
State currentState(String attributeName, boolean skipCache)<br />
Object latestValue(String attributeName)<br />
Object latestValue(String attributeName, boolean skipCache)<br />
State latestState(String attributeName)<br />
State latestState(String attributeName, boolean skipCache)<br />
List<State> getCurrentStates()<br />
List<Command> getSupportedCommands()<br />
List<Attribute> getSupportedAttributes()<br />
List<Capability> getCapabilities()<br />
Date getLastActivity()<br />
Long getParentDeviceId()<br />
Long getParentAppId()<br />
Boolean getIsComponent()<br />
boolean isDisabled()</div>Cschwerhttps://docs.hubitat.com/index.php?title=Z-Wave_Manual&diff=2916Z-Wave Manual2020-04-05T14:48:32Z<p>Cschwer: Blanked the page</p>
<hr />
<div></div>Cschwerhttps://docs.hubitat.com/index.php?title=HubAction_Object&diff=2886HubAction Object2020-03-24T15:29:36Z<p>Cschwer: </p>
<hr />
<div>===<code>Constructor</code>===<br />
<br />
Create a HubAction object. While protocol is optional, it is recommended that it be provided. If it is not specified the system will default to the LAN protocol.<br />
<br />
:;Signature<br />
:: <code>HubAction()</code><br />
:: <code>HubAction(String request)</code><br />
:: <code>HubAction(String request, Protocol protocol, String dni)</code><br />
:: <code>HubAction(String request, Protocol protocol, String dni, Map options)</code><br />
:: <code>HubAction(String request, Protocol protocol)</code><br />
:: <code>HubAction(String request, Protocol protocol, Map options)</code><br />
:: <code>HubAction(Map params)</code><br />
:: <code>HubAction(Map params, String dni)</code><br />
:: <code>HubAction(Map params, String dni, Map options)</code><br />
<br />
:;Parameters<br />
:: request - The command to send as a String, this can be a ZigBee, Z-Wave or Lan message to send.<br />
:: protocol - The protocol to use when sending the message. See the Protocol documentation for more info.<br />
:: dni - The device network Id to use when sending the message. <br />
:: options - Optional settings when sending the command. See examples for usage. Possible values:<br />
:::''callback'' - A method name to pass the response from the HubAction back to. If not specified the response will be handed to the parse method of a Device or will be discarded if this HubAction was called from an App.<br />
:::''destinationAddress'' - The destination address to use when sending LAN messages. In the format ip:port, if no port is specified it defaults to 80.<br />
:::''destinationPort'' - The port number to use when sending UPNP discovery messages. Defaults to 1900.<br />
:::''type'' - The type of message to send if its not a standard HTTP request.<br />
::::''HubAction.LAN_TYPE_UDPCLIENT'' - Send message as a UDP package.<br />
::::''HubAction.LAN_TYPE_RAW'' - Send message as a raw TCP message.<br />
:::''secureCode'' - Used as part of a wake on lan request.<br />
:::''encoding''<br />
:::''ignoreResponse'' - (true/false) Used as part of UDP messages, instructs the system to ignore any response from the device to this message.<br />
:::''parseWarning'' - (true/false) Used as part of UDP messages, instructs the system to send any error message back to the parse method or callback method of the device. (Since 2.2.0)<br />
:::''timeout'' - Used as part of UPD or TCP messages. Sets the timeout for response from the device, defaults to 10 seconds, acceptable range is 1 to 300.<br />
:: params - a list of parameters for sending a Lan message. Possible values:<br />
:::''method'' - The http method to use, ie GET, POST, etc.<br />
:::''path'' - The path to access on the http endpoint.<br />
:::''query'' - Any query parameters to use when calling the path.<br />
:::''body'' - The request body to send.<br />
:::''headers'' - Additional headers to use in the http request.<br />
<br />
:;Examples<br />
<br />
//Create and send a Z-Wave message<br />
def hubAction = new hubitat.device.HubAction(new hubitat.zwave.commands.basicv1.BasicGet().format(), hubitat.device.Protocol.ZWAVE)<br />
sendHubCommand(hubAction)<br />
<br />
// Protocol.LAN examples<br />
<br />
// Send UDP Message<br />
new HubAction("My UDP Message", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT])<br />
<br />
// Send Binary UDP Message <br />
new HubAction("48756269746174", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT, encoding: HubAction.Encoding.HEX_STRING])<br />
<br />
// Send Wake On Lan to mac address 00:11:22:33:44:55<br />
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN)<br />
<br />
// Send Wake On Lan to mac address 00:11:22:33:44:55 with secure code<br />
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN, [secureCode: "112233"])<br />
<br />
===<code>getAction</code>===<br />
<br />
Can be used to get the request value of the HubAction.<br />
<br />
:;Signature<br />
:: <code>String getAction()</code><br />
<br />
===<code>getCallbackMethod</code>===<br />
<br />
:;Signature<br />
:: <code>String getCallbackMethod()</code><br />
<br />
===<code>getURI</code>===<br />
<br />
:;Signature<br />
:: <code>URI getURI()</code></div>Cschwerhttps://docs.hubitat.com/index.php?title=Device_Object&diff=2885Device Object2020-03-20T14:11:32Z<p>Cschwer: </p>
<hr />
<div>The Device object (Technically DeviceWrapper, ChildDeviceWrapper and ParentDeviceWrapper) is composed of methods that allow you to interact with the settings and values of a device. This object is available to Apps that have been given access via a device selection input, as child devices of Apps and other devices and a driver also has access to this via the device object.<br />
<br />
===<code>events</code>===<br />
:Retrieve a list of events for the device. By default the maximum number of events returned in the list is 10 which can be overridden by the max option.<br />
<br />
:;Signature<br />
:: <code>List<Event> events()</code><br />
:: <code>List<Event> events(Map options)</code><br />
<br />
:;Parameters<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::List of Event objects for the device<br />
<br />
<br />
===<code>eventsSince</code>===<br />
:Retrieve a list of events since a date/time.<br />
<br />
:;Signature<br />
:: <code>List<Event> eventsSince(Date startDate)</code><br />
:: <code>List<Event> eventsSince(Date startDate, Map options)</code><br />
<br />
:;Parameters<br />
:: startDate - The date/time to list events since.<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::A list of Events (defaults to 10 events unless otherwise specified in options)<br />
<br />
:;Examples<br />
<br />
// Get events since 8:00 am today<br />
def events = eventsSince(timeToday("08:00"))<br />
<br />
// Get a maximum of 5 events<br />
def events = eventsSince(timeToday("08:00"), [max:5])<br />
<br />
===<code>getName</code>===<br />
:Retrieve the name of the device.<br />
<br />
:;Signature<br />
:: <code>String getName()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The name of the device<br />
<br />
===<code>setName</code>===<br />
:Update the name of the device.<br />
<br />
:;Signature<br />
:: <code>void setName(String name)</code><br />
<br />
:;Parameters<br />
::name - the new name for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
===<code>getLabel</code>===<br />
:Retrieve the label of the device.<br />
<br />
:;Signature<br />
:: <code>String getLabel()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The label of the device<br />
<br />
===<code>setLabel</code>===<br />
:Update the label of the device.<br />
<br />
:;Signature<br />
:: <code>void setLabel(String label)</code><br />
<br />
:;Parameters<br />
::label - the new label for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
==<code>Additional to be documented</code>==<br />
List<Event> eventsBetween(Date startDate, Date endDate)<br />
List<Event> eventsBetween(Date startDate, Date endDate, Map options = null)<br />
List<State> statesSince(String attributeName, Date startDate)<br />
List<State> statesSince(String attributeName, Date startDate, Map options = null)<br />
void sendEvent(Map properties)<br />
void updateSetting(String name, Map options)<br />
void updateSetting(String name, Long value)<br />
void updateSetting(String name, Boolean value)<br />
void updateSetting(String name, String value)<br />
void updateSetting(String name, Double value)<br />
void updateSetting(String name, Date value)<br />
void updateSetting(String name, List value)<br />
void removeSetting(String name)<br />
void clearSetting(String name)<br />
Long getIdAsLong()<br />
String getId()<br />
String getEndpointId()<br />
String getZigbeeId()<br />
Hub getHub()<br />
Map getData()<br />
void updateDataValue(String name, String value)<br />
String getDataValue(String name)<br />
String getDeviceDataByName(String name)<br />
String getStatus()<br />
String getDisplayName()<br />
void setDisplayName(String displayName)<br />
String getDeviceNetworkId()<br />
void setDeviceNetworkId(String dni)<br />
Object currentValue(String attributeName)<br />
Object currentValue(String attributeName, boolean skipCache)<br />
State currentState(String attributeName)<br />
State currentState(String attributeName, boolean skipCache)<br />
Object latestValue(String attributeName)<br />
Object latestValue(String attributeName, boolean skipCache)<br />
State latestState(String attributeName)<br />
State latestState(String attributeName, boolean skipCache)<br />
List<State> getCurrentStates()<br />
List<Command> getSupportedCommands()<br />
List<Attribute> getSupportedAttributes()<br />
List<Capability> getCapabilities()<br />
Boolean hasCommand(String command)<br />
Boolean hasAttribute(String attribute)<br />
Boolean hasCapability(String capability)<br />
Date getLastActivity()<br />
Long getParentDeviceId()<br />
Long getParentAppId()<br />
Boolean getIsComponent()<br />
boolean isDisabled()</div>Cschwerhttps://docs.hubitat.com/index.php?title=Device_Object&diff=2884Device Object2020-03-20T14:07:52Z<p>Cschwer: </p>
<hr />
<div>The Device object (Technically DeviceWrapper, ChildDeviceWrapper and ParentDeviceWrapper) is composed of methods that allow you to interact with the settings and values of a device. This object is available to Apps that have been given access via a device selection input, as child devices of Apps and other devices and a driver also has access to this via the device object.<br />
<br />
===<code>events</code>===<br />
:Retrieve a list of events for the device. By default the maximum number of events returned in the list is 10 which can be overridden by the max option.<br />
<br />
:;Signature<br />
:: <code>List<Event> events()</code><br />
:: <code>List<Event> events(Map options)</code><br />
<br />
:;Parameters<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::List of Event objects for the device<br />
<br />
<br />
===<code>eventsSince</code>===<br />
:Retrieve a list of events since a date/time.<br />
<br />
:;Signature<br />
:: <code>List<Event> eventsSince(Date startDate)</code><br />
:: <code>List<Event> eventsSince(Date startDate, Map options)</code><br />
<br />
:;Parameters<br />
:: startDate - The date/time to list events since.<br />
::options - Optional values for getting the list of events. Possible values:<br />
:::''max'' - The maximum number of events to retrieve.<br />
<br />
:;Returns<br />
::A list of Events (defaults to 10 events unless otherwise specified in options)<br />
<br />
:;Examples<br />
<br />
// Get events since 8:00 am today<br />
def events = eventsSince(timeToday("08:00"))<br />
<br />
// Get a maximum of 5 events<br />
def events = eventsSince(timeToday("08:00"), [max:5])<br />
<br />
===<code>getName</code>===<br />
:Retrieve the name of the device.<br />
<br />
:;Signature<br />
:: <code>String getName()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
::String - The name of the device<br />
<br />
===<code>setName</code>===<br />
:Update the name of the device.<br />
<br />
:;Signature<br />
:: <code>void setName(String name)</code><br />
<br />
:;Parameters<br />
::name - the new name for the device.<br />
<br />
:;Returns<br />
::none<br />
<br />
==<code>Additional to be documented</code>==<br />
List<Event> eventsBetween(Date startDate, Date endDate)<br />
List<Event> eventsBetween(Date startDate, Date endDate, Map options = null)<br />
List<State> statesSince(String attributeName, Date startDate)<br />
List<State> statesSince(String attributeName, Date startDate, Map options = null)<br />
void sendEvent(Map properties)<br />
void updateSetting(String name, Map options)<br />
void updateSetting(String name, Long value)<br />
void updateSetting(String name, Boolean value)<br />
void updateSetting(String name, String value)<br />
void updateSetting(String name, Double value)<br />
void updateSetting(String name, Date value)<br />
void updateSetting(String name, List value)<br />
void removeSetting(String name)<br />
void clearSetting(String name)<br />
Long getIdAsLong()<br />
String getId()<br />
String getEndpointId()<br />
String getZigbeeId()<br />
Hub getHub()<br />
Map getData()<br />
void updateDataValue(String name, String value)<br />
String getDataValue(String name)<br />
String getDeviceDataByName(String name)<br />
String getStatus()<br />
String getLabel()<br />
void setLabel(String label)<br />
String getDisplayName()<br />
void setDisplayName(String displayName)<br />
String getDeviceNetworkId()<br />
void setDeviceNetworkId(String dni)<br />
Object currentValue(String attributeName)<br />
Object currentValue(String attributeName, boolean skipCache)<br />
State currentState(String attributeName)<br />
State currentState(String attributeName, boolean skipCache)<br />
Object latestValue(String attributeName)<br />
Object latestValue(String attributeName, boolean skipCache)<br />
State latestState(String attributeName)<br />
State latestState(String attributeName, boolean skipCache)<br />
List<State> getCurrentStates()<br />
List<Command> getSupportedCommands()<br />
List<Attribute> getSupportedAttributes()<br />
List<Capability> getCapabilities()<br />
Boolean hasCommand(String command)<br />
Boolean hasAttribute(String attribute)<br />
Boolean hasCapability(String capability)<br />
Date getLastActivity()<br />
Long getParentDeviceId()<br />
Long getParentAppId()<br />
Boolean getIsComponent()<br />
boolean isDisabled()</div>Cschwerhttps://docs.hubitat.com/index.php?title=HubAction_Object&diff=2867HubAction Object2020-03-18T15:06:55Z<p>Cschwer: </p>
<hr />
<div>===<code>Constructor</code>===<br />
<br />
Create a HubAction object. While protocol is optional, it is recommended that it be provided. If it is not specified the system will default to the LAN protocol.<br />
<br />
:;Signature<br />
:: <code>HubAction()</code><br />
:: <code>HubAction(String request)</code><br />
:: <code>HubAction(String request, Protocol protocol, String dni)</code><br />
:: <code>HubAction(String request, Protocol protocol, String dni, Map options)</code><br />
:: <code>HubAction(String request, Protocol protocol)</code><br />
:: <code>HubAction(String request, Protocol protocol, Map options)</code><br />
:: <code>HubAction(Map params)</code><br />
:: <code>HubAction(Map params, String dni)</code><br />
:: <code>HubAction(Map params, String dni, Map options)</code><br />
<br />
:;Parameters<br />
:: request - The command to send as a String, this can be a ZigBee, Z-Wave or Lan message to send.<br />
:: protocol - The protocol to use when sending the message. See the Protocol documentation for more info.<br />
:: dni - The device network Id to use when sending the message. <br />
:: options - Optional settings when sending the command. See examples for usage. Possible values:<br />
:::''callback'' - A method name to pass the response from the HubAction back to. If not specified the response will be handed to the parse method of a Device or will be discarded if this HubAction was called from an App.<br />
:::''destinationAddress'' - The destination address to use when sending LAN messages. In the format ip:port, if no port is specified it defaults to 80.<br />
:::''destinationPort'' - The port number to use when sending UPNP discovery messages. Defaults to 1900.<br />
:::''type'' - The type of message to send if its not a standard HTTP request.<br />
::::''HubAction.LAN_TYPE_UDPCLIENT'' - Send message as a UDP package.<br />
::::''HubAction.LAN_TYPE_RAW'' - Send message as a raw TCP message.<br />
:::''secureCode'' - Used as part of a wake on lan request.<br />
:::''encoding''<br />
:::''ignoreResponse'' - (true/false) Used as part of UDP messages, instructs the system to ignore any response from the device to this message.<br />
:::''parseWarning'' - (true/false) Used as part of UDP messages, instructs the system to send any error message back to the parse method of the device. (Since 2.2.0)<br />
:::''timeout'' - Used as part of UPD or TCP messages. Sets the timeout for response from the device, defaults to 10 seconds, acceptable range is 1 to 300.<br />
:: params - a list of parameters for sending a Lan message. Possible values:<br />
:::''method'' - The http method to use, ie GET, POST, etc.<br />
:::''path'' - The path to access on the http endpoint.<br />
:::''query'' - Any query parameters to use when calling the path.<br />
:::''body'' - The request body to send.<br />
:::''headers'' - Additional headers to use in the http request.<br />
<br />
:;Examples<br />
<br />
//Create and send a Z-Wave message<br />
def hubAction = new hubitat.device.HubAction(new hubitat.zwave.commands.basicv1.BasicGet().format(), hubitat.device.Protocol.ZWAVE)<br />
sendHubCommand(hubAction)<br />
<br />
// Protocol.LAN examples<br />
<br />
// Send UDP Message<br />
new HubAction("My UDP Message", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT])<br />
<br />
// Send Binary UDP Message <br />
new HubAction("48756269746174", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT, encoding: HubAction.Encoding.HEX_STRING])<br />
<br />
// Send Wake On Lan to mac address 00:11:22:33:44:55<br />
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN)<br />
<br />
// Send Wake On Lan to mac address 00:11:22:33:44:55 with secure code<br />
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN, [secureCode: "112233"])<br />
<br />
===<code>getAction</code>===<br />
<br />
Can be used to get the request value of the HubAction.<br />
<br />
:;Signature<br />
:: <code>String getAction()</code><br />
<br />
===<code>getCallbackMethod</code>===<br />
<br />
:;Signature<br />
:: <code>String getCallbackMethod()</code><br />
<br />
===<code>getURI</code>===<br />
<br />
:;Signature<br />
:: <code>URI getURI()</code></div>Cschwerhttps://docs.hubitat.com/index.php?title=HubAction_Object&diff=2748HubAction Object2020-03-11T19:53:21Z<p>Cschwer: </p>
<hr />
<div>===<code>Constructor</code>===<br />
<br />
Create a HubAction object. While protocol is optional, it is recommended that it be provided. If it is not specified the system will default to the LAN protocol.<br />
<br />
:;Signature<br />
:: <code>HubAction()</code><br />
:: <code>HubAction(String request)</code><br />
:: <code>HubAction(String request, Protocol protocol, String dni)</code><br />
:: <code>HubAction(String request, Protocol protocol, String dni, Map options)</code><br />
:: <code>HubAction(String request, Protocol protocol)</code><br />
:: <code>HubAction(String request, Protocol protocol, Map options)</code><br />
:: <code>HubAction(Map params)</code><br />
:: <code>HubAction(Map params, String dni)</code><br />
:: <code>HubAction(Map params, String dni, Map options)</code><br />
<br />
:;Parameters<br />
:: request - The command to send as a String, this can be a ZigBee, Z-Wave or Lan message to send.<br />
:: protocol - The protocol to use when sending the message. See the Protocol documentation for more info.<br />
:: dni - The device network Id to use when sending the message. <br />
:: options - Optional settings when sending the command. See examples for usage. Possible values:<br />
:::''callback'' - A method name to pass the response from the HubAction back to. If not specified the response will be handed to the parse method of a Device or will be discarded if this HubAction was called from an App.<br />
:::''destinationAddress'' - The destination address to use when sending LAN messages. In the format ip:port, if no port is specified it defaults to 80.<br />
:::''destinationPort'' - The port number to use when sending UPNP discovery messages. Defaults to 1900.<br />
:::''type'' - The type of message to send if its not a standard HTTP request.<br />
::::''HubAction.LAN_TYPE_UDPCLIENT'' - Send message as a UDP package.<br />
::::''HubAction.LAN_TYPE_RAW'' - Send message as a raw TCP message.<br />
:::''secureCode'' - Used as part of a wake on lan request.<br />
:::''encoding''<br />
:::''ignoreResponse'' - Used as part of UDP messages, instructs the system to ignore any response from the device to this message.<br />
:::''parseWarning'' - Usage as part of UDP messages, instructs the system to send any error message back to the parse method of the device. (Since 2.2.0)<br />
:::''timeout'' - Used as part of UPD or TCP messages. Sets the timeout for response from the device, defaults to 10 seconds, acceptable range is 1 to 300.<br />
:: params - a list of parameters for sending a Lan message. Possible values:<br />
:::''method'' - The http method to use, ie GET, POST, etc.<br />
:::''path'' - The path to access on the http endpoint.<br />
:::''query'' - Any query parameters to use when calling the path.<br />
:::''body'' - The request body to send.<br />
:::''headers'' - Additional headers to use in the http request.<br />
<br />
:;Examples<br />
<br />
//Create and send a Z-Wave message<br />
def hubAction = new hubitat.device.HubAction(new hubitat.zwave.commands.basicv1.BasicGet().format(), hubitat.device.Protocol.ZWAVE)<br />
sendHubCommand(hubAction)<br />
<br />
// Protocol.LAN examples<br />
<br />
// Send UDP Message<br />
new HubAction("My UDP Message", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT])<br />
<br />
// Send Binary UDP Message <br />
new HubAction("48756269746174", Protocol.LAN, [type: HubAction.Type.LAN_TYPE_UDPCLIENT, encoding: HubAction.Encoding.HEX_STRING])<br />
<br />
// Send Wake On Lan to mac address 00:11:22:33:44:55<br />
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN)<br />
<br />
// Send Wake On Lan to mac address 00:11:22:33:44:55 with secure code<br />
new HubAction("wake on lan 00:11:22:33:44:55", Protocol.LAN, [secureCode: "112233"])<br />
<br />
===<code>getAction</code>===<br />
<br />
Can be used to get the request value of the HubAction.<br />
<br />
:;Signature<br />
:: <code>String getAction()</code><br />
<br />
===<code>getCallbackMethod</code>===<br />
<br />
:;Signature<br />
:: <code>String getCallbackMethod()</code><br />
<br />
===<code>getURI</code>===<br />
<br />
:;Signature<br />
:: <code>URI getURI()</code></div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes_2.1.9&diff=2747Release Notes 2.1.92020-03-11T19:37:57Z<p>Cschwer: </p>
<hr />
<div><br />
'''Hubitat Elevation Platform update 2.1.9 is now available:'''<br />
<br />
Please note, the process takes about a minute to download (depending on your Internet connection) and extract the hub update, and 1-2 minutes to perform the update after you click 'Update Hub'. We recommend that you periodically download a backup of your setup from the Settings page, Backup and Restore.<br />
<br />
'''Changes from 2.1.8''':<br />
<br />
''Drivers and Devices''<br />
<br />
* New drivers:<br />
** Fibaro Binary Sensor ([FGBS-001]<nowiki>[https://www.fibaro.com/en/products/universal-binary-sensor/]</nowiki>)<br />
** Generic Component Button Controller<br />
** Qubino Mini Dimmer ([ZMNHHD3]<nowiki>[https://qubino.com/products/mini-dimmer/]</nowiki>)<br />
** EVA LOGIK Smart Plug Dimmer ([ZW39]<nowiki>[https://nie-tech.com/product-item/eva-logik-z-wave-plus-wall-plug-smart-socket-us/]</nowiki>)<br />
* New tested devices:<br />
** Sage A19 bulb using Generic Zigbee Bulb<br />
** Ecolink Pet Immune Zigbee Motion Detector using Generic Zigbee Motion Sensor<br />
** Philips Smart Plug using Generic Zigbee Outlet<br />
** Leviton DL15S Zigbee switch using Generic Zigbee Switch<br />
** Sunricher ZG2833K8_EU05 using RGBgenie 8 Button Controller<br />
** Yeelight YLXD42YL (ceiling15) using Yeelight Integration<br />
** Yeelight YLDP11YL/YLDP12YL (mono5) using Yeelight Integration<br />
** Iris V3 Contact Sensor (1116-S) using Generic Zigbee Contact Sensor<br />
** Sylvania Flex SL RGBW strip using Generic ZigBee Light<br />
** Sage BR30 using Generic Zigbee Bulb<br />
** Linkind Door Window Sensor using Generic Zigbee Contact Sensor<br />
* New driver features:<br />
** Lutron Keypad: Now supports commands ledOn and ledOff; each takes a parameter for the number of the led to act on.<br />
** Iris V3 keypad: Add alternate beep preference (enable for older firmware versions) <br />
** Inovelli Z-Wave Smart Scene Switch S2: Add power reporting options<br />
<br />
''New App Features''<br />
<br />
* Notifier: <br />
** Added valve devices.<br />
** Added option to repeat notifications on selected interval, with various means to stop the repetition.<br />
<br />
''Bug Fixes''<br />
<br />
* Notifier: <br />
** Fixed bug where any lock code would cause notification.<br />
** Fixed bug with battery level.<br />
* Rule Machine: <br />
** Fixed bug with setting Time Variable from other Time Variable.<br />
** Fixed bug with removing local connectors. Note: The first time you remove a local connector may take several to many seconds, depending on how many rules you have. This is a one-time only thing that will happen the first time you remove a local connector.<br />
** Fixed bug with local connectors acting as trigger events when they should not.<br />
* Dashboard: Fixed issue with date not being updated.<br />
* Scene Transition: Fixed broken transitions for Color and Color Temperature.<br />
* Fixed bug for hubs crashing when blocked from the internet.<br />
* Aeotec Dual Micro Switch: Fixed sendEvent errors.<br />
* Display warning if creating a new device and no driver was selected.<br />
* Security fixes for Diagnostics Tool<br />
<br />
''Platform Changes''<br />
<br />
* Added video links for some apps, icon in the upper right hand corner. Developers: Use documentationLink and videoLink in app definition to add these icons and links to your app. Example:<br />
<br />
videoLink: “<nowiki>https://www.youtube.com/watch?v=LRvCVebE_To”</nowiki>,<br />
<br />
documentationLink: “<nowiki>https://docs.hubitat.com/index.php?title=Hubitat_Elevation_Documentation</nowiki>”,<br />
<br />
* A change was made to the event processor in the hub. It was found that some hubs can send so many events that the processor is overloaded and the hub will stop processing events. This processor has been reworked and there is now a limit to the number of events that can be sent to the processor at one time (1024), if the event queue goes over the limit an error message will be thrown and the system will log an error “Limit Exceeded Exception, Event Queue is Full”.</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes_2.1.9&diff=2746Release Notes 2.1.92020-03-11T19:37:04Z<p>Cschwer: </p>
<hr />
<div><br />
'''Hubitat Elevation Platform update 2.1.9 is now available:'''<br />
<br />
Please note, the process takes about a minute to download (depending on your Internet connection) and extract the hub update, and 1-2 minutes to perform the update after you click 'Update Hub'. We recommend that you periodically download a backup of your setup from the Settings page, Backup and Restore.<br />
<br />
'''Changes from 2.1.8''':<br />
<br />
''Drivers and Devices''<br />
<br />
* New drivers:<br />
** Fibaro Binary Sensor ([FGBS-001]<nowiki>[https://www.fibaro.com/en/products/universal-binary-sensor/]</nowiki>)<br />
** Generic Component Button Controller<br />
** Qubino Mini Dimmer ([ZMNHHD3]<nowiki>[https://qubino.com/products/mini-dimmer/]</nowiki>)<br />
** EVA LOGIK Smart Plug Dimmer ([ZW39]<nowiki>[https://nie-tech.com/product-item/eva-logik-z-wave-plus-wall-plug-smart-socket-us/]</nowiki>)<br />
* New tested devices:<br />
** Sage A19 bulb using Generic Zigbee Bulb<br />
** Ecolink Pet Immune Zigbee Motion Detector using Generic Zigbee Motion Sensor<br />
** Philips Smart Plug using Generic Zigbee Outlet<br />
** Leviton DL15S Zigbee switch using Generic Zigbee Switch<br />
** Sunricher ZG2833K8_EU05 using RGBgenie 8 Button Controller<br />
** Yeelight YLXD42YL (ceiling15) using Yeelight Integration<br />
** Yeelight YLDP11YL/YLDP12YL (mono5) using Yeelight Integration<br />
** Iris V3 Contact Sensor (1116-S) using Generic Zigbee Contact Sensor<br />
** Sylvania Flex SL RGBW strip using Generic ZigBee Light<br />
** Sage BR30 using Generic Zigbee Bulb<br />
** Linkind Door Window Sensor using Generic Zigbee Contact Sensor<br />
* New driver features:<br />
** Lutron Keypad: Now supports commands ledOn and ledOff; each takes a parameter for the number of the led to act on.<br />
** Iris V3 keypad: Add alternate beep preference (enable for older firmware versions) <br />
** Inovelli Z-Wave Smart Scene Switch S2: Add power reporting options<br />
<br />
''New App Features''<br />
<br />
* Notifier: <br />
** Added valve devices.<br />
** Added option to repeat notifications on selected interval, with various means to stop the repetition.<br />
<br />
''Bug Fixes''<br />
<br />
* Notifier: <br />
** Fixed bug where any lock code would cause notification.<br />
** Fixed bug with battery level.<br />
* Rule Machine: <br />
** Fixed bug with setting Time Variable from other Time Variable.<br />
** Fixed bug with removing local connectors. Note: The first time you remove a local connector may take several to many seconds, depending on how many rules you have. This is a one-time only thing that will happen the first time you remove a local connector.<br />
** Fixed bug with local connectors acting as trigger events when they should not.<br />
* Dashboard: Fixed issue with date not being updated.<br />
* Scene Transition: Fixed broken transitions for Color and Color Temperature.<br />
* Fixed bug for hubs crashing when blocked from the internet.<br />
* Aeotec Dual Micro Switch: Fixed sendEvent errors.<br />
* Display warning if creating a new device and no driver was selected.<br />
* Security fixes for Diagnostics Tool<br />
<br />
''Platform Changes''<br />
<br />
* Added video links for some apps, icon in the upper right hand corner. Developers: Use documentationLink and videoLink in app definition to add these icons and links to your app. Example:<br />
<br />
videoLink: “<nowiki>https://www.youtube.com/watch?v=LRvCVebE_To”</nowiki>,<br />
<br />
documentationLink: “https://docs.hubitat.com/index.php?title=Hubitat_Elevation_Documentation”,<br />
<br />
* A change was made to the event processor in the hub. It was found that some hubs can send so many events that the processor is overloaded and the hub will stop processing events. This processor has been reworked and there is now a limit to the number of events that can be sent to the processor at one time (1024), if the event queue goes over the limit an error message will be thrown and the system will log an error “Limit Exceeded Exception, Event Queue is Full”.</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes_2.1.9&diff=2617Release Notes 2.1.92020-03-06T19:45:24Z<p>Cschwer: </p>
<hr />
<div><br />
'''Hubitat Elevation Platform update 2.1.9 is now available:'''<br />
<br />
Please note, the process takes about a minute to download (depending on your Internet connection) and extract the hub update, and 1-2 minutes to perform the update after you click 'Update Hub'. We recommend that you periodically download a backup of your setup from the Settings page, Backup and Restore.<br />
<br />
'''Changes from 2.1.8''':<br />
<br />
''Drivers and Devices''<br />
<br />
* New drivers:<br />
** Fibaro Binary Sensor ([FGBS-001]<nowiki>[https://www.fibaro.com/en/products/universal-binary-sensor/]</nowiki>)<br />
** Generic Component Button Controller<br />
** Qubino Mini Dimmer ([ZMNHHD3]<nowiki>[https://qubino.com/products/mini-dimmer/]</nowiki>)<br />
** EVA LOGIK Smart Plug Dimmer ([ZW39]<nowiki>[https://nie-tech.com/product-item/eva-logik-z-wave-plus-wall-plug-smart-socket-us/]</nowiki>)<br />
* New tested devices:<br />
** Sage A19 bulb using Generic Zigbee Bulb<br />
** Ecolink Pet Immune Zigbee Motion Detector using Generic Zigbee Motion Sensor<br />
** Philips Smart Plug using Generic Zigbee Outlet<br />
** Leviton DL15S Zigbee switch using Generic Zigbee Switch<br />
** Sunricher ZG2833K8_EU05 using RGBgenie 8 Button Controller<br />
** Yeelight YLXD42YL (ceiling15) using Yeelight Integration<br />
** Yeelight YLDP11YL/YLDP12YL (mono5) using Yeelight Integration<br />
** Iris V3 Contact Sensor (1116-S) using Generic Zigbee Contact Sensor<br />
** Sylvania Flex SL RGBW strip using Generic ZigBee Light<br />
** Sage BR30 using Generic Zigbee Bulb<br />
** Linkind Door Window Sensor using Generic Zigbee Contact Sensor<br />
* New driver features:<br />
** Lutron Keypad: Now supports commands ledOn and ledOff; each takes a parameter for the number of the led to act on.<br />
** Iris V3 keypad: Add alternate beep preference (enable for older firmware versions) <br />
** Inovelli Z-Wave Smart Scene Switch S2: Add power reporting options<br />
<br />
''New App Features''<br />
<br />
* Notifier: <br />
** Added valve devices.<br />
** Added option to repeat notifications on selected interval, with various means to stop the repetition.<br />
<br />
''Bug Fixes''<br />
<br />
* Notifier: <br />
** Fixed bug where any lock code would cause notification.<br />
** Fixed bug with battery level.<br />
* Rule Machine: <br />
** Fixed bug with setting Time Variable from other Time Variable.<br />
** Fixed bug with removing local connectors. Note: The first time you remove a local connector may take several to many seconds, depending on how many rules you have. This is a one-time only thing that will happen the first time you remove a local connector.<br />
** Fixed bug with local connectors acting as trigger events when they should not.<br />
* Dashboard: Fixed issue with date not being updated.<br />
* Scene Transition: Fixed broken transitions for Color and Color Temperature.<br />
* Fixed bug for hubs crashing when blocked from the internet.<br />
* Aeotec Dual Micro Switch: Fixed sendEvent errors.<br />
* Display warning if creating a new device and no driver was selected.<br />
* Security fixes for Diagnostics Tool<br />
<br />
''Platform Changes''<br />
<br />
* Added video links for some apps, icon in the upper right hand corner. Developers: Use documentationLink and videoLink in app definition to add these icons and links to your app. Example:<br />
<br />
videoLink: “<nowiki>https://www.youtube.com/watch?v=LRvCVebE_To”</nowiki>,<br />
<br />
documentationLink: “[[Hubitat Elevation Documentation|https://docs.hubitat.com/index.php?title=Hubitat_Elevation_Documentation]]”,<br />
<br />
* A change was made to the event processor in the hub. It was found that some hubs can send so many events that the processor is overloaded and the hub will stop processing events. This processor has been reworked and there is now a limit to the number of events that can be sent to the processor at one time (1024), if the event queue goes over the limit an error message will be thrown and the system will log an error “Limit Exceeded Exception, Event Queue is Full”.</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes_2.1.9&diff=2571Release Notes 2.1.92020-02-21T16:55:55Z<p>Cschwer: Created page with " '''Hubitat Elevation Platform update 2.1.9 is now available:''' Please note, the process takes about a minute to download (depending on your Internet connection) and extract..."</p>
<hr />
<div><br />
'''Hubitat Elevation Platform update 2.1.9 is now available:'''<br />
<br />
Please note, the process takes about a minute to download (depending on your Internet connection) and extract the hub update, and 1-2 minutes to perform the update after you click 'Update Hub'. We recommend that you periodically download a backup of your setup from the Settings page, Backup and Restore.<br />
<br />
'''Changes from 2.1.8''':<br />
<br />
''Drivers and Devices''<br />
<br />
* New drivers:<br />
** Fibaro Binary Sensor ([FGBS-001]<nowiki>[https://www.fibaro.com/en/products/universal-binary-sensor/]</nowiki>)<br />
** Generic Component Button Controller<br />
** Qubino Mini Dimmer ([ZMNHHD3]<nowiki>[https://qubino.com/products/mini-dimmer/]</nowiki>)<br />
** EVA LOGIK Smart Plug Dimmer ([ZW39]<nowiki>[https://nie-tech.com/product-item/eva-logik-z-wave-plus-wall-plug-smart-socket-us/]</nowiki>)<br />
* New tested devices:<br />
** Sage A19 bulb using Generic Zigbee Bulb<br />
** Ecolink Pet Immune Zigbee Motion Detector using Generic Zigbee Motion Sensor<br />
** Philips Smart Plug using Generic Zigbee Outlet<br />
** Leviton DL15S Zigbee switch using Generic Zigbee Switch<br />
** Sunricher ZG2833K8_EU05 using RGBgenie 8 Button Controller<br />
** Yeelight YLXD42YL (ceiling15) using Yeelight Integration<br />
** Yeelight YLDP11YL/YLDP12YL (mono5) using Yeelight Integration<br />
** Iris V3 Contact Sensor (1116-S) using Generic Zigbee Contact Sensor<br />
** Sylvania Flex SL RGBW strip using Generic ZigBee Light<br />
** Sage BR30 using Generic Zigbee Bulb<br />
** Linkind Door Window Sensor using Generic Zigbee Contact Sensor<br />
* New driver features:<br />
** Lutron Keypad: Now supports commands ledOn and ledOff; each takes a parameter for the number of the led to act on.<br />
** Iris V3 keypad: Add alternate beep preference (enable for older firmware versions) <br />
** Inovelli Z-Wave Smart Scene Switch S2: Add power reporting options<br />
<br />
''New App Features''<br />
<br />
* Notifier: <br />
** Added valve devices.<br />
** Added option to repeat notifications on selected interval, with various means to stop the repetition.<br />
<br />
''Bug Fixes''<br />
<br />
* Notifier: <br />
** Fixed bug where any lock code would cause notification.<br />
** Fixed bug with battery level.<br />
* Rule Machine: <br />
** Fixed bug with setting Time Variable from other Time Variable.<br />
** Fixed bug with removing local connectors. Note: The first time you remove a local connector may take several to many seconds, depending on how many rules you have. This is a one-time only thing that will happen the first time you remove a local connector.<br />
** Fixed bug with local connectors acting as trigger events when they should not.<br />
* Dashboard: Fixed issue with date not being updated.<br />
* Scene Transition: Fixed broken transitions for Color and Color Temperature.<br />
* Fixed bug for hubs crashing when blocked from the internet.<br />
* Aeotec Dual Micro Switch: Fixed sendEvent errors.<br />
* Display warning if creating a new device and no driver was selected.<br />
<br />
''Platform Changes''<br />
<br />
* Added video links for some apps, icon in the upper right hand corner. Developers: Use documentationLink and videoLink in app definition to add these icons and links to your app. Example:<br />
<br />
videoLink: “<nowiki>https://www.youtube.com/watch?v=LRvCVebE_To”</nowiki>,<br />
<br />
documentationLink: “[[Hubitat Elevation Documentation|https://docs.hubitat.com/index.php?title=Hubitat_Elevation_Documentation]]”,<br />
<br />
* A change was made to the event processor in the hub. It was found that some hubs can send so many events that the processor is overloaded and the hub will stop processing events. This processor has been reworked and there is now a limit to the number of events that can be sent to the processor at one time (1024), if the event queue goes over the limit an error message will be thrown and the system will log an error “Limit Exceeded Exception, Event Queue is Full”.</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes&diff=2570Release Notes2020-02-21T16:53:46Z<p>Cschwer: </p>
<hr />
<div>Hubitat release notes are specific to each version. Select your version from the list below to see the release notes for it.<br />
<br />
[[Release_Notes_1.1.5| 1.1.5]]<br />
<br />
[[Release_Notes_1.1.6| 1.1.6]]<br />
<br />
[[Release_Notes_2.0.0| 2.0.0]]<br />
<br />
[[Release_Notes_2.0.1| 2.0.1]]<br />
<br />
[[Release_Notes_2.0.2| 2.0.2]]<br />
<br />
[[Release_Notes_2.0.3| 2.0.3]]<br />
<br />
[[Release_Notes_2.0.4| 2.0.4]]<br />
<br />
[[Release_Notes_2.0.5| 2.0.5]]<br />
<br />
[[Release_Notes_2.0.6| 2.0.6]]<br />
<br />
[[Release_Notes_2.0.7| 2.0.7]]<br />
<br />
[[Release_Notes_2.0.8| 2.0.8]]<br />
<br />
[[Release_Notes_2.0.9| 2.0.9]]<br />
<br />
[[Release_Notes_2.1.0| 2.1.0]]<br />
<br />
[[Release_Notes_2.1.1| 2.1.1]]<br />
<br />
[[Release_Notes_2.1.2| 2.1.2]]<br />
<br />
[[Release_Notes_2.1.3| 2.1.3]]<br />
<br />
[[Release_Notes_2.1.4| 2.1.4]]<br />
<br />
[[Release_Notes_2.1.5| 2.1.5]]<br />
<br />
[[Release_Notes_2.1.6| 2.1.6]]<br />
<br />
[[Release_Notes_2.1.7| 2.1.7]]<br />
<br />
[[Release_Notes_2.1.8| 2.1.8]]<br />
<br />
[[Release_Notes_2.1.9| 2.1.9]]</div>Cschwerhttps://docs.hubitat.com/index.php?title=App_Object&diff=2526App Object2020-02-12T14:33:42Z<p>Cschwer: /* addChildDevice */</p>
<hr />
<div>==Provided Methods==<br />
===<code>getApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat cloud API.<br />
<br />
:;Signature<br />
:: <code>String getApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The base URL of the Hubitat cloud API, generally https://cloud.hubitat.com/api<br />
<br />
===<code>subscribe</code>===<br />
:Subscribe to events sent from a device, app or location.<br />
<br />
:;Signature<br />
:: <code>void subscribe(InstalledAppWrapper app, handlerMethod)</code><br />
:: <code>void subscribe(Location location, handlerMethod)</code><br />
:: <code>void subscribe(DeviceWrapper device, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(DeviceWrapperList devices, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(Location location, String attributeName, handlerMethod, Map options = null)</code><br />
<br />
<br />
:;Parameters<br />
::app - Installed App to subscribe to.<br />
::location - Location to subscribe to.<br />
::device - Device to subscribe to.<br />
::handlerMethod - The method to run when an event is received.<br />
::attributeName - The name of the attribute to subscribe to.<br />
::options - Optional values to configure the subscribe. Possible values:<br />
:::''filterEvents'' - Used for device subscriptions. Set to false to receive all events, defaults to true and events that do not have a changed value will not be processed.<br />
<br />
===<code>unsubscribe</code>===<br />
:Unsubscribe from events sent from a device or all event subscriptions.<br />
<br />
:;Signature<br />
:: <code>void unsubscribe()</code><br />
:: <code>void unsubscribe(DeviceWrapper device)</code><br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList)</code><br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName)</code> (Since 2.0.7)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(InstalledAppWrapper installedApp)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location, String attributeName)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(String handlerMethod)</code> (Since 2.1.2)<br />
<br />
:;Parameters<br />
::device - The device to unsubscribe from.<br />
::deviceList - A list of devices to unsubscribe from.<br />
::attributeName - which attribute you want to unsubscribe from.<br />
::handlerMethod - The name of a method which was subscribed to a device event.<br />
::location - The location to unsubscribe from.<br />
::installedApp - The installed app to unsubscribe from.<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId)</code> (deprecated)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId, Map properties)</code> (deprecated)<br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::hubId - present for backwards compatibility, pass 1.<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
:: <code>List<ChildDeviceWrapper> getAllChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
==User Defined Methods==<br />
===<code>installed</code>===<br />
:This method is called when the app is first installed.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of an installed app are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
===<code>uninstalled</code>===<br />
:This method is called when the app is uninstalled. This method can be used to do any cleanup that is necessary.<br />
<br />
:;Signature<br />
:: <code>void uninstalled()</code><br />
<br />
== <code>Additional to be documented</code> ==<br />
Map getState()<br />
String getHubUID()<br />
String getApiServerUrl()<br />
String getFullApiServerUrl()<br />
String apiServerUrl(String url)<br />
String getLocalApiServerUrl()<br />
String getFullLocalApiServerUrl()<br />
String localApiServerUrl(String url)<br />
String fullLocalApiServerUrl(String url)<br />
void setLocationMode(String mode)<br />
String createAccessToken()<br />
void pause(Long millisecs)<br />
InstalledAppWrapper getParent()<br />
InstalledAppWrapper addChildApp(String namespace, String name, String label, Map properties = null)<br />
void deleteChildApp(Long childAppId)<br />
DeviceWrapper getSubscribedDeviceById(Long deviceId)<br />
void sendEvent(Map properties)<br />
void sendEvent(DeviceWrapper device, Map properties)<br />
void sendEvent(String dni, Map properties)<br />
List<Event> getLocationEventsSince(String attributeName, Date startDate, Map options = null)<br />
void subscribe(Object thing, String attributeName, handlerMethod, Map options = null)<br />
void subscribe(location, handlerMethod)<br />
List<InstalledApp> getAllChildApps()<br />
List<InstalledApp> getChildApps()<br />
InstalledAppWrapper getChildAppById(Long childAppId)<br />
InstalledAppWrapper getChildAppByLabel(String childAppLabel)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Talk:App_Object&diff=2525Talk:App Object2020-02-12T14:31:43Z<p>Cschwer: </p>
<hr />
<div>The documentation page indicates that '''addChildDevice()''' has four arguments.<br />
<br />
* String namespace<br />
* String typeName<br />
* String deviceNetworkId<br />
* Map properties = [:])<br />
<br />
Examples, like [https://github.com/hubitat/HubitatPublic/blob/master/example-apps/averageIlluminance.groovy averageIlluminance.groovy] suggest a fifth argument is required. From that file, see the "null" argument in the following example:<br />
<br />
addChildDevice("hubitat", "Virtual Illuminance Sensor", "AverageLux_${app.id}", '''null''', [label: thisName, name: thisName])<br />
<br />
-- Fixed in the documentation.</div>Cschwerhttps://docs.hubitat.com/index.php?title=App_Object&diff=2524App Object2020-02-12T14:30:40Z<p>Cschwer: /* addChildDevice */</p>
<hr />
<div>==Provided Methods==<br />
===<code>getApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat cloud API.<br />
<br />
:;Signature<br />
:: <code>String getApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The base URL of the Hubitat cloud API, generally https://cloud.hubitat.com/api<br />
<br />
===<code>subscribe</code>===<br />
:Subscribe to events sent from a device, app or location.<br />
<br />
:;Signature<br />
:: <code>void subscribe(InstalledAppWrapper app, handlerMethod)</code><br />
:: <code>void subscribe(Location location, handlerMethod)</code><br />
:: <code>void subscribe(DeviceWrapper device, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(DeviceWrapperList devices, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(Location location, String attributeName, handlerMethod, Map options = null)</code><br />
<br />
<br />
:;Parameters<br />
::app - Installed App to subscribe to.<br />
::location - Location to subscribe to.<br />
::device - Device to subscribe to.<br />
::handlerMethod - The method to run when an event is received.<br />
::attributeName - The name of the attribute to subscribe to.<br />
::options - Optional values to configure the subscribe. Possible values:<br />
:::''filterEvents'' - Used for device subscriptions. Set to false to receive all events, defaults to true and events that do not have a changed value will not be processed.<br />
<br />
===<code>unsubscribe</code>===<br />
:Unsubscribe from events sent from a device or all event subscriptions.<br />
<br />
:;Signature<br />
:: <code>void unsubscribe()</code><br />
:: <code>void unsubscribe(DeviceWrapper device)</code><br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList)</code><br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName)</code> (Since 2.0.7)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(InstalledAppWrapper installedApp)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location, String attributeName)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(String handlerMethod)</code> (Since 2.1.2)<br />
<br />
:;Parameters<br />
::device - The device to unsubscribe from.<br />
::deviceList - A list of devices to unsubscribe from.<br />
::attributeName - which attribute you want to unsubscribe from.<br />
::handlerMethod - The name of a method which was subscribed to a device event.<br />
::location - The location to unsubscribe from.<br />
::installedApp - The installed app to unsubscribe from.<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId)</code> (deprecated)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId, Map properties)</code> (deprecated)<br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::hubId - present for backwards compatibility, pass null.<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
:: <code>List<ChildDeviceWrapper> getAllChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
==User Defined Methods==<br />
===<code>installed</code>===<br />
:This method is called when the app is first installed.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of an installed app are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
===<code>uninstalled</code>===<br />
:This method is called when the app is uninstalled. This method can be used to do any cleanup that is necessary.<br />
<br />
:;Signature<br />
:: <code>void uninstalled()</code><br />
<br />
== <code>Additional to be documented</code> ==<br />
Map getState()<br />
String getHubUID()<br />
String getApiServerUrl()<br />
String getFullApiServerUrl()<br />
String apiServerUrl(String url)<br />
String getLocalApiServerUrl()<br />
String getFullLocalApiServerUrl()<br />
String localApiServerUrl(String url)<br />
String fullLocalApiServerUrl(String url)<br />
void setLocationMode(String mode)<br />
String createAccessToken()<br />
void pause(Long millisecs)<br />
InstalledAppWrapper getParent()<br />
InstalledAppWrapper addChildApp(String namespace, String name, String label, Map properties = null)<br />
void deleteChildApp(Long childAppId)<br />
DeviceWrapper getSubscribedDeviceById(Long deviceId)<br />
void sendEvent(Map properties)<br />
void sendEvent(DeviceWrapper device, Map properties)<br />
void sendEvent(String dni, Map properties)<br />
List<Event> getLocationEventsSince(String attributeName, Date startDate, Map options = null)<br />
void subscribe(Object thing, String attributeName, handlerMethod, Map options = null)<br />
void subscribe(location, handlerMethod)<br />
List<InstalledApp> getAllChildApps()<br />
List<InstalledApp> getChildApps()<br />
InstalledAppWrapper getChildAppById(Long childAppId)<br />
InstalledAppWrapper getChildAppByLabel(String childAppLabel)</div>Cschwerhttps://docs.hubitat.com/index.php?title=App_Object&diff=2523App Object2020-02-12T14:29:53Z<p>Cschwer: /* addChildDevice */</p>
<hr />
<div>==Provided Methods==<br />
===<code>getApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat cloud API.<br />
<br />
:;Signature<br />
:: <code>String getApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The base URL of the Hubitat cloud API, generally https://cloud.hubitat.com/api<br />
<br />
===<code>subscribe</code>===<br />
:Subscribe to events sent from a device, app or location.<br />
<br />
:;Signature<br />
:: <code>void subscribe(InstalledAppWrapper app, handlerMethod)</code><br />
:: <code>void subscribe(Location location, handlerMethod)</code><br />
:: <code>void subscribe(DeviceWrapper device, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(DeviceWrapperList devices, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(Location location, String attributeName, handlerMethod, Map options = null)</code><br />
<br />
<br />
:;Parameters<br />
::app - Installed App to subscribe to.<br />
::location - Location to subscribe to.<br />
::device - Device to subscribe to.<br />
::handlerMethod - The method to run when an event is received.<br />
::attributeName - The name of the attribute to subscribe to.<br />
::options - Optional values to configure the subscribe. Possible values:<br />
:::''filterEvents'' - Used for device subscriptions. Set to false to receive all events, defaults to true and events that do not have a changed value will not be processed.<br />
<br />
===<code>unsubscribe</code>===<br />
:Unsubscribe from events sent from a device or all event subscriptions.<br />
<br />
:;Signature<br />
:: <code>void unsubscribe()</code><br />
:: <code>void unsubscribe(DeviceWrapper device)</code><br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList)</code><br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName)</code> (Since 2.0.7)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(InstalledAppWrapper installedApp)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location, String attributeName)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(String handlerMethod)</code> (Since 2.1.2)<br />
<br />
:;Parameters<br />
::device - The device to unsubscribe from.<br />
::deviceList - A list of devices to unsubscribe from.<br />
::attributeName - which attribute you want to unsubscribe from.<br />
::handlerMethod - The name of a method which was subscribed to a device event.<br />
::location - The location to unsubscribe from.<br />
::installedApp - The installed app to unsubscribe from.<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties)</code> (since 2.1.9)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId)</code> (deprecated)<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId, Map properties)</code> (deprecated)<br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
:: <code>List<ChildDeviceWrapper> getAllChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
==User Defined Methods==<br />
===<code>installed</code>===<br />
:This method is called when the app is first installed.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of an installed app are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
===<code>uninstalled</code>===<br />
:This method is called when the app is uninstalled. This method can be used to do any cleanup that is necessary.<br />
<br />
:;Signature<br />
:: <code>void uninstalled()</code><br />
<br />
== <code>Additional to be documented</code> ==<br />
Map getState()<br />
String getHubUID()<br />
String getApiServerUrl()<br />
String getFullApiServerUrl()<br />
String apiServerUrl(String url)<br />
String getLocalApiServerUrl()<br />
String getFullLocalApiServerUrl()<br />
String localApiServerUrl(String url)<br />
String fullLocalApiServerUrl(String url)<br />
void setLocationMode(String mode)<br />
String createAccessToken()<br />
void pause(Long millisecs)<br />
InstalledAppWrapper getParent()<br />
InstalledAppWrapper addChildApp(String namespace, String name, String label, Map properties = null)<br />
void deleteChildApp(Long childAppId)<br />
DeviceWrapper getSubscribedDeviceById(Long deviceId)<br />
void sendEvent(Map properties)<br />
void sendEvent(DeviceWrapper device, Map properties)<br />
void sendEvent(String dni, Map properties)<br />
List<Event> getLocationEventsSince(String attributeName, Date startDate, Map options = null)<br />
void subscribe(Object thing, String attributeName, handlerMethod, Map options = null)<br />
void subscribe(location, handlerMethod)<br />
List<InstalledApp> getAllChildApps()<br />
List<InstalledApp> getChildApps()<br />
InstalledAppWrapper getChildAppById(Long childAppId)<br />
InstalledAppWrapper getChildAppByLabel(String childAppLabel)</div>Cschwerhttps://docs.hubitat.com/index.php?title=App_Object&diff=2522App Object2020-02-12T14:28:51Z<p>Cschwer: /* addChildDevice */</p>
<hr />
<div>==Provided Methods==<br />
===<code>getApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat cloud API.<br />
<br />
:;Signature<br />
:: <code>String getApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The base URL of the Hubitat cloud API, generally https://cloud.hubitat.com/api<br />
<br />
===<code>subscribe</code>===<br />
:Subscribe to events sent from a device, app or location.<br />
<br />
:;Signature<br />
:: <code>void subscribe(InstalledAppWrapper app, handlerMethod)</code><br />
:: <code>void subscribe(Location location, handlerMethod)</code><br />
:: <code>void subscribe(DeviceWrapper device, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(DeviceWrapperList devices, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(Location location, String attributeName, handlerMethod, Map options = null)</code><br />
<br />
<br />
:;Parameters<br />
::app - Installed App to subscribe to.<br />
::location - Location to subscribe to.<br />
::device - Device to subscribe to.<br />
::handlerMethod - The method to run when an event is received.<br />
::attributeName - The name of the attribute to subscribe to.<br />
::options - Optional values to configure the subscribe. Possible values:<br />
:::''filterEvents'' - Used for device subscriptions. Set to false to receive all events, defaults to true and events that do not have a changed value will not be processed.<br />
<br />
===<code>unsubscribe</code>===<br />
:Unsubscribe from events sent from a device or all event subscriptions.<br />
<br />
:;Signature<br />
:: <code>void unsubscribe()</code><br />
:: <code>void unsubscribe(DeviceWrapper device)</code><br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList)</code><br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName)</code> (Since 2.0.7)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(InstalledAppWrapper installedApp)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location, String attributeName)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(String handlerMethod)</code> (Since 2.1.2)<br />
<br />
:;Parameters<br />
::device - The device to unsubscribe from.<br />
::deviceList - A list of devices to unsubscribe from.<br />
::attributeName - which attribute you want to unsubscribe from.<br />
::handlerMethod - The name of a method which was subscribed to a device event.<br />
::location - The location to unsubscribe from.<br />
::installedApp - The installed app to unsubscribe from.<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId)</code><br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties)</code><br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId)</code><br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId, Map properties)</code><br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
:: <code>List<ChildDeviceWrapper> getAllChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
==User Defined Methods==<br />
===<code>installed</code>===<br />
:This method is called when the app is first installed.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of an installed app are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
===<code>uninstalled</code>===<br />
:This method is called when the app is uninstalled. This method can be used to do any cleanup that is necessary.<br />
<br />
:;Signature<br />
:: <code>void uninstalled()</code><br />
<br />
== <code>Additional to be documented</code> ==<br />
Map getState()<br />
String getHubUID()<br />
String getApiServerUrl()<br />
String getFullApiServerUrl()<br />
String apiServerUrl(String url)<br />
String getLocalApiServerUrl()<br />
String getFullLocalApiServerUrl()<br />
String localApiServerUrl(String url)<br />
String fullLocalApiServerUrl(String url)<br />
void setLocationMode(String mode)<br />
String createAccessToken()<br />
void pause(Long millisecs)<br />
InstalledAppWrapper getParent()<br />
InstalledAppWrapper addChildApp(String namespace, String name, String label, Map properties = null)<br />
void deleteChildApp(Long childAppId)<br />
DeviceWrapper getSubscribedDeviceById(Long deviceId)<br />
void sendEvent(Map properties)<br />
void sendEvent(DeviceWrapper device, Map properties)<br />
void sendEvent(String dni, Map properties)<br />
List<Event> getLocationEventsSince(String attributeName, Date startDate, Map options = null)<br />
void subscribe(Object thing, String attributeName, handlerMethod, Map options = null)<br />
void subscribe(location, handlerMethod)<br />
List<InstalledApp> getAllChildApps()<br />
List<InstalledApp> getChildApps()<br />
InstalledAppWrapper getChildAppById(Long childAppId)<br />
InstalledAppWrapper getChildAppByLabel(String childAppLabel)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Location_Object&diff=2521Location Object2020-02-12T14:21:13Z<p>Cschwer: /* Methods */</p>
<hr />
<div>The Location object is composed of methods that allow you to interact with the settings and values of a location. This object is available to Apps and Drivers via the "getLocation()" method or simply using the property "location".<br />
<br />
==Properties==<br />
===<code>id</code>===<br />
A unique id for the location, as a Long.<br />
===<code>name</code>===<br />
The name of the location as a String.<br />
===<code>temperatureScale</code>===<br />
The temperature scale of the location as a String (C or F).<br />
===<code>timeZone</code>===<br />
The time zone of the location as a TimeZone object.<br />
===<code>zipCode</code>===<br />
The zip code of the location as a String.<br />
===<code>latitude</code>===<br />
The latitude of the location as a BigDecimal.<br />
===<code>longitude</code>===<br />
The longitude of the location as a BigDecimal.<br />
===<code>sunrise</code>===<br />
The sunrise of the location as a Date.<br />
===<code>sunset</code>===<br />
The sunset of the location as a Date.<br />
===<code>hubs</code>===<br />
A list of hubs for this location as a List<Hub>. In Hubitat there is only one Hub in the list.<br />
===<code>hub</code>===<br />
The Hub for this location.<br />
<br />
<br />
==Methods==<br />
===<code>getFormattedLatitude</code>===<br />
===<code>getFormattedLongitude</code>===<br />
===<code>getTimeFormat</code>===<br />
===<code>getModes</code>===<br />
:Get a list of modes for the location.<br />
<br />
:;Signature<br />
:: <code>List<Mode> getModes()</code><br />
<br />
===<code>getMode</code>===<br />
:Get the current mode of the location.<br />
<br />
:;Signature<br />
:: <code>String getMode()</code><br />
<br />
===<code>setMode</code>===<br />
===<code>currentMode</code>===</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes_2.1.8&diff=2442Release Notes 2.1.82020-01-10T19:56:06Z<p>Cschwer: </p>
<hr />
<div>'''Hubitat Elevation Platform update 2.1.8 is now available:'''<br />
<br />
Please note, the process takes about a minute to download (depending on your Internet connection) and extract the hub update, and 1-2 minutes to perform the update after you click 'Update Hub'. We recommend that you periodically download a backup of your setup from the Settings page, Backup and Restore.<br />
<br />
'''Changes from 2.1.7''':<br />
<br />
''Drivers and Devices''<br />
<br />
* New drivers:<br />
** Inovelli Z-Wave Smart Scene Switch S2 ([LZW30-SN](<nowiki>https://inovelli.com/shop/smart-light-switches/zwave-smart-switches-gen2/z-wave-on-off-switch-neutral-required-scenes-notifications/</nowiki>))<br />
** Inovelli Z-Wave Smart Switch S2 ([LZW30](<nowiki>https://inovelli.com/shop/smart-light-switches/zwave-smart-switches-gen2/pre-order-z-wave-on-off-switch-base-model/</nowiki>))<br />
** Inovelli Z-Wave Smart Dimmer (NZW31)<br />
** Inovelli Z-Wave Smart Scene Dimmer (NZW31)<br />
** Inovelli Z-Wave Smart Switch (NZW30)<br />
** Inovelli Z-Wave Smart Scene Switch (NZW30)<br />
** GE Enbrighten Z-Wave Smart Dimmer ([46203](<nowiki>https://byjasco.com/products/ge-enbrighten-z-wave-plus-wall-smart-dimmer-quickfit-and-simplewire</nowiki>))<br />
** GE Enbrighten Z-Wave Smart Switch ([46201](<nowiki>https://byjasco.com/ge-enbrighten-z-wave-plus-smart-switch-quickfit-and-simplewire</nowiki>))<br />
** Honeywell T6 Pro Z-Wave Thermostat ([TH6320ZW2003](<nowiki>https://www.honeywellhome.com/T6-Pro-Z-wave</nowiki>))<br />
** Aeotec Dual Micro Switch (DSC17)<br />
** Zooz MultiRelay ([ZEN16](<nowiki>https://www.thesmartesthouse.com/products/zooz-z-wave-plus-s2-multirelay-zen16-with-3-dry-contact-relays-20-a-15-a-15-a</nowiki>))<br />
** Zooz Double Switch ([ZEN30](<nowiki>https://www.thesmartesthouse.com/products/zooz-z-wave-plus-s2-double-switch-zen30-white-for-light-fan-combo</nowiki>))<br />
** SAGE Doorbell Sensor<br />
** SAGE Light Switch Controller<br />
** Virtual Smoke Detector<br />
** Virtual CO Detector<br />
* New tested devices:<br />
** Innr UK Zigbee outlet using Generic Zigbee Outlet<br />
** Nue HGZB-01A Zigbee switch using Nue Zigbee Switch<br />
** Nue HGZB-021 Zigbee Dimmer using Nue Zigbee Dimmer<br />
** Nue ZB-18A Zigbee RGBW strip controller using Generic Zigbee RGBW Light<br />
** RGBGenie ZB-1025 Zigbee controller using RGBGenie Micro Zigbee Dimmer<br />
** RGBGenie ZB-1003 Zigbee controller using RGBGenie Micro Zigbee Dimmer<br />
** RGBGenie ZW-1001 Z-Wave dimmer using Generic Z-Wave Smart Dimmer<br />
** RGBGenie ZW-1002 Z-Wave RGBW controller using Generic Z-Wave RGBWW Controller<br />
**<br />
* New driver features:<br />
** Iris V3 Keypad, add beep for older firmware devices.<br />
** Lutron Pico drivers, add three button option and support.<br />
** NYCE Motion Sensor Series, add humidity get to refresh command.<br />
<br />
''New App Features''<br />
<br />
* Rule Machine:<br />
** Added connectors for local variables.<br />
** Add time variables (see the community for more information).<br />
* Group-2.1: Added button to update devices available for selection.<br />
* Hubitat Dashboard: Added Variable Time template for RM time variables.<br />
* Yeelight integration:<br />
** Added ceiling4 and color6 bulb support.<br />
<br />
''Bug Fixes''<br />
<br />
* Rule 4.0: Fixed error thrown by times in older rules when editing actions.<br />
* Thermostat Scheduler: Fixed bug with required separation.<br />
* Scene Transition: Fixed bug with dimmers.<br />
* Hue Bridge Integration: Fix null error on application label change.<br />
* Add CRCEncap to Fibaro 2 dimmer and switch drivers, fixes reporting issues in some situations.<br />
* Fix GE Zigbee Dimmer, single spastic power report when turned initially turned off.<br />
* Fix UK ST outlet power reporting when using Generic Zigbee Outlet driver.<br />
* Fix TransitionTime preference issues in Lutron Dimmer driver.<br />
* Fixed occasional Null error when turning on for all Sengled Element drivers.<br />
* Group-2.1: Added button to refresh device lists<br />
* Raw Lan HubAction message responses will include the payload as a Base64 encoded string<br />
<br />
''Platform Changes''<br />
<br />
* Extended the following Z-Wave command classes<br />
** Basic up to V2<br />
** SensorMultilevel up to V11<br />
** Meter up to V5<br />
** Central Scene up to V3<br />
** Version up to V3<br />
** Time up to V2<br />
** Multichannel Association up to V4<br />
** Indicator up to V3<br />
** Firmware Update MetaData up to V6<br />
** Association Group Information up to V3<br />
** Association up to V3<br />
** Notification up to V8<br />
** Multichannel up to V4<br />
** Thermostat Fan Mode up to V3<br />
* Incoming calls for App Web endpoints now includes headers<br />
* Incoming calls for App Web endpoints where the App does not exist will now log a message in the logs including the source ip address.<br />
* Added optional flag to ignore SSL issues (ie: self signed certificates) with http calls (httpGet, httpPost, etc)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes_2.1.8&diff=2441Release Notes 2.1.82020-01-10T19:55:17Z<p>Cschwer: Created page with "'''Hubitat Elevation Platform update 2.1.8 is now available:''' Please note, the process takes about a minute to download (depending on your Internet connection) and extract..."</p>
<hr />
<div>'''Hubitat Elevation Platform update 2.1.8 is now available:'''<br />
<br />
Please note, the process takes about a minute to download (depending on your Internet connection) and extract the hub update, and 1-2 minutes to perform the update after you click 'Update Hub'. We recommend that you periodically download a backup of your setup from the Settings page, Backup and Restore.<br />
<br />
'''Changes from 2.1.7''':<br />
<br />
''Drivers and Devices''<br />
<br />
* New drivers:<br />
** Inovelli Z-Wave Smart Scene Switch S2 ([LZW30-SN](<nowiki>https://inovelli.com/shop/smart-light-switches/zwave-smart-switches-gen2/z-wave-on-off-switch-neutral-required-scenes-notifications/</nowiki>))<br />
** Inovelli Z-Wave Smart Switch S2 ([LZW30](<nowiki>https://inovelli.com/shop/smart-light-switches/zwave-smart-switches-gen2/pre-order-z-wave-on-off-switch-base-model/</nowiki>))<br />
** Inovelli Z-Wave Smart Dimmer (NZW31)<br />
** Inovelli Z-Wave Smart Scene Dimmer (NZW31)<br />
** Inovelli Z-Wave Smart Switch (NZW30)<br />
** Inovelli Z-Wave Smart Scene Switch (NZW30)<br />
** GE Enbrighten Z-Wave Smart Dimmer ([46203](<nowiki>https://byjasco.com/products/ge-enbrighten-z-wave-plus-wall-smart-dimmer-quickfit-and-simplewire</nowiki>))<br />
** GE Enbrighten Z-Wave Smart Switch ([46201](<nowiki>https://byjasco.com/ge-enbrighten-z-wave-plus-smart-switch-quickfit-and-simplewire</nowiki>))<br />
** Honeywell T6 Pro Z-Wave Thermostat ([TH6320ZW2003](<nowiki>https://www.honeywellhome.com/T6-Pro-Z-wave</nowiki>))<br />
** Aeotec Dual Micro Switch (DSC17)<br />
** Zooz MultiRelay ([ZEN16](<nowiki>https://www.thesmartesthouse.com/products/zooz-z-wave-plus-s2-multirelay-zen16-with-3-dry-contact-relays-20-a-15-a-15-a</nowiki>))<br />
** Zooz Double Switch ([ZEN30](<nowiki>https://www.thesmartesthouse.com/products/zooz-z-wave-plus-s2-double-switch-zen30-white-for-light-fan-combo</nowiki>))<br />
** SAGE Doorbell Sensor<br />
** SAGE Light Switch Controller<br />
** Virtual Smoke Detector<br />
** Virtual CO Detector<br />
* New tested devices:<br />
** Innr UK Zigbee outlet using Generic Zigbee Outlet<br />
** Nue HGZB-01A Zigbee switch using Nue Zigbee Switch<br />
** Nue HGZB-021 Zigbee Dimmer using Nue Zigbee Dimmer<br />
** Nue ZB-18A Zigbee RGBW strip controller using Generic Zigbee RGBW Light<br />
** RGBGenie ZB-1025 Zigbee controller using RGBGenie Micro Zigbee Dimmer<br />
** RGBGenie ZB-1003 Zigbee controller using RGBGenie Micro Zigbee Dimmer<br />
** RGBGenie ZW-1001 Z-Wave dimmer using Generic Z-Wave Smart Dimmer<br />
** RGBGenie ZW-1002 Z-Wave RGBW controller using Generic Z-Wave RGBWW Controller<br />
**<br />
* New driver features:<br />
** Iris V3 Keypad, add beep for older firmware devices.<br />
** Lutron Pico drivers, add three button option and support.<br />
** NYCE Motion Sensor Series, add humidity get to refresh command.<br />
<br />
''New App Features''<br />
<br />
* Rule Machine:<br />
** Added connectors for local variables.<br />
** Add time variables (see this post).<br />
* Group-2.1: Added button to update devices available for selection.<br />
* Hubitat Dashboard: Added Variable Time template for RM time variables.<br />
* Yeelight integration:<br />
** Added ceiling4 and color6 bulb support.<br />
<br />
''Bug Fixes''<br />
<br />
* Rule 4.0: Fixed error thrown by times in older rules when editing actions.<br />
* Thermostat Scheduler: Fixed bug with required separation.<br />
* Scene Transition: Fixed bug with dimmers.<br />
* Hue Bridge Integration: Fix null error on application label change.<br />
* Add CRCEncap to Fibaro 2 dimmer and switch drivers, fixes reporting issues in some situations.<br />
* Fix GE Zigbee Dimmer, single spastic power report when turned initially turned off.<br />
* Fix UK ST outlet power reporting when using Generic Zigbee Outlet driver.<br />
* Fix TransitionTime preference issues in Lutron Dimmer driver.<br />
* Fixed occasional Null error when turning on for all Sengled Element drivers.<br />
* Group-2.1: Added button to refresh device lists<br />
* Raw Lan HubAction message responses will include the payload as a Base64 encoded string<br />
<br />
''Platform Changes''<br />
<br />
* Extended the following Z-Wave command classes<br />
** Basic up to V2<br />
** SensorMultilevel up to V11<br />
** Meter up to V5<br />
** Central Scene up to V3<br />
** Version up to V3<br />
** Time up to V2<br />
** Multichannel Association up to V4<br />
** Indicator up to V3<br />
** Firmware Update MetaData up to V6<br />
** Association Group Information up to V3<br />
** Association up to V3<br />
** Notification up to V8<br />
** Multichannel up to V4<br />
** Thermostat Fan Mode up to V3<br />
* Incoming calls for App Web endpoints now includes headers<br />
* Incoming calls for App Web endpoints where the App does not exist will now log a message in the logs including the source ip address.<br />
* Added optional flag to ignore SSL issues (ie: self signed certificates) with http calls (httpGet, httpPost, etc)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Release_Notes&diff=2440Release Notes2020-01-10T19:54:33Z<p>Cschwer: </p>
<hr />
<div>Hubitat release notes are specific to each version. Select your version from the list below to see the release notes for it.<br />
<br />
[[Release_Notes_1.1.5| 1.1.5]]<br />
<br />
[[Release_Notes_1.1.6| 1.1.6]]<br />
<br />
[[Release_Notes_2.0.0| 2.0.0]]<br />
<br />
[[Release_Notes_2.0.1| 2.0.1]]<br />
<br />
[[Release_Notes_2.0.2| 2.0.2]]<br />
<br />
[[Release_Notes_2.0.3| 2.0.3]]<br />
<br />
[[Release_Notes_2.0.4| 2.0.4]]<br />
<br />
[[Release_Notes_2.0.5| 2.0.5]]<br />
<br />
[[Release_Notes_2.0.6| 2.0.6]]<br />
<br />
[[Release_Notes_2.0.7| 2.0.7]]<br />
<br />
[[Release_Notes_2.0.8| 2.0.8]]<br />
<br />
[[Release_Notes_2.0.9| 2.0.9]]<br />
<br />
[[Release_Notes_2.1.0| 2.1.0]]<br />
<br />
[[Release_Notes_2.1.1| 2.1.1]]<br />
<br />
[[Release_Notes_2.1.2| 2.1.2]]<br />
<br />
[[Release_Notes_2.1.3| 2.1.3]]<br />
<br />
[[Release_Notes_2.1.4| 2.1.4]]<br />
<br />
[[Release_Notes_2.1.5| 2.1.5]]<br />
<br />
[[Release_Notes_2.1.6| 2.1.6]]<br />
<br />
[[Release_Notes_2.1.7| 2.1.7]]<br />
<br />
[[Release_Notes_2.1.8| 2.1.8]]</div>Cschwerhttps://docs.hubitat.com/index.php?title=App_Object&diff=2439App Object2020-01-07T23:02:31Z<p>Cschwer: /* subscribe */</p>
<hr />
<div>==Provided Methods==<br />
===<code>getApiServerUrl</code>===<br />
:Returns the base URL of the Hubitat cloud API.<br />
<br />
:;Signature<br />
:: <code>String getApiServerUrl()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::The base URL of the Hubitat cloud API, generally https://cloud.hubitat.com/api<br />
<br />
===<code>subscribe</code>===<br />
:Subscribe to events sent from a device, app or location.<br />
<br />
:;Signature<br />
:: <code>void subscribe(InstalledAppWrapper app, handlerMethod)</code><br />
:: <code>void subscribe(Location location, handlerMethod)</code><br />
:: <code>void subscribe(DeviceWrapper device, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(DeviceWrapperList devices, String attributeName, handlerMethod, Map options = null)</code><br />
:: <code>void subscribe(Location location, String attributeName, handlerMethod, Map options = null)</code><br />
<br />
<br />
:;Parameters<br />
::app - Installed App to subscribe to.<br />
::location - Location to subscribe to.<br />
::device - Device to subscribe to.<br />
::handlerMethod - The method to run when an event is received.<br />
::attributeName - The name of the attribute to subscribe to.<br />
::options - Optional values to configure the subscribe. Possible values:<br />
:::''filterEvents'' - Used for device subscriptions. Set to false to receive all events, defaults to true and events that do not have a changed value will not be processed.<br />
<br />
===<code>unsubscribe</code>===<br />
:Unsubscribe from events sent from a device or all event subscriptions.<br />
<br />
:;Signature<br />
:: <code>void unsubscribe()</code><br />
:: <code>void unsubscribe(DeviceWrapper device)</code><br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList)</code><br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName)</code> (Since 2.0.7)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(DeviceWrapper device, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(List<DeviceWrapper> deviceList, String attributeName, String handlerMethod)</code> (Since 2.1.0)<br />
:: <code>void unsubscribe(InstalledAppWrapper installedApp)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(Location location, String attributeName)</code> (Since 2.1.2)<br />
:: <code>void unsubscribe(String handlerMethod)</code> (Since 2.1.2)<br />
<br />
:;Parameters<br />
::device - The device to unsubscribe from.<br />
::deviceList - A list of devices to unsubscribe from.<br />
::attributeName - which attribute you want to unsubscribe from.<br />
::handlerMethod - The name of a method which was subscribed to a device event.<br />
::location - The location to unsubscribe from.<br />
::installedApp - The installed app to unsubscribe from.<br />
<br />
:;Returns<br />
::None<br />
<br />
===<code>addChildDevice</code>===<br />
:Creates a new child device and returns that device from the method call.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Map properties = [:])</code><br />
<br />
:;Parameters<br />
::namespace - The namespace of the child driver to add as a child device (optional, if not specified it will default the the namespace of the parent)<br />
::typeName - The name of the child driver to add as a child device<br />
::deviceNetworkId - unique identifier for this device<br />
::properties - optional parameters for this child device. Possible values listed below<br />
<br />
:;Properties<br />
::boolean isComponent - true or false, if true, device will still show up in device list but will not be able to be deleted or edited in the UI. If false, device can be modified/deleted on the UI.<br />
::String name - name of child device, if not specified, driver name is used.<br />
::String label - label of child device, if not specified it is left blank.<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>getChildDevices</code>===<br />
:Gets a list of all child devices for this device.<br />
<br />
:;Signature<br />
:: <code>List<ChildDeviceWrapper> getChildDevices()</code><br />
:: <code>List<ChildDeviceWrapper> getAllChildDevices()</code><br />
<br />
:;Parameters<br />
::None<br />
<br />
:;Returns<br />
::List<ChildDeviceWrapper><br />
<br />
===<code>getChildDevice</code>===<br />
:Gets a specific child device with the device network id specified.<br />
<br />
:;Signature<br />
:: <code>ChildDeviceWrapper getChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::ChildDeviceWrapper<br />
<br />
===<code>deleteChildDevice</code>===<br />
:Deletes a specific child device with the device network id sepcified.<br />
<br />
:;Signature<br />
:: <code>void deleteChildDevice(String deviceNetworkId)</code><br />
<br />
:;Parameters<br />
::deviceNetworkId - The unique identifier for the device<br />
<br />
:;Returns<br />
::None<br />
<br />
==User Defined Methods==<br />
===<code>installed</code>===<br />
:This method is called when the app is first installed.<br />
<br />
:;Signature<br />
:: <code>void installed()</code><br />
<br />
===<code>updated</code>===<br />
:This method is called when the preferences of an installed app are updated.<br />
<br />
:;Signature<br />
:: <code>void updated()</code><br />
<br />
===<code>uninstalled</code>===<br />
:This method is called when the app is uninstalled. This method can be used to do any cleanup that is necessary.<br />
<br />
:;Signature<br />
:: <code>void uninstalled()</code><br />
<br />
== <code>Additional to be documented</code> ==<br />
Map getState()<br />
String getHubUID()<br />
String getApiServerUrl()<br />
String getFullApiServerUrl()<br />
String apiServerUrl(String url)<br />
String getLocalApiServerUrl()<br />
String getFullLocalApiServerUrl()<br />
String localApiServerUrl(String url)<br />
String fullLocalApiServerUrl(String url)<br />
void setLocationMode(String mode)<br />
String createAccessToken()<br />
void pause(Long millisecs)<br />
InstalledAppWrapper getParent()<br />
InstalledAppWrapper addChildApp(String namespace, String name, String label, Map properties = null)<br />
void deleteChildApp(Long childAppId)<br />
DeviceWrapper getSubscribedDeviceById(Long deviceId)<br />
void sendEvent(Map properties)<br />
void sendEvent(DeviceWrapper device, Map properties)<br />
void sendEvent(String dni, Map properties)<br />
List<Event> getLocationEventsSince(String attributeName, Date startDate, Map options = null)<br />
void subscribe(Object thing, String attributeName, handlerMethod, Map options = null)<br />
void subscribe(location, handlerMethod)<br />
List<InstalledApp> getAllChildApps()<br />
List<InstalledApp> getChildApps()<br />
InstalledAppWrapper getChildAppById(Long childAppId)<br />
InstalledAppWrapper getChildAppByLabel(String childAppLabel)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Common_Methods_Object&diff=2436Common Methods Object2019-12-31T20:56:19Z<p>Cschwer: </p>
<hr />
<div>These methods can be used in both Apps and Drivers<br />
<br />
===<code>getLocation</code>===<br />
:;Signature<br />
:: <code>Location getLocation()</code><br />
<br />
===<code>getSunriseAndSunset</code>===<br />
:Returns the sunset and sunrise values for the current day. (Common method since 2.1.0)<br />
<br />
:;Signature<br />
:: <code>Map getSunriseAndSunset()</code><br />
:: <code>Map getSunriseAndSunset(Map options)</code><br />
<br />
:;Parameters<br />
:: options - Map with optional offset for sunrise or sunset, possible values are sunriseOffset and sunsetOffset and can either be a number of minutes or a String of the format Hours:Minutes<br />
<br />
:;Returns<br />
:: Map with with key values 'sunrise' and 'sunset' of type Date<br />
<br />
:;Examples<br />
<br />
// get today's sunrise and sunset<br />
def riseAndSet = getSunriseAndSunset()<br />
log.debug riseAndSet.sunrise<br />
log.debug riseAndSet.sunset<br />
<br />
// get sunrise time offset by 1 minute early, and get sunset offset by 1 hour, 5 minutes later<br />
def offsetRiseAndSet = getSunriseAndSunset(sunriseOffset: -1, sunsetOffset: "1:05")<br />
<br />
===<code>getTemperatureScale</code>===<br />
:Get the current temperature scale set for the hub.<br />
<br />
:;Signature<br />
:: <code>String getTemperatureScale()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
:: String - "F" or "C" based on the setting in the hub.<br />
<br />
===<code>now</code>===<br />
:;Signature<br />
:: long now()<br />
<br />
===<code>timeToday</code>===<br />
: Get a Date object with today's date and the time specified<br />
<br />
:;Signature<br />
:: <code>Date timeToday(String timeString, TimeZone timeZone = null)</code><br />
<br />
:;Parameters<br />
:: timeString - The time to use, can be either "HH:mm" or and ISO8601 date/time string<br />
:: timeZone - (Optional) The timezone to use for the new Date.<br />
<br />
:;Returns<br />
:: Date - A Date object with today's date and the time that was passed as timeString<br />
<br />
<br />
===<code>timeOfDayIsBetween</code>===<br />
:Check if a date is between two dates.<br />
<br />
:;Signature<br />
:: <code>boolean timeOfDayIsBetween(Date start, Date stop, Date value[, TimeZone timeZone])</code><br />
<br />
:;Parameters<br />
<br />
:: start - The date to start comparison against.<br />
:: stop - The date to stop comparison against.<br />
:: value - The date to compare<br />
:: timezone - (Optional) The timezone to use for the comparison<br />
<br />
:;Returns<br />
:: boolean - true if the value date is between the start and stop dates, otherwise returns false.<br />
<br />
<br />
===<code>unschedule</code>===<br />
:Remove any scheduled tasks. If method is called without paramters, all schedules will be removed.<br />
<br />
:;Signature<br />
:: <code>void unschedule()</code><br />
:: <code>void unschedule(handlerMethod)</code><br />
<br />
:;Parameters<br />
:: handlerMethod - Only remove schedules for this handlerMethod<br />
<br />
===<code>asynchttpGet</code>===<br />
:Send an http GET request and return control to the calling code. Any response from the call will be passed to the callback method.<br />
<br />
:;Signature<br />
:: <code>void asynchttpGet(callbackMethod, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
:: callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
:: params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPost</code>===<br />
:;Signature<br />
::<code>void asynchttpPost(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPatch</code>===<br />
:;Signature<br />
::<code>void asynchttpPatch(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http PATCH call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>httpGet</code>===<br />
:Send an http GET request. Any response from the call will be passed to the closure.<br />
<br />
:;Signature<br />
:: <code>void httpGet(String uri, Closure closure)</code><br />
:: <code>void httpGet(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPost</code>===<br />
:;Signature<br />
:: <code>void httpPost(String uri, String body, Closure closure)</code><br />
:: <code>void httpPost(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPostJson</code>===<br />
:Similar to httpPost except that the contentType parameter is set to "application/json"<br />
:;Signature<br />
:: <code>void httpPostJson(String uri, String stringBody, Closure closure)</code><br />
:: <code>void httpPostJson(String uri, Map mapBody, Closure closure)</code><br />
:: <code>void httpPostJson(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::stringBody - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::mapBody - The body of the request as a Map.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it as JSON.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.8) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPut</code>===<br />
:;Signature<br />
:: <code>void httpPut(String uri, String body, Closure closure)</code><br />
:: <code>void httpPut(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPatch (Since 2.1.7)</code>===<br />
:;Signature<br />
:: <code>void httpPatch(String uri, String body, Closure closure)</code><br />
:: <code>void httpPatch(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>runIn</code>===<br />
:;Signature<br />
::<code>void runIn(Long delayInSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
::delayInSeconds - How long to wait in seconds until the handler should be called, don't expect that it will be called in exactly that time.<br />
::handlerMethod - The name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a scheduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
runIn(50, 'myMethod', [data: ["myKey":"myValue"]])<br />
</pre><br />
<br />
===<code>runInMillis</code>===<br />
:;Signature<br />
:: <code>void runInMillis(Long delayInMilliSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
:: delayInMilliseconds - How long to wait until the handler should be called, don't expect that it will be called in exactly that time.<br />
:: handlerMethod - the name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a schduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
private processQueue(Map queue) {<br />
if (isQueueEmpty(queue)) {<br />
sendEvent name: 'lifxdiscovery', value: 'complete'<br />
return<br />
}<br />
def data = getNext(queue)<br />
sendPacket data.ipAddress, data.packet<br />
runInMillis(queue.delay, 'processQueue', [data: queue])<br />
}<br />
<br />
runInMillis(50, 'processQueue', [data: queue])<br />
</pre><br />
<br />
===<code>pauseExecution</code>===<br />
:;Signature<br />
:: <code> void pauseExecution(Long millisecs)</code><br />
<br />
:;Parameters<br />
:: millisecs - The amount of time in milliseconds to pause.<br />
<br />
===<code>toDateTime</code>===<br />
:;Signature<br />
:: <code>Date toDateTime(String dateTimeString)</code><br />
<br />
:;Parameters<br />
::dateTimeString - A date/time string in ISO8601 format. ("yyyy-MM-dd", "yyyyMMdd'T'HHmmssX", "yyyy-MM-dd'T'HH:mm:ssX", "yyyy-MM-dd'T'HH:mm:ss.SSSX")<br />
<br />
==<code>Additional to be documented</code>==<br />
<br />
'''Signature:'''<br />
BigDecimal celsiusToFahrenheit(BigDecimal val)<br />
BigDecimal fahrenheitToCelsius(BigDecimal val)<br />
void httpPutJson(String uri, String body, Closure closure)<br />
void httpPutJson(String uri, Map body, Closure closure)<br />
void httpPutJson(Map params, Closure closure)<br />
void httpDelete(Map params, Closure closure)<br />
String getMACFromIP(String ipAddr)<br />
String convertTemperatureIfNeeded(BigDecimal value, String scale, Integer precision)<br />
Object parseJson(String stringToParse)<br />
GPathResult parseXML(String stringToParse)<br />
Map parseLanMessage(String stringToParse)<br />
void runEvery1Minute(String handlerMethod, Map options = null)<br />
void runEvery5Minutes(String handlerMethod, Map options = null)<br />
void runEvery10Minutes(String handlerMethod, Map options = null)<br />
void runEvery15Minutes(String handlerMethod, Map options = null)<br />
void runEvery30Minutes(String handlerMethod, Map options = null)<br />
void runEvery1Hour(String handlerMethod, Map options = null)<br />
void runEvery3Hours(String handlerMethod, Map options = null)<br />
void runOnce(Date dateTime, String handlerMethod, Map options = null)<br />
void runOnce(String dateTime, String handlerMethod, Map options = null)<br />
void schedule(Date dateTime, String handlerMethod, Map options = null)<br />
void schedule(String expression, String handlerMethod, Map options = null)<br />
void asynchttpPut(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpDelete(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpHead(String callbackMethod = null, Map params, Map data = null)<br />
Map textToSpeech(String stringToBeSynthesized, String voice = null)<br />
String encrypt(String value)<br />
String decrypt(String value)<br />
void sendLocationEvent(Map properties)<br />
Date timeTodayAfter(String startTimeString, String timeString, TimeZone timeZone = null) (Common method since 2.1.0)<br />
Long timeOffset(Number minutes) (Common method since 2.1.0)<br />
Long timeOffset(String hoursAndMinutesString) (Common method since 2.1.0)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Common_Methods_Object&diff=2435Common Methods Object2019-12-31T20:46:14Z<p>Cschwer: </p>
<hr />
<div>These methods can be used in both Apps and Drivers<br />
<br />
===<code>getLocation</code>===<br />
:;Signature<br />
:: <code>Location getLocation()</code><br />
<br />
===<code>getSunriseAndSunset</code>===<br />
:Returns the sunset and sunrise values for the current day. (Common method since 2.1.0)<br />
<br />
:;Signature<br />
:: <code>Map getSunriseAndSunset()</code><br />
:: <code>Map getSunriseAndSunset(Map options)</code><br />
<br />
:;Parameters<br />
:: options - Map with optional offset for sunrise or sunset, possible values are sunriseOffset and sunsetOffset and can either be a number of minutes or a String of the format Hours:Minutes<br />
<br />
:;Returns<br />
:: Map with with key values 'sunrise' and 'sunset' of type Date<br />
<br />
:;Examples<br />
<br />
// get today's sunrise and sunset<br />
def riseAndSet = getSunriseAndSunset()<br />
log.debug riseAndSet.sunrise<br />
log.debug riseAndSet.sunset<br />
<br />
// get sunrise time offset by 1 minute early, and get sunset offset by 1 hour, 5 minutes later<br />
def offsetRiseAndSet = getSunriseAndSunset(sunriseOffset: -1, sunsetOffset: "1:05")<br />
<br />
===<code>getTemperatureScale</code>===<br />
:Get the current temperature scale set for the hub.<br />
<br />
:;Signature<br />
:: <code>String getTemperatureScale()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
:: String - "F" or "C" based on the setting in the hub.<br />
<br />
===<code>now</code>===<br />
:;Signature<br />
:: long now()<br />
<br />
===<code>timeToday</code>===<br />
: Get a Date object with today's date and the time specified<br />
<br />
:;Signature<br />
:: <code>Date timeToday(String timeString, TimeZone timeZone = null)</code><br />
<br />
:;Parameters<br />
:: timeString - The time to use, can be either "HH:mm" or and ISO8601 date/time string<br />
:: timeZone - (Optional) The timezone to use for the new Date.<br />
<br />
:;Returns<br />
:: Date - A Date object with today's date and the time that was passed as timeString<br />
<br />
<br />
===<code>timeOfDayIsBetween</code>===<br />
:Check if a date is between two dates.<br />
<br />
:;Signature<br />
:: <code>boolean timeOfDayIsBetween(Date start, Date stop, Date value[, TimeZone timeZone])</code><br />
<br />
:;Parameters<br />
<br />
:: start - The date to start comparison against.<br />
:: stop - The date to stop comparison against.<br />
:: value - The date to compare<br />
:: timezone - (Optional) The timezone to use for the comparison<br />
<br />
:;Returns<br />
:: boolean - true if the value date is between the start and stop dates, otherwise returns false.<br />
<br />
<br />
===<code>unschedule</code>===<br />
:Remove any scheduled tasks. If method is called without paramters, all schedules will be removed.<br />
<br />
:;Signature<br />
:: <code>void unschedule()</code><br />
:: <code>void unschedule(handlerMethod)</code><br />
<br />
:;Parameters<br />
:: handlerMethod - Only remove schedules for this handlerMethod<br />
<br />
===<code>asynchttpGet</code>===<br />
:Send an http GET request and return control to the calling code. Any response from the call will be passed to the callback method.<br />
<br />
:;Signature<br />
:: <code>void asynchttpGet(callbackMethod, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
:: callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
:: params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPost</code>===<br />
:;Signature<br />
::<code>void asynchttpPost(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPatch</code>===<br />
:;Signature<br />
::<code>void asynchttpPatch(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http PATCH call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>httpGet</code>===<br />
:Send an http GET request. Any response from the call will be passed to the closure.<br />
<br />
:;Signature<br />
:: <code>void httpGet(String uri, Closure closure)</code><br />
:: <code>void httpGet(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPost</code>===<br />
:;Signature<br />
:: <code>void httpPost(String uri, String body, Closure closure)</code><br />
:: <code>void httpPost(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPostJson</code>===<br />
:Similar to httpPost except that the contentType parameter is set to "application/json"<br />
:;Signature<br />
:: <code>void httpPostJson(String uri, String stringBody, Closure closure)</code><br />
:: <code>void httpPostJson(String uri, Map mapBody, Closure closure)</code><br />
:: <code>void httpPostJson(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::stringBody - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::mapBody - The body of the request as a Map.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it as JSON.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPut</code>===<br />
:;Signature<br />
:: <code>void httpPut(String uri, String body, Closure closure)</code><br />
:: <code>void httpPut(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPatch (Since 2.1.7)</code>===<br />
:;Signature<br />
:: <code>void httpPatch(String uri, String body, Closure closure)</code><br />
:: <code>void httpPatch(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
:::''ignoreSSLIssues'' (since 2.1.8) - possible values: true, false. Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>runIn</code>===<br />
:;Signature<br />
::<code>void runIn(Long delayInSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
::delayInSeconds - How long to wait in seconds until the handler should be called, don't expect that it will be called in exactly that time.<br />
::handlerMethod - The name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a scheduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
runIn(50, 'myMethod', [data: ["myKey":"myValue"]])<br />
</pre><br />
<br />
===<code>runInMillis</code>===<br />
:;Signature<br />
:: <code>void runInMillis(Long delayInMilliSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
:: delayInMilliseconds - How long to wait until the handler should be called, don't expect that it will be called in exactly that time.<br />
:: handlerMethod - the name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a schduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
private processQueue(Map queue) {<br />
if (isQueueEmpty(queue)) {<br />
sendEvent name: 'lifxdiscovery', value: 'complete'<br />
return<br />
}<br />
def data = getNext(queue)<br />
sendPacket data.ipAddress, data.packet<br />
runInMillis(queue.delay, 'processQueue', [data: queue])<br />
}<br />
<br />
runInMillis(50, 'processQueue', [data: queue])<br />
</pre><br />
<br />
===<code>pauseExecution</code>===<br />
:;Signature<br />
:: <code> void pauseExecution(Long millisecs)</code><br />
<br />
:;Parameters<br />
:: millisecs - The amount of time in milliseconds to pause.<br />
<br />
===<code>toDateTime</code>===<br />
:;Signature<br />
:: <code>Date toDateTime(String dateTimeString)</code><br />
<br />
:;Parameters<br />
::dateTimeString - A date/time string in ISO8601 format. ("yyyy-MM-dd", "yyyyMMdd'T'HHmmssX", "yyyy-MM-dd'T'HH:mm:ssX", "yyyy-MM-dd'T'HH:mm:ss.SSSX")<br />
<br />
==<code>Additional to be documented</code>==<br />
<br />
'''Signature:'''<br />
BigDecimal celsiusToFahrenheit(BigDecimal val)<br />
BigDecimal fahrenheitToCelsius(BigDecimal val)<br />
void httpPutJson(String uri, String body, Closure closure)<br />
void httpPutJson(String uri, Map body, Closure closure)<br />
void httpPutJson(Map params, Closure closure)<br />
void httpDelete(Map params, Closure closure)<br />
String getMACFromIP(String ipAddr)<br />
String convertTemperatureIfNeeded(BigDecimal value, String scale, Integer precision)<br />
Object parseJson(String stringToParse)<br />
GPathResult parseXML(String stringToParse)<br />
Map parseLanMessage(String stringToParse)<br />
void runEvery1Minute(String handlerMethod, Map options = null)<br />
void runEvery5Minutes(String handlerMethod, Map options = null)<br />
void runEvery10Minutes(String handlerMethod, Map options = null)<br />
void runEvery15Minutes(String handlerMethod, Map options = null)<br />
void runEvery30Minutes(String handlerMethod, Map options = null)<br />
void runEvery1Hour(String handlerMethod, Map options = null)<br />
void runEvery3Hours(String handlerMethod, Map options = null)<br />
void runOnce(Date dateTime, String handlerMethod, Map options = null)<br />
void runOnce(String dateTime, String handlerMethod, Map options = null)<br />
void schedule(Date dateTime, String handlerMethod, Map options = null)<br />
void schedule(String expression, String handlerMethod, Map options = null)<br />
void asynchttpPut(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpDelete(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpHead(String callbackMethod = null, Map params, Map data = null)<br />
Map textToSpeech(String stringToBeSynthesized, String voice = null)<br />
String encrypt(String value)<br />
String decrypt(String value)<br />
void sendLocationEvent(Map properties)<br />
Date timeTodayAfter(String startTimeString, String timeString, TimeZone timeZone = null) (Common method since 2.1.0)<br />
Long timeOffset(Number minutes) (Common method since 2.1.0)<br />
Long timeOffset(String hoursAndMinutesString) (Common method since 2.1.0)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Common_Methods_Object&diff=2434Common Methods Object2019-12-31T20:44:19Z<p>Cschwer: /* asynchttpPost */</p>
<hr />
<div>These methods can be used in both Apps and Drivers<br />
<br />
===<code>getLocation</code>===<br />
:;Signature<br />
:: <code>Location getLocation()</code><br />
<br />
===<code>getSunriseAndSunset</code>===<br />
:Returns the sunset and sunrise values for the current day. (Common method since 2.1.0)<br />
<br />
:;Signature<br />
:: <code>Map getSunriseAndSunset()</code><br />
:: <code>Map getSunriseAndSunset(Map options)</code><br />
<br />
:;Parameters<br />
:: options - Map with optional offset for sunrise or sunset, possible values are sunriseOffset and sunsetOffset and can either be a number of minutes or a String of the format Hours:Minutes<br />
<br />
:;Returns<br />
:: Map with with key values 'sunrise' and 'sunset' of type Date<br />
<br />
:;Examples<br />
<br />
// get today's sunrise and sunset<br />
def riseAndSet = getSunriseAndSunset()<br />
log.debug riseAndSet.sunrise<br />
log.debug riseAndSet.sunset<br />
<br />
// get sunrise time offset by 1 minute early, and get sunset offset by 1 hour, 5 minutes later<br />
def offsetRiseAndSet = getSunriseAndSunset(sunriseOffset: -1, sunsetOffset: "1:05")<br />
<br />
===<code>getTemperatureScale</code>===<br />
:Get the current temperature scale set for the hub.<br />
<br />
:;Signature<br />
:: <code>String getTemperatureScale()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
:: String - "F" or "C" based on the setting in the hub.<br />
<br />
===<code>now</code>===<br />
:;Signature<br />
:: long now()<br />
<br />
===<code>timeToday</code>===<br />
: Get a Date object with today's date and the time specified<br />
<br />
:;Signature<br />
:: <code>Date timeToday(String timeString, TimeZone timeZone = null)</code><br />
<br />
:;Parameters<br />
:: timeString - The time to use, can be either "HH:mm" or and ISO8601 date/time string<br />
:: timeZone - (Optional) The timezone to use for the new Date.<br />
<br />
:;Returns<br />
:: Date - A Date object with today's date and the time that was passed as timeString<br />
<br />
<br />
===<code>timeOfDayIsBetween</code>===<br />
:Check if a date is between two dates.<br />
<br />
:;Signature<br />
:: <code>boolean timeOfDayIsBetween(Date start, Date stop, Date value[, TimeZone timeZone])</code><br />
<br />
:;Parameters<br />
<br />
:: start - The date to start comparison against.<br />
:: stop - The date to stop comparison against.<br />
:: value - The date to compare<br />
:: timezone - (Optional) The timezone to use for the comparison<br />
<br />
:;Returns<br />
:: boolean - true if the value date is between the start and stop dates, otherwise returns false.<br />
<br />
<br />
===<code>unschedule</code>===<br />
:Remove any scheduled tasks. If method is called without paramters, all schedules will be removed.<br />
<br />
:;Signature<br />
:: <code>void unschedule()</code><br />
:: <code>void unschedule(handlerMethod)</code><br />
<br />
:;Parameters<br />
:: handlerMethod - Only remove schedules for this handlerMethod<br />
<br />
===<code>asynchttpGet</code>===<br />
:Send an http GET request and return control to the calling code. Any response from the call will be passed to the callback method.<br />
<br />
:;Signature<br />
:: <code>void asynchttpGet(callbackMethod, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
:: callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
:: params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPost</code>===<br />
:;Signature<br />
::<code>void asynchttpPost(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPatch</code>===<br />
:;Signature<br />
::<code>void asynchttpPatch(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http PATCH call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>httpGet</code>===<br />
:Send an http GET request. Any response from the call will be passed to the closure.<br />
<br />
:;Signature<br />
:: <code>void httpGet(String uri, Closure closure)</code><br />
:: <code>void httpGet(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPost</code>===<br />
:;Signature<br />
:: <code>void httpPost(String uri, String body, Closure closure)</code><br />
:: <code>void httpPost(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPostJson</code>===<br />
:Similar to httpPost except that the contentType parameter is set to "application/json"<br />
:;Signature<br />
:: <code>void httpPostJson(String uri, String stringBody, Closure closure)</code><br />
:: <code>void httpPostJson(String uri, Map mapBody, Closure closure)</code><br />
:: <code>void httpPostJson(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::stringBody - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::mapBody - The body of the request as a Map.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it as JSON.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPut</code>===<br />
:;Signature<br />
:: <code>void httpPut(String uri, String body, Closure closure)</code><br />
:: <code>void httpPut(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPatch (Since 2.1.7)</code>===<br />
:;Signature<br />
:: <code>void httpPatch(String uri, String body, Closure closure)</code><br />
:: <code>void httpPatch(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>runIn</code>===<br />
:;Signature<br />
::<code>void runIn(Long delayInSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
::delayInSeconds - How long to wait in seconds until the handler should be called, don't expect that it will be called in exactly that time.<br />
::handlerMethod - The name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a scheduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
runIn(50, 'myMethod', [data: ["myKey":"myValue"]])<br />
</pre><br />
<br />
===<code>runInMillis</code>===<br />
:;Signature<br />
:: <code>void runInMillis(Long delayInMilliSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
:: delayInMilliseconds - How long to wait until the handler should be called, don't expect that it will be called in exactly that time.<br />
:: handlerMethod - the name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a schduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
private processQueue(Map queue) {<br />
if (isQueueEmpty(queue)) {<br />
sendEvent name: 'lifxdiscovery', value: 'complete'<br />
return<br />
}<br />
def data = getNext(queue)<br />
sendPacket data.ipAddress, data.packet<br />
runInMillis(queue.delay, 'processQueue', [data: queue])<br />
}<br />
<br />
runInMillis(50, 'processQueue', [data: queue])<br />
</pre><br />
<br />
===<code>pauseExecution</code>===<br />
:;Signature<br />
:: <code> void pauseExecution(Long millisecs)</code><br />
<br />
:;Parameters<br />
:: millisecs - The amount of time in milliseconds to pause.<br />
<br />
===<code>toDateTime</code>===<br />
:;Signature<br />
:: <code>Date toDateTime(String dateTimeString)</code><br />
<br />
:;Parameters<br />
::dateTimeString - A date/time string in ISO8601 format. ("yyyy-MM-dd", "yyyyMMdd'T'HHmmssX", "yyyy-MM-dd'T'HH:mm:ssX", "yyyy-MM-dd'T'HH:mm:ss.SSSX")<br />
<br />
==<code>Additional to be documented</code>==<br />
<br />
'''Signature:'''<br />
BigDecimal celsiusToFahrenheit(BigDecimal val)<br />
BigDecimal fahrenheitToCelsius(BigDecimal val)<br />
void httpPutJson(String uri, String body, Closure closure)<br />
void httpPutJson(String uri, Map body, Closure closure)<br />
void httpPutJson(Map params, Closure closure)<br />
void httpDelete(Map params, Closure closure)<br />
String getMACFromIP(String ipAddr)<br />
String convertTemperatureIfNeeded(BigDecimal value, String scale, Integer precision)<br />
Object parseJson(String stringToParse)<br />
GPathResult parseXML(String stringToParse)<br />
Map parseLanMessage(String stringToParse)<br />
void runEvery1Minute(String handlerMethod, Map options = null)<br />
void runEvery5Minutes(String handlerMethod, Map options = null)<br />
void runEvery10Minutes(String handlerMethod, Map options = null)<br />
void runEvery15Minutes(String handlerMethod, Map options = null)<br />
void runEvery30Minutes(String handlerMethod, Map options = null)<br />
void runEvery1Hour(String handlerMethod, Map options = null)<br />
void runEvery3Hours(String handlerMethod, Map options = null)<br />
void runOnce(Date dateTime, String handlerMethod, Map options = null)<br />
void runOnce(String dateTime, String handlerMethod, Map options = null)<br />
void schedule(Date dateTime, String handlerMethod, Map options = null)<br />
void schedule(String expression, String handlerMethod, Map options = null)<br />
void asynchttpPut(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpDelete(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpHead(String callbackMethod = null, Map params, Map data = null)<br />
Map textToSpeech(String stringToBeSynthesized, String voice = null)<br />
String encrypt(String value)<br />
String decrypt(String value)<br />
void sendLocationEvent(Map properties)<br />
Date timeTodayAfter(String startTimeString, String timeString, TimeZone timeZone = null) (Common method since 2.1.0)<br />
Long timeOffset(Number minutes) (Common method since 2.1.0)<br />
Long timeOffset(String hoursAndMinutesString) (Common method since 2.1.0)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Common_Methods_Object&diff=2433Common Methods Object2019-12-31T20:43:43Z<p>Cschwer: /* asynchttpGet */</p>
<hr />
<div>These methods can be used in both Apps and Drivers<br />
<br />
===<code>getLocation</code>===<br />
:;Signature<br />
:: <code>Location getLocation()</code><br />
<br />
===<code>getSunriseAndSunset</code>===<br />
:Returns the sunset and sunrise values for the current day. (Common method since 2.1.0)<br />
<br />
:;Signature<br />
:: <code>Map getSunriseAndSunset()</code><br />
:: <code>Map getSunriseAndSunset(Map options)</code><br />
<br />
:;Parameters<br />
:: options - Map with optional offset for sunrise or sunset, possible values are sunriseOffset and sunsetOffset and can either be a number of minutes or a String of the format Hours:Minutes<br />
<br />
:;Returns<br />
:: Map with with key values 'sunrise' and 'sunset' of type Date<br />
<br />
:;Examples<br />
<br />
// get today's sunrise and sunset<br />
def riseAndSet = getSunriseAndSunset()<br />
log.debug riseAndSet.sunrise<br />
log.debug riseAndSet.sunset<br />
<br />
// get sunrise time offset by 1 minute early, and get sunset offset by 1 hour, 5 minutes later<br />
def offsetRiseAndSet = getSunriseAndSunset(sunriseOffset: -1, sunsetOffset: "1:05")<br />
<br />
===<code>getTemperatureScale</code>===<br />
:Get the current temperature scale set for the hub.<br />
<br />
:;Signature<br />
:: <code>String getTemperatureScale()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
:: String - "F" or "C" based on the setting in the hub.<br />
<br />
===<code>now</code>===<br />
:;Signature<br />
:: long now()<br />
<br />
===<code>timeToday</code>===<br />
: Get a Date object with today's date and the time specified<br />
<br />
:;Signature<br />
:: <code>Date timeToday(String timeString, TimeZone timeZone = null)</code><br />
<br />
:;Parameters<br />
:: timeString - The time to use, can be either "HH:mm" or and ISO8601 date/time string<br />
:: timeZone - (Optional) The timezone to use for the new Date.<br />
<br />
:;Returns<br />
:: Date - A Date object with today's date and the time that was passed as timeString<br />
<br />
<br />
===<code>timeOfDayIsBetween</code>===<br />
:Check if a date is between two dates.<br />
<br />
:;Signature<br />
:: <code>boolean timeOfDayIsBetween(Date start, Date stop, Date value[, TimeZone timeZone])</code><br />
<br />
:;Parameters<br />
<br />
:: start - The date to start comparison against.<br />
:: stop - The date to stop comparison against.<br />
:: value - The date to compare<br />
:: timezone - (Optional) The timezone to use for the comparison<br />
<br />
:;Returns<br />
:: boolean - true if the value date is between the start and stop dates, otherwise returns false.<br />
<br />
<br />
===<code>unschedule</code>===<br />
:Remove any scheduled tasks. If method is called without paramters, all schedules will be removed.<br />
<br />
:;Signature<br />
:: <code>void unschedule()</code><br />
:: <code>void unschedule(handlerMethod)</code><br />
<br />
:;Parameters<br />
:: handlerMethod - Only remove schedules for this handlerMethod<br />
<br />
===<code>asynchttpGet</code>===<br />
:Send an http GET request and return control to the calling code. Any response from the call will be passed to the callback method.<br />
<br />
:;Signature<br />
:: <code>void asynchttpGet(callbackMethod, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
:: callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
:: params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''ignoreSSLIssues'' (since 2.1.8) - Ignores certificate issues for SSL connections. Cert does not have to be from a trusted authority and the hostname does not need to be verified. This is primarily for dev situations that make use of localhost, build, and test servers.<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPost</code>===<br />
:;Signature<br />
::<code>void asynchttpPost(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
::data - optional data to be passed to the callback method.<br />
<br />
<br />
===<code>asynchttpPatch</code>===<br />
:;Signature<br />
::<code>void asynchttpPatch(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http PATCH call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>httpGet</code>===<br />
:Send an http GET request. Any response from the call will be passed to the closure.<br />
<br />
:;Signature<br />
:: <code>void httpGet(String uri, Closure closure)</code><br />
:: <code>void httpGet(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPost</code>===<br />
:;Signature<br />
:: <code>void httpPost(String uri, String body, Closure closure)</code><br />
:: <code>void httpPost(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPostJson</code>===<br />
:Similar to httpPost except that the contentType parameter is set to "application/json"<br />
:;Signature<br />
:: <code>void httpPostJson(String uri, String stringBody, Closure closure)</code><br />
:: <code>void httpPostJson(String uri, Map mapBody, Closure closure)</code><br />
:: <code>void httpPostJson(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::stringBody - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::mapBody - The body of the request as a Map.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it as JSON.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPut</code>===<br />
:;Signature<br />
:: <code>void httpPut(String uri, String body, Closure closure)</code><br />
:: <code>void httpPut(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPatch (Since 2.1.7)</code>===<br />
:;Signature<br />
:: <code>void httpPatch(String uri, String body, Closure closure)</code><br />
:: <code>void httpPatch(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>runIn</code>===<br />
:;Signature<br />
::<code>void runIn(Long delayInSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
::delayInSeconds - How long to wait in seconds until the handler should be called, don't expect that it will be called in exactly that time.<br />
::handlerMethod - The name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a scheduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
runIn(50, 'myMethod', [data: ["myKey":"myValue"]])<br />
</pre><br />
<br />
===<code>runInMillis</code>===<br />
:;Signature<br />
:: <code>void runInMillis(Long delayInMilliSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
:: delayInMilliseconds - How long to wait until the handler should be called, don't expect that it will be called in exactly that time.<br />
:: handlerMethod - the name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a schduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
private processQueue(Map queue) {<br />
if (isQueueEmpty(queue)) {<br />
sendEvent name: 'lifxdiscovery', value: 'complete'<br />
return<br />
}<br />
def data = getNext(queue)<br />
sendPacket data.ipAddress, data.packet<br />
runInMillis(queue.delay, 'processQueue', [data: queue])<br />
}<br />
<br />
runInMillis(50, 'processQueue', [data: queue])<br />
</pre><br />
<br />
===<code>pauseExecution</code>===<br />
:;Signature<br />
:: <code> void pauseExecution(Long millisecs)</code><br />
<br />
:;Parameters<br />
:: millisecs - The amount of time in milliseconds to pause.<br />
<br />
===<code>toDateTime</code>===<br />
:;Signature<br />
:: <code>Date toDateTime(String dateTimeString)</code><br />
<br />
:;Parameters<br />
::dateTimeString - A date/time string in ISO8601 format. ("yyyy-MM-dd", "yyyyMMdd'T'HHmmssX", "yyyy-MM-dd'T'HH:mm:ssX", "yyyy-MM-dd'T'HH:mm:ss.SSSX")<br />
<br />
==<code>Additional to be documented</code>==<br />
<br />
'''Signature:'''<br />
BigDecimal celsiusToFahrenheit(BigDecimal val)<br />
BigDecimal fahrenheitToCelsius(BigDecimal val)<br />
void httpPutJson(String uri, String body, Closure closure)<br />
void httpPutJson(String uri, Map body, Closure closure)<br />
void httpPutJson(Map params, Closure closure)<br />
void httpDelete(Map params, Closure closure)<br />
String getMACFromIP(String ipAddr)<br />
String convertTemperatureIfNeeded(BigDecimal value, String scale, Integer precision)<br />
Object parseJson(String stringToParse)<br />
GPathResult parseXML(String stringToParse)<br />
Map parseLanMessage(String stringToParse)<br />
void runEvery1Minute(String handlerMethod, Map options = null)<br />
void runEvery5Minutes(String handlerMethod, Map options = null)<br />
void runEvery10Minutes(String handlerMethod, Map options = null)<br />
void runEvery15Minutes(String handlerMethod, Map options = null)<br />
void runEvery30Minutes(String handlerMethod, Map options = null)<br />
void runEvery1Hour(String handlerMethod, Map options = null)<br />
void runEvery3Hours(String handlerMethod, Map options = null)<br />
void runOnce(Date dateTime, String handlerMethod, Map options = null)<br />
void runOnce(String dateTime, String handlerMethod, Map options = null)<br />
void schedule(Date dateTime, String handlerMethod, Map options = null)<br />
void schedule(String expression, String handlerMethod, Map options = null)<br />
void asynchttpPut(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpDelete(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpHead(String callbackMethod = null, Map params, Map data = null)<br />
Map textToSpeech(String stringToBeSynthesized, String voice = null)<br />
String encrypt(String value)<br />
String decrypt(String value)<br />
void sendLocationEvent(Map properties)<br />
Date timeTodayAfter(String startTimeString, String timeString, TimeZone timeZone = null) (Common method since 2.1.0)<br />
Long timeOffset(Number minutes) (Common method since 2.1.0)<br />
Long timeOffset(String hoursAndMinutesString) (Common method since 2.1.0)</div>Cschwerhttps://docs.hubitat.com/index.php?title=Common_Methods_Object&diff=2428Common Methods Object2019-12-15T23:06:50Z<p>Cschwer: </p>
<hr />
<div>These methods can be used in both Apps and Drivers<br />
<br />
===<code>getLocation</code>===<br />
:;Signature<br />
:: <code>Location getLocation()</code><br />
<br />
===<code>getSunriseAndSunset</code>===<br />
:Returns the sunset and sunrise values for the current day. (Common method since 2.1.0)<br />
<br />
:;Signature<br />
:: <code>Map getSunriseAndSunset()</code><br />
:: <code>Map getSunriseAndSunset(Map options)</code><br />
<br />
:;Parameters<br />
:: options - Map with optional offset for sunrise or sunset, possible values are sunriseOffset and sunsetOffset and can either be a number of minutes or a String of the format Hours:Minutes<br />
<br />
:;Returns<br />
:: Map with with key values 'sunrise' and 'sunset' of type Date<br />
<br />
:;Examples<br />
<br />
// get today's sunrise and sunset<br />
def riseAndSet = getSunriseAndSunset()<br />
log.debug riseAndSet.sunrise<br />
log.debug riseAndSet.sunset<br />
<br />
// get sunrise time offset by 1 minute early, and get sunset offset by 1 hour, 5 minutes later<br />
def offsetRiseAndSet = getSunriseAndSunset(sunriseOffset: -1, sunsetOffset: "1:05")<br />
<br />
===<code>getTemperatureScale</code>===<br />
:Get the current temperature scale set for the hub.<br />
<br />
:;Signature<br />
:: <code>String getTemperatureScale()</code><br />
<br />
:;Parameters<br />
:: none<br />
<br />
:;Returns<br />
:: String - "F" or "C" based on the setting in the hub.<br />
<br />
===<code>now</code>===<br />
:;Signature<br />
:: long now()<br />
<br />
===<code>timeToday</code>===<br />
: Get a Date object with today's date and the time specified<br />
<br />
:;Signature<br />
:: <code>Date timeToday(String timeString, TimeZone timeZone = null)</code><br />
<br />
:;Parameters<br />
:: timeString - The time to use, can be either "HH:mm" or and ISO8601 date/time string<br />
:: timeZone - (Optional) The timezone to use for the new Date.<br />
<br />
:;Returns<br />
:: Date - A Date object with today's date and the time that was passed as timeString<br />
<br />
<br />
===<code>timeOfDayIsBetween</code>===<br />
:Check if a date is between two dates.<br />
<br />
:;Signature<br />
:: <code>boolean timeOfDayIsBetween(Date start, Date stop, Date value[, TimeZone timeZone])</code><br />
<br />
:;Parameters<br />
<br />
:: start - The date to start comparison against.<br />
:: stop - The date to stop comparison against.<br />
:: value - The date to compare<br />
:: timezone - (Optional) The timezone to use for the comparison<br />
<br />
:;Returns<br />
:: boolean - true if the value date is between the start and stop dates, otherwise returns false.<br />
<br />
<br />
===<code>unschedule</code>===<br />
:Remove any scheduled tasks. If method is called without paramters, all schedules will be removed.<br />
<br />
:;Signature<br />
:: <code>void unschedule()</code><br />
:: <code>void unschedule(handlerMethod)</code><br />
<br />
:;Parameters<br />
:: handlerMethod - Only remove schedules for this handlerMethod<br />
<br />
===<code>asynchttpGet</code>===<br />
:Send an http GET request and return control to the calling code. Any response from the call will be passed to the callback method.<br />
<br />
:;Signature<br />
:: <code>void asynchttpGet(callbackMethod, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
:: callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
:: params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>asynchttpPost</code>===<br />
:;Signature<br />
::<code>void asynchttpPost(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
::data - optional data to be passed to the callback method.<br />
<br />
<br />
===<code>asynchttpPatch</code>===<br />
:;Signature<br />
::<code>void asynchttpPatch(String callbackMethod = null, Map params, Map data = null)</code><br />
<br />
:;Parameters<br />
::callbackMethod - The name of a callback method to send the response to. Can be null if the response can be ignored.<br />
::params - the parameters to use to build the http PATCH call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
::data - optional data to be passed to the callback method.<br />
<br />
===<code>httpGet</code>===<br />
:Send an http GET request. Any response from the call will be passed to the closure.<br />
<br />
:;Signature<br />
:: <code>void httpGet(String uri, Closure closure)</code><br />
:: <code>void httpGet(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::params - the parameters to use to build the http GET call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPost</code>===<br />
:;Signature<br />
:: <code>void httpPost(String uri, String body, Closure closure)</code><br />
:: <code>void httpPost(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPostJson</code>===<br />
:Similar to httpPost except that the contentType parameter is set to "application/json"<br />
:;Signature<br />
:: <code>void httpPostJson(String uri, String stringBody, Closure closure)</code><br />
:: <code>void httpPostJson(String uri, Map mapBody, Closure closure)</code><br />
:: <code>void httpPostJson(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::stringBody - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::mapBody - The body of the request as a Map.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it as JSON.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPut</code>===<br />
:;Signature<br />
:: <code>void httpPut(String uri, String body, Closure closure)</code><br />
:: <code>void httpPut(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' (since 2.0.9) - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' (since 2.1.1) - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>httpPatch (Since 2.1.7)</code>===<br />
:;Signature<br />
:: <code>void httpPatch(String uri, String body, Closure closure)</code><br />
:: <code>void httpPatch(Map params, Closure closure)</code><br />
<br />
:;Parameters<br />
::uri - The full uri to send the request to.<br />
::body - The body of the request as a String. Any encoding should be done before passing to the system.<br />
::params - the parameters to use to build the http call. Possible values:<br />
:::''uri'' - The uri to send the request to<br />
:::''queryString'' - The raw, already-escaped query string.<br />
:::''query'' - Add these parameters to the existing query string. If any of the parameters already exist in the query, these values will not replace them. Multiple values for the same query parameter may be added by putting them in a list.<br />
:::''headers'' - Request headers<br />
:::''path'' - The path component of this request. The value may be absolute or relative to the current path.<br />
:::''contentType'' - The content-type used for any data in the request body, as well as the <code>Accept</code> content-type that will be used for parsing the response.<br />
:::''requestContentType'' - Assign a different content-type for the request than is expected for the response.<br />
:::''body'' - The request body. If this is a Map or Array, the system will take care of encoding it based on the requestContentType.<br />
:::''timeout'' - timeout in seconds for the request, max timeout is 300<br />
:::''textParser'' - possible values: true, false. If set to true, the response will be parsed as plain text, if false the system will attempt to determine the content type and parse the response into an object. Defaults to false.<br />
::closure - code to handle a successful HTTP response. an object of type HttpResponseDecorator is passed to this code.<br />
<br />
===<code>runIn</code>===<br />
:;Signature<br />
::<code>void runIn(Long delayInSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
::delayInSeconds - How long to wait in seconds until the handler should be called, don't expect that it will be called in exactly that time.<br />
::handlerMethod - The name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a scheduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
runIn(50, 'myMethod', [data: ["myKey":"myValue"]])<br />
</pre><br />
<br />
===<code>runInMillis</code>===<br />
:;Signature<br />
:: <code>void runInMillis(Long delayInMilliSeconds, String handlerMethod, Map options = null)</code><br />
<br />
:;Parameters<br />
:: delayInMilliseconds - How long to wait until the handler should be called, don't expect that it will be called in exactly that time.<br />
:: handlerMethod - the name of a handler method in your driver or app. The method name should not contain parentheses.<br />
::options - Optional values to control the scheduling of this method<br />
:::''overwrite'' - defaults to true which cancels the previous scheduled running of the handler method and schedules new, if set to false this will create a duplicate schedule.<br />
:::''data'' - optional data to be passed to the handler method.<br />
:::''misfire'' - If set to "ignore" then the scheduler will simply try to fire it as soon as it can. NOTE: if a schduler uses this instruction, and it has missed several of its scheduled firings, then several rapid firings may occur as the scheduler attempts to catch back up to where it would have been.<br />
<br />
:;Example:<br />
<pre><br />
private processQueue(Map queue) {<br />
if (isQueueEmpty(queue)) {<br />
sendEvent name: 'lifxdiscovery', value: 'complete'<br />
return<br />
}<br />
def data = getNext(queue)<br />
sendPacket data.ipAddress, data.packet<br />
runInMillis(queue.delay, 'processQueue', [data: queue])<br />
}<br />
<br />
runInMillis(50, 'processQueue', [data: queue])<br />
</pre><br />
<br />
===<code>pauseExecution</code>===<br />
:;Signature<br />
:: <code> void pauseExecution(Long millisecs)</code><br />
<br />
:;Parameters<br />
:: millisecs - The amount of time in milliseconds to pause.<br />
<br />
===<code>toDateTime</code>===<br />
:;Signature<br />
:: <code>Date toDateTime(String dateTimeString)</code><br />
<br />
:;Parameters<br />
::dateTimeString - A date/time string in ISO8601 format. ("yyyy-MM-dd", "yyyyMMdd'T'HHmmssX", "yyyy-MM-dd'T'HH:mm:ssX", "yyyy-MM-dd'T'HH:mm:ss.SSSX")<br />
<br />
==<code>Additional to be documented</code>==<br />
<br />
'''Signature:'''<br />
BigDecimal celsiusToFahrenheit(BigDecimal val)<br />
BigDecimal fahrenheitToCelsius(BigDecimal val)<br />
void httpPutJson(String uri, String body, Closure closure)<br />
void httpPutJson(String uri, Map body, Closure closure)<br />
void httpPutJson(Map params, Closure closure)<br />
void httpDelete(Map params, Closure closure)<br />
String getMACFromIP(String ipAddr)<br />
String convertTemperatureIfNeeded(BigDecimal value, String scale, Integer precision)<br />
Object parseJson(String stringToParse)<br />
GPathResult parseXML(String stringToParse)<br />
Map parseLanMessage(String stringToParse)<br />
void runEvery1Minute(String handlerMethod, Map options = null)<br />
void runEvery5Minutes(String handlerMethod, Map options = null)<br />
void runEvery10Minutes(String handlerMethod, Map options = null)<br />
void runEvery15Minutes(String handlerMethod, Map options = null)<br />
void runEvery30Minutes(String handlerMethod, Map options = null)<br />
void runEvery1Hour(String handlerMethod, Map options = null)<br />
void runEvery3Hours(String handlerMethod, Map options = null)<br />
void runOnce(Date dateTime, String handlerMethod, Map options = null)<br />
void runOnce(String dateTime, String handlerMethod, Map options = null)<br />
void schedule(Date dateTime, String handlerMethod, Map options = null)<br />
void schedule(String expression, String handlerMethod, Map options = null)<br />
void asynchttpPut(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpDelete(String callbackMethod = null, Map params, Map data = null)<br />
void asynchttpHead(String callbackMethod = null, Map params, Map data = null)<br />
Map textToSpeech(String stringToBeSynthesized, String voice = null)<br />
String encrypt(String value)<br />
String decrypt(String value)<br />
void sendLocationEvent(Map properties)<br />
Date timeTodayAfter(String startTimeString, String timeString, TimeZone timeZone = null) (Common method since 2.1.0)<br />
Long timeOffset(Number minutes) (Common method since 2.1.0)<br />
Long timeOffset(String hoursAndMinutesString) (Common method since 2.1.0)</div>Cschwer