Node-RED nodes for hubitat

Thank you
To clarify (or add more confusion :laughing:), you do not need to fill this section (URL) in HE

It's exactly what the button Configure webhook on Node-RED does. It set the URL to the one configured in the Webhook configure section. So if you enter it in the Hubitat Maker API, then you do not need to click on the button Configure webhook.

Edit: I link your post in the OP :+1:

2 Likes

I improved the error message to specify the reason. In your case you will see
Screenshot from 2020-04-16 17-11-34
It will be available in the next version :wink: (commit)

4 Likes

I asked a support question about the output of the Maker API (because it ends up coming through as output from the NR hubitat device node):

I don't want to rehash the whole question here, but I did what to ask if anyone has built something in NR that turns what the Maker API calls a JSON_Object into actual JSON. I did the conversion by hand in that other topic and can imagine building a really complex parsing conversion function node, but I am hoping that someone else has already invented that wheel.

To be clear the device node is doing exactly what I would expect it to, but the Maker API is labelling something that I don't think is JSON as JSON, but I want the data that would be easy to get to if it were actually JSON.

I'm sure this is something insanely simple I have somehow manage to overlook or avoid dealing with until now, and has likely already been answered so please forgive me.

When using the command node to control google minis for TTS all spaces are being replaced with %20 so you have the voice literally saying percent twenty between every word. How do I prevent this? I've already tried replacing and wrapping with " ' \ / _ etc to no avail
Also the playtrack command fails (with a known and tested good mp3 file) so i assume its replacing slashes as well.

It is insanely simple. It doesn't work. :grinning:

Instead use a Cast node. Node-red-contrib-cast

It will play mp3s. My family has to hear Darth say "I am your father" every time I enter house geofence.

EDIT; It's a shortcoming with Maker API, not the Hubitat Nodes.

2 Likes

There is an feature request here to support it.
I also added the link in the OP in the Feedback about Maker API

1 Like

Ok and thank you.

I already knew about and used the cast node when i couldn't get this to work, was just feeling stupid because i couldn't get it to work through the HE node when i had it working fine inside HE prior.

Good Idea, hopefully that will save others some headaches in the future.

Yuck... installing a palette to do something so simple as a string conversion? A function node or a change node using JSONata (`$replace() function) seemingly would be much more efficient

1 Like

I've created myself an odd issue in Node Red. I don't quite know how I did it but I managed to delete my Sonos Flow Tab. I was deleting some test tabs yesterday and must have deleted this as well by mistake. I only noticed when it stopped working today and I went to check what was happening and couldn't find it. Oddly when I searched for "sonos" devices in the flow search, it listed some nodes but no tab next to them and when I clicked on them it didn't do anything.

I have now restored it from a backup up file but now when I search the palette for Sonos devices there are 2 instances of the nodes and 1 of them seems to be an orphan that I can't access. It doesn't seem to be causing an issue but I'd rather tidy it up if I can. I have restarted Node Red but that hasn't helped.

Any ideas? Thanks.

Sonos

Maybe uninstall the palette then do a restore again? Also do you have duplicate configs?

One of the duplicates is a Hubitat remote though (not shown on the image above, it is further down the list) so I don't really want to uninstall the Hubitat palette as that will effect all other flows.

Do you have a full backup? I thought you were restoring from that otherwise yeah I get your point.

No. It seems to be just the nodes that have been duplicated. The Sonos Palette Nodes and the Hubitat Remote Device Node that I use to control it.

So you might have to check out the your flow json file..

.node_red/flows_xxxxxxx.json

Maybe the old nodes are in there and can be manually edited (then restart NR). Make a backup copy of any file you mess with first though!!!!

1 Like

Thank you, that worked. :+1:

I removed my Sonos flow again (having exported a backup) so I didn't confuse the current Sonos nodes with the "orphaned" ones. I then looked at the .node_red/flows_raspberrypi.flows.json file. I found the references to the 3 "orphaned" Sonos nodes and deleted them. Renamed the original to .old and copied the editted file to the original name. On restart NR popped up a message to say something had changed compared to server but that it was OK to merge. I checked the details and it showed the correct 3 deleted nodes. I merged and the "orphaned" nodes where gone. Imported the Sonos Flow and I'm all good again.

Was a bit scary as I haven't delved that deep into the system before, but thanks for the heads-up on where to look. Goodness knows how I managed to screw it up like that, but hopefully it's a one off.

2 Likes

I'm trying to program an function so that I can send a message to the sono app to play a message that the door is open or closed. I get it to play but it plays the same message over and over? Here is my function node code? Any suggestion and thanks for the help.

image

The "else" looks a little screwy - also isn't it payload.value?

if (msg.payload.value === "open"){
     msg.payload = "The Front Door Is Open";
} else if (msg.payload.value === "closed") {
     msg.payload = "The Front Door Is Closed";
}

or just get rid of the "if" conditional of the "else if" and make it an "else"

2 Likes

Can't say for certain why it repeats, since we can't see the whole flow. But as @erktrek says, the else part is wonky. Can't have two sets of braces like that... I'm not even sure I understand exactly what you were going for there (maybe explain in more detail?).

EDIT: Ohhh... I think I get it now, based on erktrek's posted code. I didn't recognize that as an else-if.... :+1:

1 Like

@leeonestop
Alternatively, replace your function node with a switch node and two change nodes.

2 Likes

Do u have a device node with Send Events box checked prior to this function node by chance? That could cause a repeat in some cases. That little box has caused me more headache than anything else.

1 Like