-
Notifications
You must be signed in to change notification settings - Fork 184
How to Develop a New Driver
Hugo-tuya edited this page Jul 16, 2021
·
2 revisions
- The entry file
index.js
. Add your desired accessory type to theaddAccessory()
function and create thexx_accessy.js
file.
- The
xx_accessory.js
file. In this file, traverse your newly created function inrefreshAccessoryServiceIfNeed()
and get theCharacteristic
corresponding to a service.
- The
tuyaopenapi.js
file contains device related APIs. - The
tuyamqttapi.js
file supports the MQTT service.
For more information about Homebridge installation, see the Common Issues in the Homebridge repo.
-
login(username, password)
: Login to the Tuya IoT Platform. -
getDeviceList()
: Gets all the devices under an account's asset. (Devices correspond to accessories) -
get_assets()
: Gets the available assets. -
getDeviceIDList(assetID)
: Queries the list of device IDs under an asset. -
getDeviceFunctions(deviceID)
: Gets the instruction set. -
getDeviceInfo(deviceID)
: Gets the information of single device. -
getDeviceListInfo(devIds = [])
: Gets the information of multiple devices. -
getDeviceStatus(deviceID)
: Gets the status of single device. -
getDeviceListStatus(devIds = [])
: Gets the status of multiple devices. -
sendCommand(deviceID, params)
: Sends commands to a device.
For more info, please check the Tuya Open API docs.
-
start()
: Starts MQTT. -
stop()
: Stops MQTT. -
addMessageListener(listener)
: Adds callbacks. -
removeMessageListener(listener)
: Removes callbacks.