hardillb / node-red-contrib-flic-buttons

17 stars 9 forks source link

TypeError: Cannot read property 'flicClients' of undefined #5

Closed ianmen closed 7 years ago

ianmen commented 7 years ago

Hi,

First of all I want to thank you for this great add-on to Node-Red I like Flic and I like Node-Red so this is the perfect combo!

I got the deamon running and can add the Flic nodes on my flow in Node-Red. However, I'm getting below error message in the debug. Any idea what this could be? Thanks in advance!

TypeError: Cannot read property 'flicClients' of undefined TypeError: Cannot read property 'address' of null

Screenshot: https://www.dropbox.com/s/8ottfs67j7huyby/Schermafdruk%202016-12-28%2019.39.32.png?dl=0

hardillb commented 7 years ago

@Roaders one for you

Roaders commented 7 years ago

Do you get these errors when you press the button or just when node red starts up? Does anything happen when you click the button? I'm away over the holidays so I'm not going to be able to properly look at this for a while I'm afraid.

Roaders commented 7 years ago

I've had a look at the code and I can't see why you might be getting these errors. What version of node-red are you using? It looks to me that Node-Red is working in a different way for you than it does for me and it is either not able to get the globalContext object or is not able to access the button that is setup in a config node.

Have you set up a button for the action that you are trying to use?

ianmen commented 7 years ago

Indeed the issue was in the globalContext definition, I now changed this to (flic-button.js:32):

var globalContext = global;

And this resolved my problems, I'm not sure if this will work for every environment though.

ukmoose commented 7 years ago

I had the same issue with Node-red 0.16.2 on doing a "deploy" in node-red. Fortunately @ianmen suggestion worked for me.

Roaders commented 7 years ago

PR created that should address this issue. Can you please test it @ianmen and then merge it and release it @hardillb

hardillb commented 7 years ago

@Roaders are you confident enough for me to push this now, or should I wait for some feedback from @ianmen?

Roaders commented 7 years ago

I would wait for feedback.

hardillb commented 7 years ago

@ianmen @Roaders @ukmoose Anybody want to comment on if this works so I can merge the change and close this out?