Node-RED nodes for hubitat

Even easier...

1 Like

Works perfectly!!

Screen Shot 2021-01-30 at 8.50.04 AM

5 Likes

Okay, should have the full hub object here. Haven't tested the subscription to the hub restart but the code is there...

https://raw.githubusercontent.com/thebearmay/hubitat/main/hubInfo.groovy

5 Likes

I will update the driver and check it out. In the meantime, I modified my Nodered HE download/backup flow to now include the FW version.

Thanks so much for this... :pray:t3:

3 Likes

Quick question - is there any difference between hubVersion and firmwareVersionString? I'm currently using hubVersion...

No difference I just left it in in case someone had already coded against it. The longer name is the actual hub property name

1 Like

Really strange - I'm no longer seeing firmwareVersionString in Current States and it is not available in the selection list of attributes in the Nodered device node... :astonished:


It needs to be added as an attribute in the driver code.

just add a line like this in the driver code by the other attribute lines:
attribute "firmwareVersionString", "string"

OOOPS. Thought I had in there. In now.

It was there when I took a previous screen shot (few posts above) but then it disappeared!

Looks like @thebearmay fixed it now😀

Yeah, if you don’t declare the attribute it sticks around for a little while but then goes away.

1 Like

I made a small update to the driver this morning to fix a problem where it was grabbing the version number before the hub had updated completely on a restart. Also added some more of the Location object properties.

5 Likes

I've trawled through this lengthy thread and have checked my setup against the gotchas but I can't see what I may have missed.

NodeRed confirms that my starting endpoint is /hubitat/webhook

For two devices that I've shared via MakerAPI, these are initialised.

1 Feb 09:22:13 - [info] [hubitat mode:91ece064.2d241] Initialized. mode: Day
1 Feb 09:22:13 - [info] [hubitat device:bacb9701.1e7d78] Initialized. switch: on

URL to send device events to by POST
http://raspberrypi.local:1880/hubitat/webhook

The switch above is a simple virtual switch. On initialisation/deployment, it correctly shows the state, in this example "on". If I change the switch state within HE on the virtual device to "off", I was expecting the status to update within NR. It doesn't.

What have I missed? Should there be an "event" that captures this change? Has anyone got a NR example? I've followed the video example (substituting a motion sensor for a switch) but still no joy.

Thanks

** UPDATE ** Typical.... 5mins after posting the above, I substitute the domain name for an IP address within Maker API and BINGO, it all starts working!!! :slight_smile:

5 Likes

If your node-red is available through a domain name (and you have a local DNS) , then you can add a DNS in HE (Settings-> network)
This is what I'm doing for my setup

3 Likes

You'd think raspberrypi.local would work... clearly not. I'm not doing anything fancy network wise... I'll stick to using IP for now - safer! :astonished:

1 Like

How about just http://ipaddress:1880/hubitat/webhook. it works for me? Mine looks like this?

http://192.168.1.???:1880/hubitat/webhook_

Yes using the IP works fine... :+1:

Glad you got it working.

1 Like

Thanks to these nodes I have gone deep into the NR rabbit hole. I just posted on their forum about a dashboard that I have created with devices via Hubitat, Zigbee2MQTT, Hombridge, Harmony NR node. The post is at:

But here is what each tab looks like:






image

6 Likes

@fblackburn

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:

  1. 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?

  2. 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")
}