dgthomson / nodered-shellrecharge

A subflow for Nodered to control Shell Recharge car charging equipment.
GNU General Public License v3.0
20 stars 7 forks source link

Poll not working #14

Closed yoannHertienne closed 1 year ago

yoannHertienne commented 1 year ago

Hello,

I updated the subflow using sr-2-20.json and now i'm getting the following error on Poll Once: {"action":"poll"}

"TypeError: Cannot read properties of undefined (reading 'evses')"

dgthomson commented 1 year ago

something's changing at their end and i'm not sure what it is, but i have a theory.

can you send the full debug output from msg.payload = {"action":"setup"}

if you're up for fiddling, can you open up the subflow and look for the section 'ƒ POLL [2023-04-15]'. the first function node there, there's a line in the code...

msg.payload = msg.payload.chargePoints[msg.shellrecharge.cid].evses[0].status;

try changing the number in square brackets '...evses[1]...' etc

yoannHertienne commented 1 year ago

@dgthomson : please find the debug output for {"action":"setup"}:

image

FYI: I remove the RFID, because my physical card was not working. New one has been ordered, maybe it can be the cause.

yoannHertienne commented 1 year ago

@dgthomson I found the issue. When I change msg.payload = msg.payload.chargePoints[msg.shellrecharge.cid].evses[0].status; to msg.payload = msg.payload.chargePoints[0].evses[0].status; it's working, so not sure what is the value of msg.shellrecharge.cid

dgthomson commented 1 year ago

msg.shellrecharge.cid is set from the subflow properties as 'Charger ID'...

subflow properties

If you have 'Charger ID' as 0 then that'd be the same as msg.payload = msg.payload.chargePoints[0].evses[0].status

yoannHertienne commented 1 year ago

Ok my bad, I was still using the full object instead of the ID 0.