Difference between revisions of "App Object"

From Hubitat Documentation
Jump to: navigation, search
(Replaced content with " <big>'''We're moving!''' Please visit http://docs2.hubitat.com for the latest documentation.</big> <big>This document is available at: http://docs2.hubitat.com/en/devel...")
(Tag: Replaced)
 
(26 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== <code>installed</code> ==
 
 
This method is called when the app is first installed.
 
 
'''Signature:'''
 
void installed()
 
 
== <code>updated</code> ==
 
 
This method is called when the preferences of an installed app are updated.
 
 
'''Signature:'''
 
void updated()
 
 
== <code>getSunriseAndSunset</code> ==
 
 
Returns the sunset and sunrise values for the current day
 
 
'''Signature:'''
 
Map getSunriseAndSunset()
 
Map getSunriseAndSunset(Map options)
 
 
'''Parameters:'''
 
 
: 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
 
 
'''Returns:'''
 
: Map with with key values 'sunrise' and 'sunset' of type Date
 
 
'''Examples:'''
 
 
// get today's sunrise and sunset
 
def riseAndSet = getSunriseAndSunset()
 
log.debug riseAndSet.sunrise
 
log.debug riseAndSet.sunset
 
 
   
 
   
// get sunrise time offset by 1 minute early, and get sunset offset by 1 hour, 5 minutes later
+
<big>'''We're moving!''' Please visit http://docs2.hubitat.com for the latest documentation.</big>
def offsetRiseAndSet = getSunriseAndSunset(sunriseOffset: -1, sunsetOffset: "1:05")
 
 
 
  
== <code>Additional to be documented</code> ==
+
<big>This document is available at: http://docs2.hubitat.com/en/developer/app/app-object</big>
Map getState()
 
String getHubUID()
 
String getApiServerUrl()
 
String getFullApiServerUrl()
 
String apiServerUrl(String url)
 
String getLocalApiServerUrl()
 
String getFullLocalApiServerUrl()
 
String localApiServerUrl(String url)
 
String fullLocalApiServerUrl(String url)
 
void setLocationMode(String mode)
 
String createAccessToken()
 
void pause(Long millisecs)
 
InstalledAppWrapper getParent()
 
InstalledAppWrapper addChildApp(String namespace, String name, String label, Map properties = null)
 
void deleteChildApp(Long childAppId)
 
ChildDeviceWrapper getChildDevice(String deviceNetworkId)
 
List<ChildDeviceWrapper> getChildDevices()
 
List<ChildDeviceWrapper> getAllChildDevices()
 
ChildDeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, Long hubId = null, Map properties = null)
 
void deleteChildDevice(String deviceNetworkId)
 
DeviceWrapper getSubscribedDeviceById(Long deviceId)
 
void sendEvent(Map properties)
 
void sendEvent(DeviceWrapper device, Map properties)
 
void sendEvent(String dni, Map properties)
 
List<Event> getLocationEventsSince(String attributeName, Date startDate, Map options = null)
 
void unsubscribe()
 
void unsubscribe(DeviceWrapper device)
 
void unsubscribe(List<DeviceWrapper> devices)
 
void subscribe(Object thing, String attributeName, handlerMethod, Map options = null)
 
void subscribe(Object thing, handlerMethod)
 
void sendSms(String phone, String message)
 
void sendSmsMessage(String phone, String message)
 
Date timeTodayAfter(String startTimeString, String timeString, TimeZone timeZone = null)
 
Long timeOffset(Number minutes)
 
Long timeOffset(String hoursAndMinutesString)
 
List<InstalledApp> getAllChildApps()
 
List<InstalledApp> getChildApps()
 
InstalledAppWrapper getChildAppById(Long childAppId)
 
InstalledAppWrapper getChildAppByLabel(String childAppLabel)
 

Latest revision as of 03:47, 25 September 2022

We're moving! Please visit http://docs2.hubitat.com for the latest documentation.

This document is available at: http://docs2.hubitat.com/en/developer/app/app-object