Node-RED nodes for hubitat

Yeah, that could do it. I forget about that since I always run node-red in docker containers.

Is there an easy way to display the contents of a global variable hubStatus like in my flow below? For debugging purposes.

You can look at it in the dubug window, then change to context data.

Sorry I was tying that while in the drive through. On the side bar panel there is a "Context" tab. You can use that to see context variables. Built in to the interface, no add-on required.

2 Likes

I use node-red-contrib-contextbrowser to view at all my variables.

1 Like

Next question... is it possible to change/inject a value to that GV from outside NR? For example, hitting an internal NR flow that serves as an endpoint?

Interesting question. When I want to do that I use my MQTT server (write value to MQTT, and have that update the variable in a flow).

Might be a way to do it more directly, but I've never looked/tried. A quick Google search didn't turn up an obvious way to do it, though.

Could write it to a flat file and read in the file I guess.

EDIT: Oh, you could likely use an HTTP-in node, too. That might be easy. Set it up to listen for POST events, and send a properly formed POST message to node-red.

EDIT 2: Yup, here you go:
https://cookbook.nodered.org/http/post-raw-data-to-a-flow

2 Likes

I will read up on that. Thanks, I'm trying to make webCoRE talk to my NR :slight_smile:

Edit: It worked, Thank you!

Yes, I use a few HTTP-in nodes. This was before the HE integration nodes we have now. I called the end points from Hubitat.


(Port no longer works, rule is paused)

image

Anyone please able to help me with this?

I have a pretty funky dashboard which has one flow that is a camera feed (front house). I duplicated it to have a second flow (back yard). But the duplicate flow just overwrites the first flow's feed. Instead of getting 2 camera feeds in the dash, I have 2 spots for camera feeds, but the feed only ever is displayed on one.

This (below) correctly displays the feed (but only 1). The inject node just has msg.payload = http:feed

image

This is the code in the template node.

Is there something simple to change so that I can have both feeds on the dashboard?

Here is the code for the template node:

Summary

[{"id":"c0fb20b7.f3b1d","type":"ui_template","z":"8c249630.076968","group":"8535c82a.b39408","name":"Live View Front","order":1,"width":9,"height":13,"format":"\n\n\nimg {\n border: 1px solid #ddd;\n border-radius: 8px;\n padding: 2px;\n width: 440px;\n }\n\n\n<script type="text/javascript">\nscope.$watch('msg', function(msg) {\n inMessage(msg.payload);\n});\n\nfunction selectCam(url) {\n document.getElementById('cX').src = url;\n}\n\nfunction inMessage(event) {\n if (event.match('http://')) {\n selectCam(event);\n }\n}\n\n\n\n\n \n \t\t<td style="text-align: center"><img src="" id="cX" />\n \n

\n\n","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":400,"y":1120,"wires":[[]]},{"id":"8535c82a.b39408","type":"ui_group","z":"","name":"Camera - Front","tab":"1862e313.45ffad","order":9,"disp":true,"width":"9","collapse":false},{"id":"1862e313.45ffad","type":"ui_tab","z":"","name":"Mike","icon":"dashboard","disabled":false,"hidden":false}]

Edit: Yes, both template nodes are on different "Groups" in the dash. And I've tried on different pages/flows of Node Red.

Your img element has the same "id" which is "cX"... maybe thats it? For a test change it to something else on your second sequence.

Hi guys, new to the world of hubitat. Im in the process of leaving Home Assistant and moving over to HE before I get in too deep.
I have quite a few things set up in Node red and would like to keep that part.
I have installed the nodes, set up the server and maker Api.
I can control devices and turn them on and off, i can get the mode by sending a true via inject node and it updates fine.
The issue I have is with the Device node. It wont update itself. Example.. I go to dashboard and turn switch on. got back to NR and no change. If I then go into node settings and change something and re-deploy it then will update with status.
Any Ideas?

Simon

Make sure you have

  • "Include location events to be sent by POST?" checked in the Maker API settings
  • in NR in the HE config node make sure you have your webhook configuration set properly it needs to point to the Node RED instance not the HE address.
  • Do not use Websocket at least at first.

Something like this...

Thanks,
Yes post is set.
address is set correctly I hope :slight_smile:
websocket not set
I cant post images at the mo.
It works after I re-deploy it in NR

That is a classic webhook issue symptom... so I would def start there.

does it like https://

What does your Maker config "URL to send device events to by POST" look like?

I dunno actually, have not tried that yet but I think there is no reason why not. Maybe a cert issue but you would have other issues probably..

teamhc-dot-duckdns-dot-org colon 1880/hubitat/webhook_

Im using the NR that was part of the HA setup. I think I might redo the whole thing. Backup-reinstall and see how that goes.