How to Develop a New Driver - dipakparmar/tuya-homebridge GitHub Wiki
How to implement plugins
Pay attention to several JSON files
- 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.
Common issues
For more information about Homebridge installation, see the Common Issues in the Homebridge repo.
Tuya Open API
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.
MQTT
start()
: Starts MQTT.stop()
: Stops MQTT.addMessageListener(listener)
: Adds callbacks.removeMessageListener(listener)
: Removes callbacks.