Node-RED nodes for hubitat

The sequence below will turn on a light when a contact sensor is open between 9PM-6AM and turn it off when the contact sensor is closed. You can import it and change it as needed.

Code to import
[
{
    "id": "8de037e.53a12c8",
    "type": "hubitat device",
    "z": "cf3bcc81.2331d",
    "name": "Contact - Back Door",
    "server": "a22e0ea9.276dc8",
    "deviceId": "419",
    "attribute": "",
    "sendEvent": true,
    "x": 330,
    "y": 460,
    "wires": [
        [
            "b8b088d0.e9e328"
        ]
    ]
},
{
    "id": "b8b088d0.e9e328",
    "type": "switch",
    "z": "cf3bcc81.2331d",
    "name": "open/closed",
    "property": "payload.value",
    "propertyType": "msg",
    "rules": [
        {
            "t": "eq",
            "v": "open",
            "vt": "str"
        },
        {
            "t": "eq",
            "v": "closed",
            "vt": "str"
        }
    ],
    "checkall": "true",
    "repair": false,
    "outputs": 2,
    "x": 550,
    "y": 460,
    "wires": [
        [
            "40f3e0ac.2b5e7"
        ],
        [
            "507e7281.566004"
        ]
    ]
},
{
    "id": "40f3e0ac.2b5e7",
    "type": "time-range-switch",
    "z": "cf3bcc81.2331d",
    "name": "21:00-06:00",
    "lat": "",
    "lon": "",
    "startTime": "21:00",
    "endTime": "06:00",
    "startOffset": 0,
    "endOffset": 0,
    "x": 750,
    "y": 460,
    "wires": [
        [
            "22630376.b40ae4"
        ],
        []
    ]
},
{
    "id": "507e7281.566004",
    "type": "hubitat command",
    "z": "cf3bcc81.2331d",
    "name": "Garage Tube OFF",
    "server": "662851c4.3ccad",
    "deviceId": "4200",
    "command": "off",
    "commandArgs": "",
    "x": 770,
    "y": 501,
    "wires": [
        []
    ]
},
{
    "id": "22630376.b40ae4",
    "type": "hubitat command",
    "z": "cf3bcc81.2331d",
    "name": "Garage Tube ON",
    "server": "662851c4.3ccad",
    "deviceId": "4200",
    "command": "on",
    "commandArgs": "",
    "x": 990,
    "y": 460,
    "wires": [
        []
    ]
},
{
    "id": "a22e0ea9.276dc8",
    "type": "hubitat config",
    "z": "",
    "name": "HubitatM",
    "usetls": false,
    "host": "192.168.1.46",
    "port": "80",
    "token": "496f7f11-256d-44c9-99c6-4ed460d3efb0",
    "appId": "1522",
    "nodeRedServer": "http://192.168.1.4:1880",
    "webhookPath": "/hubitat/webhook"
},
{
    "id": "662851c4.3ccad",
    "type": "hubitat config",
    "z": "",
    "name": "HubitatS",
    "usetls": false,
    "host": "192.168.1.36",
    "port": "80",
    "token": "5dee560c-c42c-4e4b-bdf7-6bed1bb77371",
    "appId": "4489",
    "nodeRedServer": "http://192.168.1.4:1880",
    "webhookPath": "/hubitat/webhook2"
}

]

2 Likes

@aaiyar Thank you so much for your help.

1 Like

I have been using flow and global context variables also to persist device attribute values, and am trying to understand the implications of this. A couple of questions..

Can anyone share what they use for an "init" pattern, i.e., grabbing the initial attribute values (at flow startup) for whatever device nodes are of interest in the flows? Is it just something real simple, like:
image
And given the info that the device node caches all current attribute values... is It correct to say that after the first device attribute read/update, there are no more queries back to Hubitat, no matter how many replicas of the same device node exist in any flow?

And also that any subsequent event from Hubitat for the device updates all of the device nodes that reference any of that device's attributes?

Yes. since the device node caches all of the attributes for the device initial startup (and then keeps them in sync via events) there is not need to do any more than that.

That's how I understand it based on @fblackburn explanation, yes.

Yes, that is also how I understand it working.

1 Like

Alexa users might find node-red-contrib-alexa-remote2 useful. It is basically a replacement for the Hubitat AlexaTTS or Echo Speaks apps.

Very versatile, and comes with node.js server, which runs locally, that automatically renews your Amazon login cookie. These are the nodes that get installed:

Alexa-remote2

3 Likes

I can't like your previous post enough. I have been looking for a way to have Alexa's status going active or playing music. I am trying to recreate this awesome project @april.brandt did:

Using her idea, I put a light sensor on Alexa so that when her ring went active, it could turn on another light. I wanted that secondary light to turn off after Alexa was done talking. HOWEVER, if I asked Alexa to play music, I wanted that secondary light to stay on. See this post for the problem:

Alexa's status was WAY TOO SLOW but using these nodes, it's instant. By sharing those nodes, you have may have sent me well on my way to success. Thank you.

2 Likes

I love this palette! I've got a Samsung button in my office here where I can cycle through Pandora stations on an Echo

2 Likes

I'll be following this thread because I set up routines to turn on a virtual switch that keeps the light on if I ask it to play music. But, that comes with custom commands as well. So mine doesn't rely on true alexa status. Although, you may be able to use that to your advantage. If alexa is playing it will eventually show playing. so you may be able to use the vs to bridge the update gap? Just a thought.

1 Like

@april.brandt If you are using Node Red and install this Alexa pallete, set the Alexa Event Node to Audoplayer State Change, it will give you PLAYING, FINISHED, or INTERRUPTED in the output MSG. If you also install @fblackburn's Hubitat Node Pallet that is the subject of this thread, you can control any HE device directly and QUICKLY!!!

1 Like

Here is a sequence I came up real quick that seems to do what I want.

The "On Device Activity" Device Node listens and if it hears Alexa, it turns Dining Room light on then turns it off 10 seconds later. If it hears Alexa Stop, it turns Dining Room light off.
The "On Audio Player State Change" Device Node listens and if "Playing" is in output payload, it turns Dining Room light on and cancels the mytimeout node which keeps the Dining Room light from turning off.

I need to keep digging because I have to imagine that the track playing is somewhere that I can dig out. I just need to find it. Then, you could have a dashboard that displays music info on it.

2 Likes

Hi @aaiyar & @stephen_nutt,

as bigtimer has got 2 on time, and 2 off time, how can I disable the 2nd on and off timer? (currently default set to 00:00 on both).
image
If i leave that as is, does it means that it will be be ignore automatically?
thx

I have never changed those 2 fields and it hasn't done anything at midnight so I believe you are correct that it gets ignored.

@stephen_nutt : got any good links/pointers on getting Alexa to listen and act on stuff? Documentation on this is super sparse/non-existent.

Nope. I just attached a debug node that gets Complete Message Object and started giving commands to Alexa. I am not getting anything out of that Node set as "On Media Progress Change", "On Media Change", "On Content Focus Change" or "One Media Queue Change". I thought one of the 1st 2 would possibly give me artist and song title. I am also disappointed you can't query them with an inject node or something.

1 Like

Yes. Also, if you have an rbe node after the bigtimer node, you can prevent sequential "on"s or "off"s being sent as consequence of the second timer triggering.

Anybody know what this might mean? How can we tell if it's enabled? If we are getting something from the devices, does that mean it's enabled or could we get more if it is enabled?

image

As @morningz mentioned, documentation is non-existent.

It's been 19 hours without a post on this thread!!! We can't have that!!!

My Ecobee has a feature that if the fan hasn't run in an hour, it will turn on fan only for 5 minutes to keep air circulating. It's a great feature this time of year when temperature inside house stays between my heating setpoint and cooling setpoint naturally.

My Z-Wave Thermostat for other part of house doesn't have that feature so I wanted to recreate with a Node Red flow. Please take a look.

It's basically a Dead Mans Switch with 55 minute countdown. It's simple but I am curious if someone might now a better way. Also, is it safe for my HVAC?

I have an associated question. If I wanted to graph the states of each thermostat, is that possible? Does the Node Red Dashboard have a way to use text values on the Y-axis vs a number or would I have to assign a value to each; possibly 0-idle; 1-pending cooling; 2-cooling etc?

Everyone is trying to find more room to store toilet paper in their house. The wife is considering repurposing my “electronics area” and we are at war :wink: [sarcasm]

4 Likes

Anyone having luck with text to speech on Sono's???

I spent most the day yesterday trying to get a Zooz switch in play in my living room so I could involve my light and fan into some rules. Found out that there was only a 14-2 wire run between the switch location and the ceiling fixture, so it was time to run a 14-3 wire,

No 12 foot step ladder to get to the fixture box on the ceiling? No problem lol, two 6 footers + a table = close enough

That was shady as heck, but what was way worse was climbing through my attic and the vaulted ceiling area, unfortunately I was like a Keystone Cop doing the install and I had to make three separate trips though said attic.

So there was no time to work on rules as I was planned but rather the "hardware" side of things.

Something still isn't right though, turning on the light part of things makes the LED lights in the fixture flicker on and off constantly. I have the same switch (ZEN30) and same bulbs in two other rooms and they work fine.

1 Like