@csteele
Do you know what would cause sync to not work with the Custom Drivers? I created a custom stub driver for my Xiaomi Temp/Humidity Sensors but cannot get the Sync to work to sync the attributes to the Coordinator hub. The attributes does seem to actually update though when the attributes update on these devices, but not sure why Sync option doesn't do anything. The device itself doesn't support Refresh but when I created the Stub driver and added the device to the Server Instance/Remote Client on App Code the Sync option works fine so it appears to be something odd with the Custom Drivers.
I was planning on creating a few more drivers and was looking to get this to work so it fully functions like a normal stub driver.
Is the sync option supposed to work on Custom Drivers?
Logs:
[app:2442] (http://10.100.11.110/logs/past#app2442)2019-10-27 10:09:04.388 pm [warn] (http://10.100.11.110/installedapp/configure/2442)The device [Main Bathroom Temp Sensor] does not support the command refresh.
[app:2442] (http://10.100.11.110/logs/past#app2442)2019-10-27 10:09:04.326 pm [info] (http://10.100.11.110/installedapp/configure/2442)Received command from server: ["Main Bathroom Temp Sensor": refresh]
[app:2442] (http://10.100.11.110/logs/past#app2442)2019-10-27 10:09:04.088 pm [warn] (http://10.100.11.110/installedapp/configure/2442)The device [Family Room Temp Sensor] does not support the command refresh.
[app:2442] (http://10.100.11.110/logs/past#app2442)2019-10-27 10:09:04.086 pm [info] (http://10.100.11.110/installedapp/configure/2442)Received command from server: ["Family Room Temp Sensor": refresh]
Stub Driver:
/*
*/
metadata
{
definition(name: "HubConnect Xiaomi Temp Humidity Sensor", namespace: "shackrat", author: "Steve White", importUrl: "https://raw.githubusercontent.com/HubitatCommunity/HubConnect/master/UniversalDrivers/HubConnect-TempHumidSensor.groovy")
{
capability "Battery"
capability "RelativeHumidityMeasurement"
capability "Sensor"
capability "PressureMeasurement"
capability "Temperature Measurement"
attribute "version", "string"
command "sync"
}
}
/*
installed
Doesn't do much other than call initialize().
*/
def installed()
{
initialize()
}
/*
updated
Doesn't do much other than call initialize().
*/
def updated()
{
initialize()
}
/*
initialize
Doesn't do much other than call refresh().
*/
def initialize()
{
refresh()
}
/*
parse
In a virtual world this should never be called.
*/
def parse(String description)
{
log.trace "Msg: Description is $description"
}
/*
refresh
Refreshes the device by requesting an update from the client hub.
*/
def refresh()
{
// The server will update status
parent.sendDeviceEvent(device.deviceNetworkId, "refresh")
}
/*
sync
Synchronizes the device details with the parent.
*/
def sync()
{
// The server will respond with updated status and details
parent.syncDevice(device.deviceNetworkId, "temperature")
sendEvent([name: "version", value: "v${driverVersion.major}.${driverVersion.minor}.${driverVersion.build}"])
}
def getDriverVersion() {[platform: "Universal", major: 1, minor: 1, build: 1]}
Custom Driver:
I'm actually on the 10/23 release still, not sure if you want me to test on the updates from today.