bluelinky icon indicating copy to clipboard operation
bluelinky copied to clipboard

TypeError: Cannot read properties of undefined (reading 'login')

Open rboeije1 opened this issue 4 months ago • 7 comments

Describe the bug I updated bluelinkey in node-red from 0.0.30 to 0.0.32. I had to restart node-red to activate some upgraded modules, including BlueLinkey. (That was because every other day or so, it dit not get any data from the vehicle, until I changed the language in de node and it worked for a short while. The Get Status node had the green dot. But I think I solved that by adding a login node that ires every 10 minutes.) I t was not the right moment to restart node-red, so I waited some time and today I restarted NR from the command prompt. (Normally it starts with the server reboot.) It crashed with this message: [error] TypeError: Cannot read properties of undefined (reading 'login') at Login._inputCallback (C:\Users\XXX.node-red\node_modules\node-red-contrib-bluelinky\bluelinky.js:503:14) at C:\Users\XXX\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\nodes\Node.js:210:26 at Object.trigger (C:\Users\XXX\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\util\lib\hooks.js:166:13) at Login.Node._emitInput (C:\Users\XXX\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\nodes\Node.js:202:11) at Login.Node.emit (C:\Users\XXX\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\nodes\Node.js:186:25) at Login.Node.receive (C:\Users\XXX\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\nodes\Node.js:485:10) at Immediate. (C:\Users\XXX\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\flows\Flow.js:831:52) at processImmediate (node:internal/timers:476:21)

Usefull info(please complete the following information):

  • OS: Windows Server 2019
  • Bluelinky Version 0.0.32
  • Region: EU
  • Brand: hyundai
  • Node-red version 3.0.2
  • Node.js version 18.16.0

Additional context As I use it to get the SOC of the car, the login is started at NR starup, so I could not edit the flow. I commented the line in error for the moment. Bluelinkey fails, but does not crash node-red.

function Login(config) { RED.nodes.createNode(this, config); this.bluelinkyConfig = RED.nodes.getNode(config.bluelinky); this.on('input', async function (msg) { State.emit('changed', { fill: 'grey', shape: 'ring', text: 'Logging in...' }); //client.login(); <== line with error }); }

rboeije1 avatar Aug 02 '25 13:08 rboeije1

Hey, I also figured out same messages. I did an update after having EU connection issue .

` 5 Aug 13:25:07 - [info] Node-RED version: v4.1.0 5 Aug 13:25:07 - [info] Node.js version: v20.19.4 5 Aug 13:25:07 - [info] Linux 6.12.34+rpt-rpi-2712 arm64 LE 5 Aug 13:25:07 - [info] Loading palette nodes 5 Aug 13:25:08 - [info] Settings file : /data/settings.js 5 Aug 13:25:08 - [info] Context store : 'default' [module=memory] 5 Aug 13:25:08 - [info] User directory : /data 5 Aug 13:25:08 - [warn] Projects disabled : editorTheme.projects.enabled=false 5 Aug 13:25:08 - [info] Flows file : /data/flows.json 5 Aug 13:25:08 - [info] Server now running at http://127.0.0.1:1880/

5 Aug 13:25:08 - [info] Starting flows 5 Aug 13:25:08 - [error] [bluelinky:452a3304.58c8fc] TypeError: BlueLinky is not a constructor 5 Aug 13:25:08 - [error] [car-status:15dfb508.c6497b] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [car-odometer:87abdd88.8ff4d] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [car-location:bea1d927.0f3908] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [start-car:c5ecf76c.e753c8] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [start-charge:6eebc52c.ee23dc] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [stop-charge:84a1ae.74912e5] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [stop-car:7d3ae860.d8c9a8] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [car-fullstatus:4375fbb9.00fb44] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [set-chargetargets:aa4d220b.f7e19] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [lock-car:5f9ff828080f5fe6] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [unlock-car:99f5c3a41ac3e754] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [get-monthlyreport:dd23108ce63f456d] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [get-tripinfo:95f1b6f32aafd65b] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [set-chargetargets:b1fa27dba265fbc6] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [car-status:a8ef6bf427977b0f] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [error] [car-status:525a103a71fcebaa] TypeError: Cannot read properties of null (reading 'status') 5 Aug 13:25:08 - [info] Started flows `

{"__enc__":true,"type":"error","data":{"name":"TypeError","message":"Cannot read properties of null (reading 'status')","stack":"TypeError: Cannot read properties of null (reading 'status')\n at new StartCharge (/data/node_modules/node-red-contrib-bluelinky/bluelinky.js:105:38)\n at Object.createNode (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/util.js:211:27)\n at Flow.start (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:261:54)\n at Object.start [as startFlows] (/usr/src/node-red/node_modules/@node-red/runtime/lib/flows/index.js:403:17)"}}

Best regards Christian

cheick66 avatar Aug 05 '25 11:08 cheick66

I am not sure where the issue is. In the new version of bluelinky or in the node-red module that relies on it. (I found out that the node-red node relies on this code and is a separate module after I posted this bug.) When I upgraded and restarted node-red, another error poped up, but seems to be related to this one. It is on https://github.com/SondreNjaastad/node-red-contrib-bluelinky/issues/100

rboeije1 avatar Aug 05 '25 19:08 rboeije1

Hey, I was able to fix this issue by following the update process. https://github.com/SondreNjaastad/node-red-contrib-bluelinky#what-to-do-when-bluelinky-is-updated

Now I've still that issue with this error error: @EuropeController.login: sign in with EuropeanBrandAuthStrategy failed with error HTTPError: Response code 401 (Unauthorized)

Bluelinky is on version 0.0.32

cheick66 avatar Aug 06 '25 12:08 cheick66

I also followed the detailed procedure and guess what: It worked! So the trick seems to be to really remove the flow, the configuration node, uninstall contrib-node-red-bluelinky and then restart node-red. I just updated bluelinky manually and next updated the node-red node (I think). One note: The first time I imported and tried to deploy, I got errors on all my change nodes. (Red triangle) Even if I inserted a new one I was not able to configure one. I closed the editor, reopened, imported again and could deploy without any issue. It immediately worked. Note for @cheick66 : I also use the EU-option, I have a Hyundai Kona. Maybe to do with the move to the general kia/hyundai account? Another thing that surprised me that it remembered the credentials, while if you export/import mqtt for example, you have to re-enter them. I looked into the json export and all credentials for bluelinky are in plain text! Jus as a warning. [I leave it open for a short while so @cheick66 can comment to solve his issue.]

rboeije1 avatar Aug 07 '25 08:08 rboeije1

Hey, my connection issue with bluelinky is still on error. Other message issues from my update of node-red 4.1.0 and bluelinky 0.0.32 are okay now.

In my other post there is a link to another project, where they have a change in the connection server to fix the error: @EuropeController.login: sign in with EuropeanBrandAuthStrategy failed with error HTTPError: Response code 401 (Unauthorized) issue. I think for bluelinky 0.0.32 we have to do the same, but I'm only an advanced end user ;-)

cheick66 avatar Aug 07 '25 09:08 cheick66

But that applies to Kia only apparently, as for Hyundai all is OK now.

rboeije1 avatar Aug 07 '25 09:08 rboeije1

Year,I didn't had a look to the source code yet, there is may be a if/then/else included.

cheick66 avatar Aug 07 '25 09:08 cheick66