I've run into an issue with the device node not properly updating when a device attribute is changed. The issue could be the Hubitat virtual driver that I wrote (probably) or with the device node, Anyway here's the problem:
I created a device with a virtual temperature & humidity driver. The device node receives updates to both temperature and humidity when the device in Hubitat is changed.
If I change the driver of this device to a new virtual driver that has temperature, humidity, and dewpoint (added as an attribute), then updates to temperature/humidity are seen by the device node just fine. But no updates to the dewpoint attribute are received/shown by the device node.
On the other hand, if I create a brand-new virtual device with the same virtual driver (temp/hum/dewpoint), then updates to all three made on the Hubitat side are received by the device node. Also, if I remove the device from MakerAPI, and then add it back, then updates to all three are received.
Couple questions:
-
Is this expected behavior? Meaning once a device is created with a set of capabilities/attributes, then the device node will ignore any new capabilities/attributes added later via driver change?
-
Have I configured my Node-RED incorrectly? To clarify, when the new driver (temp/hum/dp) is used on the existing virtual device, temperature and humidity updates continue to be received - so there's issue with the MakerAPI config.
I've attached the virtual device driver below, in case the issue is with an incorrect driver:
metadata {
definition (name: "Virtual Temperature/Humidity/Dewpoint Sensor", namespace: "aaa", author: "Ashok Aiyar") {
capability "Sensor"
capability "Relative Humidity Measurement"
capability "Temperature Measurement"
command "setRelativeHumidity", ["Number"]
command "setTemperature", ["Number"]
command "setDewpoint", ["Number"]
attribute "dewpoint", "number"
}
preferences {
input name: "txtEnable", type: "bool", title: "Enable descriptionText logging", defaultValue: true
}
}
def installed() {
setRelativeHumidity(50)
setTemperature(70)
setDewpoint(50)
}
def initialize() {
installed()
}
def updated() {
installed()
}
def setRelativeHumidity(rh) {
def descriptionText = "${device.displayName} Relative Humidity is ${rh}%"
if (txtEnable) log.info "${descriptionText}"
sendEvent(name: "humidity", value: rh, descriptionText: descriptionText, unit: "RH%")
}
def setTemperature(temp) {
def descriptionText = "${device.displayName} Temperature is ${temp}°F"
if (txtEnable) log.info "${descriptionText}"
sendEvent(name: "temperature", value: temp, descriptionText: descriptionText, unit: "°F")
}
def setDewpoint(dp) {
def descriptionText = "${device.displayName} Dewpoint is ${dp}°F"
if (txtEnable) log.info "${descriptionText}"
sendEvent(name: "dewpoint", value: dp, descriptionText: descriptionText, unit: "°F")
}