SergiuToporjinschi / node-red-contrib-heater-controller

Heater controller for node-red dashboard
GNU General Public License v3.0
18 stars 17 forks source link

"TypeError: Cannot read property 'push' of undefined" #6

Closed cjsneevliet closed 5 years ago

cjsneevliet commented 5 years ago

wanted to try this node, but when I deploy it I get the "TypeError: Cannot read property 'push' of undefined" in the debug window

SergiuToporjinschi commented 5 years ago

Hi, Can you put here a test schema? thank you!

aaronpropst commented 5 years ago

I get the same thing. I didn't do anything special, I just dropped it into my flow and fed it a value.

It throws that exception when it is deployed in a flow. Here's my log:

nr_1  | 6 Dec 19:54:43 - [info] Starting flows
nr_1  | TypeError: RED.require is not a function
nr_1  |     at new getNode (/data/node_modules/node-red-contrib-heater-controller/heater-controller.js:8:26)
nr_1  |     at createNode (/data/node_modules/node-red/red/runtime/nodes/flows/Flow.js:305:18)
nr_1  |     at Flow.start (/data/node_modules/node-red/red/runtime/nodes/flows/Flow.js:89:35)
nr_1  |     at start (/data/node_modules/node-red/red/runtime/nodes/flows/index.js:327:29)
nr_1  |     at /data/node_modules/node-red/red/runtime/nodes/flows/index.js:164:21
nr_1  |     at tryCatchReject (/data/node_modules/when/lib/makePromise.js:845:30)
nr_1  |     at runContinuation1 (/data/node_modules/when/lib/makePromise.js:804:4)
nr_1  |     at Fulfilled.when (/data/node_modules/when/lib/makePromise.js:592:4)
nr_1  |     at Pending.run (/data/node_modules/when/lib/makePromise.js:483:13)
nr_1  |     at Scheduler._drain (/data/node_modules/when/lib/Scheduler.js:62:19)
nr_1  |     at Scheduler.drain (/data/node_modules/when/lib/Scheduler.js:27:9)
nr_1  |     at process.internalTickCallback (internal/process/next_tick.js:70:11)
nr_1  | 6 Dec 19:54:43 - [error] [heater-controller:5655f514.12025c] TypeError: Cannot read property 'push' of undefined
nr_1  | 6 Dec 19:54:43 - [info] Started flows

My NR startup:

nr_1  | Welcome to Node-RED
nr_1  | ===================
nr_1  |
nr_1  | 13 Nov 18:18:57 - [info] Node-RED version: v0.18.7
nr_1  | 13 Nov 18:18:57 - [info] Node.js  version: v11.1.0
nr_1  | 13 Nov 18:18:57 - [info] Linux 4.9.93-linuxkit-aufs x64 LE
nr_1  | 13 Nov 18:18:57 - [info] Loading palette nodes
nr_1  | 13 Nov 18:19:05 - [info] Dashboard version 2.9.6 started at /ui
nr_1  | 13 Nov 18:19:07 - [warn] ------------------------------------------------------
nr_1  | 13 Nov 18:19:07 - [warn] [node-red/rpi-gpio] Info : Ignoring Raspberry Pi specific node
nr_1  | 13 Nov 18:19:07 - [warn] ------------------------------------------------------
nr_1  | 13 Nov 18:19:07 - [info] Settings file  : /data/settings.js
nr_1  | 13 Nov 18:19:07 - [info] User directory : /data
nr_1  | 13 Nov 18:19:07 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
nr_1  | 13 Nov 18:19:07 - [info] Flows file     : /data/flows.json
nr_1  | 13 Nov 18:19:07 - [info] Server now running at http://127.0.0.1:1880/
nr_1  | 13 Nov 18:19:07 - [warn]
nr_1  |

from heater module install:

nr_1  | 6 Dec 17:37:59 - [info] Installing module: node-red-contrib-heater-controller, version: 1.0.1
nr_1  | 6 Dec 17:38:59 - [info] Installed module: node-red-contrib-heater-controller
nr_1  | 6 Dec 17:38:59 - [info] Added node types:
nr_1  | 6 Dec 17:38:59 - [info]  - node-red-contrib-heater-controller:heater-controller
nr_1  | hs: 0
aaronpropst commented 5 years ago

I updated my node-red and dashboard to the lates and now I see something different:

nr_1  | 6 Dec 21:16:36 - [info] Starting flows
nr_1  | TypeError: args[0].indexOf is not a function
nr_1  |     at Object.red._ (/data/node_modules/node-red/red/runtime/nodes/registry/loader.js:116:21)
nr_1  |     at new getNode (/data/node_modules/node-red-contrib-heater-controller/heater-controller.js:24:32)
nr_1  |     at createNode (/data/node_modules/node-red/red/runtime/nodes/flows/Flow.js:305:18)
nr_1  |     at Flow.start (/data/node_modules/node-red/red/runtime/nodes/flows/Flow.js:89:35)
nr_1  |     at start (/data/node_modules/node-red/red/runtime/nodes/flows/index.js:328:29)
nr_1  |     at /data/node_modules/node-red/red/runtime/nodes/flows/index.js:164:25
nr_1  |     at process.internalTickCallback (internal/process/next_tick.js:77:7)
SergiuToporjinschi commented 5 years ago

Hi, @aaronpropst I see, from your last comment, I think is a problem of language; do you have some other language on your browser? because my node does not have translation for other languages. just US and Romanian, :) because I'm a Romanian. I would put a new language if you fork the project and add your language. I will add also UK because is easy for me, If you want you can create a new language file in locales folder. And I will merge it. I just published a new version which should fix the an issue, I was not accepting the value as string. Now is parsing the value as float that could be also your problem. Would be very helpful if you export the node with an insert node to see how you have that configured.

SergiuToporjinschi commented 5 years ago

We both have the same node-red version but dashboard version is different. I'm using 2.12. The first error that you had it was from dashboard version "TypeError: RED.require is not a function" or node-red because require is a function in RED object ...

SergiuToporjinschi commented 5 years ago

I could reproduce your last issue.. but I don't know how. The problem is on selecting the group in your dashboard.... I will investigate more about this and I will keep you updated.

SergiuToporjinschi commented 5 years ago

So that error is thrown when you try to add a new ui node to dashboard without selecting any group. Please edit node properties and select the group/tab where you want this control to be visible. Therefore I'm closing this issue

aaronpropst commented 5 years ago

I did select a group in the control’s ui. It never showed up in the dashboard or the group’s control list with the other controls though. I assumed that was because it was crashing.

SergiuToporjinschi commented 5 years ago

No, was not visible in dashboard tab, because the name of the project was not prefixed with "ui_" I just fixed that. I could reproduce this error, same stack trace. TypeError: args[0].indexOf is not a function nr_1 | at Object.red._ (/data/node_modules/node-red/red/runtime/nodes/registry/loader.js:116:21) nr_1 | at new getNode (/data/node_modules/node-red-contrib-heater-controller/heater-controller.js:24:32) only if I was not selecting the group. but nevertheless now should be functional. Please do an update and let me know if you have any problems. Thank you!

jensfr1 commented 5 years ago

I have the same issue. Selected a group but is not showing up in the dashboard. How can I solve it?

SergiuToporjinschi commented 5 years ago

@jensfr1 What node-red , dashboard and heater versions are you using?

jensfr1 commented 5 years ago

I am using the node-red version from the openhabian image. Just recently upgraded all the components to the latest version. node-red-contrib-heater-controller 1.1.5 node-red-dashboard 2.12.2

SergiuToporjinschi commented 5 years ago

@jensfr1 try edit and select again the group, and redeploy it. Did you tried that ?

aaronpropst commented 5 years ago

I got it running with the latest version. Thanks!

SergiuToporjinschi commented 5 years ago

@aaronpropst I'm really glad to hear that :+1: I saw that you forked the project and I was waiting to see your change

aaronpropst commented 5 years ago

I was going to mess around with solving: https://github.com/SergiuToporjinschi/node-red-contrib-heater-controller/issues/7 for myself. I don't know if I'll have time to get around to doing it properly with other commitments though. I'll keep you posted over there.

thucar commented 5 years ago

I'm having this issue as well with Node-Red version 0.18.4, Dashboard version: 2.14.0 and Heater controller version: 1.2.1

After I add the node to a flow, assign all variables, including a group, it never appears on the dash and this is what I see in my debug window: TypeError: Cannot read property 'push' of undefined

trippled1993 commented 5 years ago

If someone with the same problem sees this thread:

I got the same Error TypeError: Cannot read property 'push' of undefined in my debug window, in combination with Error: Cannot find module 'node-red-dashboard' in the node-red log.

Solution: Restart your Node-Red installation after fresh install of the modules. Without a reboot the module "node-red-dashboard" was not found.

SergiuToporjinschi commented 5 years ago

@trippled1993 maybe that's the reason for which I cannot reproduce it :) i'm always restarting node red after installation of a node.