Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 1.75 KB

README.md

File metadata and controls

42 lines (33 loc) · 1.75 KB

Hubitat Source Stub

This repository contains stubs of the classes, methods, and properties documented in the Hubitat Developer Documentation, with the exception of the ZWave commands. They can be imported into your Hubitat app or driver project to enable autocomplete for your IDE.

A few methods and properties from the SmartThings Classic Developer Documentation have been included as well, and I will add more from there as I come across ones that work on Hubitat.

To enable autocomplete for your Hubitat app or driver project:

  1. Copy the directories in src into a source directory of your project. For IntelliJ, make sure a source directory is configured in Project Settings > Modules, and make sure your app and driver code is not in a source directory.
  2. Add the following code to the top of your app or driver script:

For apps:

/** For development only. Do not copy to Hubitat. */
import com.hubitat.hub.executor.AppExecutor
import groovy.transform.BaseScript

@BaseScript AppExecutor appExecutor
/**************************************************/

For drivers:

/** For development only. Do not copy to Hubitat. */
import com.hubitat.hub.executor.DeviceExecutor
import groovy.transform.BaseScript

@BaseScript DeviceExecutor deviceExecutor
/**************************************************/

You may also want autocomplete for your settings objects, in which case you can also add a field for each input like so:

Input:

input "motionSensor", "capability.motionSensor", title: "Select Motion Sensor"

Field:

import com.hubitat.app.DeviceWrapper
import groovy.transform.Field

@Field DeviceWrapper motionSensor