Node-Red Palette: Common Choices

I can clarify. Before doing any smarthome automation, I was an iPad/iPhone user. Some of the first smarthome devices I bought were homekit focused accessories (largely Eve products). Two types I bought were temperature sensors and a motion/presence detector. About the same time I was getting started with Hubitat, I installed several Nest Protects (wired).

As part of this evolution, I found that I could use homebridge to expose data from the Nest Protects to Homekit. I then learned that I could expose homebridge items to Hubitat and/or Node-Red. I found this was great as I could now build automations with the Nest Protect data. (As an aside, I think I found out that the wired versus battery Protects maybe do better presence sensing, but I could be wrong). I also created various virtual devices in homebridge for things that at the time seemed more supported there than Hubitat or Node-Red. I have since moved away from most of those.

What I wanted to do, however was recover the value of the Homekit only devices I had by getting their temperature reading and motion detection into Hubitat/Node-RED. Because Homekit sees itself as the center of the universe, it really doesn't have any provisions for sending its data to another program/hub/environment/etc.

I have been able to get motion data out from my homekit device by doing the following:

  1. Create a virtual switch in Homebridge
  2. Add the virtual switch to both Homekit and Hubitat/Node-RED
  3. Create an automation in Homekit, that changes the virtual switch whenever motion from my Eve device goes true or false
  4. Inside Hubitat/Node-Red treat the state of that switch, not as a switch, but as a motion detection true/false

For a binary item like motion detection, this works well. I thought about doing something similar for my 2 Homekit temperature/humidity sensors. Unfortunately, I haven't found a way take a numeric reading in homekit and put it into a virtual Homebridge device. I toyed with creating a virtual thermostat, but I stopped at the point it looked like I would have to have a separate automation rule for each temperature step and each humidity step for each temperature/humidity step within the range that I might subject them to. This was too much for the value added.

I now wonder if I can somehow use IOS shortcuts or Homekit automation to send the data via http call to Node-Red, but have other automation that I will work on first.

So back to your original ask for clarification, I just wish that in the same way I can expose Hubitat devices/states to Homebridge and vice versa, and the same between Homebridge and Node-RED and Node-Red and Hubitat, I wish there was a 2 way path for Homekit for something other than true false via a virtual switch.

2 Likes

Thanks for the great write up! I don't have any homekit devices but this certainly sheds light on that side of the equation.

I updated node red to 1.2.6 and in the process seem to have broken the Lutron node.

All the sudden I’m getting telnet errors from the Lutron node 1.0.3. I’ve tried reinstalling several times without improvement. I tried editing the files to fix the “telent” typo — no luck.

When installing from command line it still says 1.0.2 at the command line, but 1.0.3 in node red. I can’t remember if this is unchanged.

I tried rolling back node red and reinstalling without any improvement. Anyone have any ideas?

Also, there seems to be a new node for caseta. I tried installing that, but am getting the same errors there also.

Thanks

Edit: never mind. turned out to be a DNS error.

Does anyone know about that caseta node though?

Thank you for bringing this to my attention. These "new" nodes (nodered-lutron-caseta) by castanhinha1, are a direct copy of the older Caseta nodes (node-red-contrib-lutron) by sushilks.

Everything is directly copy-pasted ....

So I reported it.

1 Like

I was hoping it was a fork that would show up in the palette with 1.0.3. It’s a pain to have to do a manual install from GitHub.

I'm wondering if someone can help me with Node Red's finite state machine, which I use a lot. It's been out of date for a while, with this error:
"[RED.events] Deprecated use of "nodes-started" event from "/home/mike/.node-red/node_modules/node-red-contrib-state-machine/state-machine.js:98:20". Use "flows:started" instead."

There is a pull request with the correct change, and another helpful pull request (state based routing), and there is an un-coded request for persistant storage. I'm hoping someone might be able to clone it (is that the right lingo?), and then make the changes. Persistant storage would be great, but not essential.

The author, a fellow Aussie, has gone silent, despite requests from me and others. Here is the link

Calling @JasonJoel @fblackburn @aaiyar for help?

Not a node that I use, but I know that @bill.d does, so I am tagging him here. A while ago he posted this comprehensive flow that made use this node.

(Because I'm lazy) Without going through all 186 posts, does anyone have a palette they use for charting or graphs?

I'm looking to take energy consumption monthly data and chart it out over a 12 month period, in some semblance to a chart or graph display using node-red if this is possible?

You could use node-red Dashboard. But 12 months is potentially a lot of data. I would recommend using influxdb + grafana.

1 Like

I've contemplated setting that up on my NAS, but haven't really had the desire to learn and understand how to operate it.

Totally understand the feeling.

I'm attempting to play with this, not sure where you find the chart at though?
b1

Have you tried http://localhost:1880/ui

1 Like

Right on that's what I was looking for, now playing around to figure out how to populate it. Thanks!

1 Like

I use a MySQL database to store the data and then Nodered dashboard to pull the data and chart it.

The flow to store the data looks like:

And to pull the data and chart it:

There is a bit of a learning curve with Nodered dashboards and the chart/graph/table nodes and there are limitations (well - unless you are a CSS expert, which I am not) on what you can do with the display, but it works for what I need.

I found this out as well, spent all day trying to figure out how to populate the charts. Still no success. I ended up going the influxdb - grafana route. I at least have some charts now, still figuring out the settings in grafana.

2 Likes

I have a question - what are you guys using to do "wait until" event/conditions in NR?

Two answers, kinda.

Home Assistant has a node that has "wait until" a certain state occurs. It's pretty handy. I'm only using it for two things at present (home Assistant).

In a similar vein, yesterday I removed node-red-contrib-bool-gate because it was 4 years old, and may have been the source of my Node Red errors/crashing. I migrated a few flows to ultimate-boolean, but it's real messy, requiring lots of nodes to get the data into right format. I searched and modified some code that goes in a function node, which I've re-purposed for all my wait tasks (with multiple feeds).

Here it is. I'm no coder. Improvements welcome. Just dump it in a function node. For a wait, just remove the other two ELSE-IF's below.

context.garage1 = context.garage1 || 'closed';
context.garage2 = context.garage2 || 'inactive';

if (msg.topic === 'CS - Garage Door') {
  context.garage1 = msg.payload.value;
}
else if (msg.topic === 'CS - Garage (Hanging)') {
    context.garage2 = msg.payload.value;
}

if (context.garage1 == 'open' && context.garage2 == 'active') {
    node.status('Changing')
    global.set("garage_door", "Changing");
    return {topic: 'Garage', payload: 'Changing'}
 }
else if (context.garage1 == 'open' && context.garage2 == 'inactive') {
    node.status('Open')
    global.set("garage_door", "open");
    return {topic: 'Garage', payload: 'open'}
 } 
else if (context.garage1 == 'closed' && context.garage2 == 'inactive'){
    node.status('Closed')
    global.set("garage_door", "closed");
    return {topic: 'Garage', payload: 'closed'}
 }
1 Like

This was the only thing that came up in my search. I don't use HA so not sure it these nodes will work outside of HA (ie I'm trying to recreate in NR one of my RM rules which uses "wait until" ).

Thanks for posting - I shall have a try of it!

A stop-gap measure would be a looping switch node with a certain delay. Now this is less than ideal, due to wasting unnecessary cycles on checking over and over, but I think it is more a limitation of the base platform, i.e. needing messages to trigger an action. Because for a wait until to work, the first message would have to come in to trigger it, and then in a perfect world, a second one would come in once you have met the condition. Something, now that I think about it, you could probably do with the HE nodes and the Send Events selected on a device node and a switch node, and potentially the use of context variables to decide if you are in a "wait until" loop at the moment of checking.

2 Likes