Jump to content

MY project Using NODE-RED to make ISY push variables to Raspberry Pi and run Python Script


johnstonf

Recommended Posts

I did a video of my installation/upgrade of Node-Red and posted on YouTube.

(just something i would have myself loved to be able to watch before diving in...)

Thanks to [mention=1781]fahrer16[/mention] for pointing me to Node-Red and writing the ISY library.

It works great once you get it connected)

I have attached the link to the video so you can follow along.

It's not perfect, and is just for "getting started" so you can continue yourself.

Now i can have events ANNOUNCED instead of ding-dongs from my AEOTEC Doorbell lol.

(I'm still running ISY FIRMWARE 4.6.2, and it works great)

This link is below, but also here... 

 in case you just want the link to copy/paste. (Just add the colon yourself after https)

Fred

 

 

 

 

 

 

 

Link to comment

That's great, @johnstonf I'm glad you've liked the node-red integration so far and thanks for sharing your project and making a video!  Most of the weirdness around getting it to work for the first node is due to a catch-22.  Node-Red needs to have credentials defined and deploy to start the code to get the lists of devices, variables, etc.. from the ISY but you can't deploy a node until the device/variable is selected. 

If I can find some free time I'll try to add some more feedback to help make the initial deployment a little more intuitive.  I also started making another node that would act as a custom-defined node inside of the ISY (kind of like a quick and dirty polyglot node that can be built in a few seconds).  Finding time seems to be the limiting factor, unfortunately!

 

Link to comment
  • 2 weeks later...

I was trying to figure out why i was getting an "echo" when playing audio using Node-Red.  It turns out, i just connected one ISY variable to a debug node, and it is spitting out, not ONE, but SEVEN instances for every ONE variable changes from ISY!  Do you know why this would be?   Should i be handling this programatically, or is the driver / library needing tweeking?

Also 
@fahrer16?

See attached screenshot...

 

 

 

 

 

 

Screen Shot 2018-03-04 at 5.45.40 PM.png

Link to comment
19 minutes ago, johnstonf said:

I was trying to figure out why i was getting an "echo" when playing audio using Node-Red.  It turns out, i just connected one ISY variable to a debug node, and it is spitting out, not ONE, but SEVEN instances for every ONE variable changes from ISY!  Do you know why this would be?   Should i be handling this programatically, or is the driver / library needing tweeking?

Also 
@fahrer16?

See attached screenshot...

 

 

 

 

 

 

Screen Shot 2018-03-04 at 5.45.40 PM.png

I threw an rbe function (RBE=Report By Exception) in the middle of the other nodes, and now it reports properly... so that may be a fix... should this fix be needed?

Screen Shot 2018-03-04 at 6.27.21 PM.png

Link to comment
18 hours ago, fahrer16 said:

The Node-Red implementation will kick an event off if anything on the variable changes.  If you set your debug node to view the complete message you'll see more than just the variable value, which might have something else that changed.

So today, oddly, it's only firing off TWO events for each time the variable changes.  The _msgid is different each time, so i guess they ISY is firing the event off twice (safety measure??).  However, that wouid still be same problem, and the rbe function works great to only act on the FIRST one (doesn't refire until the payload CHANGES, so that works nicely).  Probably good to have this safety built in on Node-Red end anyways, in case ISY starts sending a whole pile.

 

 

 

 

 

 

Link to comment

You may be getting one from the value changing and one from the update of the the timestamp.

<eventInfo>
    <var type="2" id="9">
      <prec>0</prec>
      <val>1</val>
      <ts>20180306 13:45:15</ts>
    </var>
  </eventInfo>
</Event>

<eventInfo>[VAR  2    9 ]       1</eventInfo>
</Event>

 

Link to comment
  • 3 months later...

Thanks, yes, Node-red is on the pi and is free.

What I meant, is the ISY network module on the ISY944i needed to communicate with node-red?

I have tried the example that fahrer16 provided on his github wiki.

My hub and devices are there in node-red and I don't have the ISY944i network module network module.

So, I guess that answers the question...:

But, I always get the error in the node-red payload: Error parsing ISY websocket message: cannot read property 'val' of undefined.

 

 

 

Link to comment
Thanks, yes, Node-red is on the pi and is free.
What I meant, is the ISY network module on the ISY944i needed to communicate with node-red?
I have tried the example that fahrer16 provided on his github wiki.
My hub and devices are there in node-red and I don't have the ISY944i network module network module.
So, I guess that answers the question...:
But, I always get the error in the node-red payload: Error parsing ISY websocket message: cannot read property 'val' of undefined.
 
 

 

yes, you'll need the license... if the isy sends out, license needed... i ran for about a year with brultech em and the isy was happy to RECEIVE data w/o a license, but i was happy to finally buy a license just to support the cause, as the isy is a fantastic piece of work!




Sent from my SM-N910W8 using Tapatalk

Link to comment

I don't have a problem getting a license.

But, I'd like to understand what happening without it.

I just saw a "Maximum subscribers reached" error when I launched the UDI Admin console from a different PC.

After power cycling the ISY944 I was able to get a websocket to connect. But, as soon as I added a device node in node-red I got the error mentioned above and then the flow just attempts to connect to the ISY944 every 2 seconds. (And, apparently doesn't unsubscribe the socket, and sends the ISY944 to max subscribers error.)

Is this caused because the ISY944 doesn't have the network option and can't respond to the device set request?

 

 

Link to comment

Hey @Michel Kohanim any idea where the YouTube link went?  (Does this happen to all my hard work on YouTube videos?)

Looks like it got scraped!

Here it is again for you @drmacro... gettiing node-red connected FIRST time can be WEIRD... just keep at it...

Watch the video... it may help...

Fred

 

 

Link to comment
Ok, so I got the network module for the ISY944.
I can now control devices.
But, it still get the the "cannot read property 'val' of undefined" when it opens the websocket...
 
try watching the video, i posted my link again

Sent from my SM-N910W8 using Tapatalk

Link to comment

As you note, the link seems to be missing...but, I did find it on youtube. And I've watched it...twice, maybe more. I could have missed something though, the video is pretty small for old eyes. ;)

I'm am able to control devices, so it must be connected, right? The error doesn't seem to stop that, it just throw's that error each time it connects.

I assume something is different in the payload string. I checked the firmware on the ISY944 and it is the same you have.

 

Link to comment
14 hours ago, drmacro said:

As you note, the link seems to be missing...but, I did find it on youtube. And I've watched it...twice, maybe more. I could have missed something though, the video is pretty small for old eyes. ;)

I'm am able to control devices, so it must be connected, right? The error doesn't seem to stop that, it just throw's that error each time it connects.

I assume something is different in the payload string. I checked the firmware on the ISY944 and it is the same you have.

 

send a screenshot of your nod-red layout, and the error, showing in debug tab...

Link to comment

In fact, after going through your video frame by frame, the same error message can be seen at 23:04.

At first I wondered if this was just the ISY Websocket node, but, it happens for the web socket, device, and variables nodes.

Yet, it still connects and gets/sets values/devices.

It appears to be something with the return from the actual socket subscribe.

 

Screenshot_2018-07-04_11-02-12.png

Link to comment

ok, that's a screenshot from MY video lol... i need to see yours...

In fact, after going through your video frame by frame, the same error message can be seen at 23:04.
At first I wondered if this was just the ISY Websocket node, but, it happens for the web socket, device, and variables nodes.
Yet, it still connects and gets/sets values/devices.
It appears to be something with the return from the actual socket subscribe.
 
Screenshot_2018-07-04_11-02-12.png.eb84b3079ef1f434e9af657e0b384a92.png


Sent from my SM-N910W8 using Tapatalk

Link to comment
Hello [mention=7355]johnstonf[/mention],
I am so sorry but not sure which link you are referring to. We do NOT ever delete any posts with the exception of spammers. And you are not one.
With kind regards,
Michel
Hi Michel, the very first post in this thread had both a YouTube link AND a link without the https part, and the next (second) post was a response from someone who watched it.

At some point BOTH of those links got removed from the first post. They are now not there.

Any ideas why?

(I do these videos to support you guys, as you are aware, and i know you didn't purposefully remove the links, so just wondering how it happened)

Thanks @Michel

Sent from my SM-N910W8 using Tapatalk

Link to comment
1 hour ago, johnstonf said:

ok, that's a screenshot from MY video lol... i need to see yours...
 

 


Sent from my SM-N910W8 using Tapatalk
 

 

Yes, and the debug window from mine displays the exact same message.

I'm not near the thing at the moment but, I can screen shot mine tomorrow.

Link to comment

if you remove/delete the wire from the variable to the script and try it, does the error go away?

If so, i suspect it's just not seeing the Python script... might be a permissions thing...
(or not pointing correctly, as i had when the folders/files didn't exist yet, as in the video)
Go to your /batch folder, and "sudo chmod 777" on it and the BuddyISY folder...
And make sure your folders and scripts are named properly...
See if that helps...

Link to comment

Well, deleting any/all ISY nodes does not make it go away and it still connects a web socket to the ISY944.

The node red console window last few lines shows AFTER the flow is deployed.

Note there are no ISY nodes, of any kind, in the flow.

 

I poked around in the "Manage palette" and noticed that there is a way to disable nodes. But, it says the isy-controller is in use and won't allow it to be disabled.

In the config tab of the dashboard sidebar, it shows the isy-controller on all flows and unused.

So, it appears, isy-controller is there even though I'm not using it.

Is this something I've done accidentally?

NR_console.png

NR_tab.png

Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...