Cannot set global variable to 0

Ok, thanks.

So it is all coming from the charger. No car messages.

Can you post a message that is used while the car is charging and explain what part does/means what?
(How much power has gone into the car, is the car charged?)

I appreciate you are doing a bit of extra stuff with your solar panels, etc.

But for this example we will try to concentrate on the message ONLY for the car.
2 seconds is fine for how often.

I think I found a solution. If my global.evcharge equals payload[0].che, I set payload[0].che to 0. That now displays 0 until the value changes

1 Like

Good.

I am sorry if I wasted any of your time. But sometimes it helps to talk about it with others to help get a better understanding of what is happening.

Indeed it does. It certainly helped me simplifying my flows. Still not entirely sure it will work as intended, I have to see what happens once the car starts charging, and what happens after midnight.
I also need to think about what you said, what do I want if I charge over night, which will happen in the winter when I do not have enough power from my PV panels to charge the car, and need to use the grid power over night. I need to rething everything. I also need to grab screenshots of the debug of the charger when charging, and when not charging to see the differences
Your help and time is much appreciated

1 Like

I'm glad I could help.

Suggestion:

The debug nodes and their output.
Save them to a file for a few days.
But don't just save the messages. That makes it (sometimes) difficult to read later on.

Put them through a template node to format the message into something human readable.
Then you get a readable log file that you can go back and look at later AND understand. :wink:

I can help you with that if you want.

The midnight part shouldn't be that difficult.
We just need to discuss where/how the important values are stored.

Silly question. How do I put them through a template node ?

Well, it would help if you showed me an entire message and explain what all the parts mean.
(Copy a real one from the debug node - use the copy button, and paste it with the </> stuff)

Here is a sample message

23/08/2023, 11:27:53node: debug 175msg : Object
object
payload: array[1]
0: object
sno: xxx
dat: "23-08-2023"
tim: "10:27:52"
ectp1: 0
ectp2: 0
ectp3: 0
ectt1: "Internal Load"
ectt2: "None"
ectt3: "None"
bsm: 0
bst: 0
cmt: 254
dst: 1
div: 0
frq: 50.21
fwv: "3562S4.539"
gen: 1887
grd: 48
pha: 1
pri: 1
sta: 1
tz: 0
vol: 2455
bss: 0
lck: 16
pst: "B1"
zmo: 3
pwm: 5216
zs: 1026
rdc: 3
rac: 6
zsh: 4
zsl: 2
ectt4: "None"
ectt5: "None"
ectt6: "None"
newAppAvailable: false
newBootloaderAvailable: false
beingTamperedWith: false
batteryDischargeEnabled: false
g100LockoutState: "NONE"
mgl: 100
sbh: 17
sbk: 5
_msgid: "0c7dc120b3c1fc99"

The data I am using from this is

payload[0].gen = pv generation
payload[0].grd = power drawn from the grid
payload[0].mgl = max green level (when I use a eco setting on the charger)
payload[0].che = total charge of the ev (currently not rported as no charge so far today)
payload[0].div = pv power going into my car
payload[0].zmo = charger mode
payload[0].pst = ev mode

I think that is what I am using (so far)

I'm not sure how you got that message.

Look here (example but not quite a big message like yours)

If you click on that copy icon/button it copies the value/structure to the clipboard.
Before you do that though, expand any groups.
They are indicated by little triangles like seen just left of the object to the left of where the arrow is pointing.
Click on them and any groups.

Then copy it and paste it.
That way I will see the entire structure.
(sorry)

here you go

{"payload":[{"sno":xxx,"dat":"23-08-2023","tim":"10:27:52","ectp1":0,"ectp2":0,"ectp3":0,"ectt1":"Internal Load","ectt2":"None","ectt3":"None","bsm":0,"bst":0,"cmt":254,"dst":1,"div":0,"frq":50.21,"fwv":"3562S4.539","gen":1887,"grd":48,"pha":1,"pri":1,"sta":1,"tz":0,"vol":2455,"bss":0,"lck":16,"pst":"B1","zmo":3,"pwm":5216,"zs":1026,"rdc":3,"rac":6,"zsh":4,"zsl":2,"ectt4":"None","ectt5":"None","ectt6":"None","newAppAvailable":false,"newBootloaderAvailable":false,"beingTamperedWith":false,"batteryDischargeEnabled":false,"g100LockoutState":"NONE","mgl":100,"sbh":17,"sbk":5}],"_msgid":"0c7dc120b3c1fc99"}

Edit it and put 3 of the ` at the start and 3 at the end.

That way it will be expanded.
(I'm guessing you just used 1 of the reverse ' at the start and end.)
Or use the </> button.

I did use the </> button

Don't worry. I copied it and pasted it into an inject node and am looking at it now.
Hang on.

payload[0].gen = pv generation
payload[0].grd = power drawn from the grid
payload[0].mgl = max green level (when I use a eco setting on the charger)
payload[0].che = total charge of the ev (currently not rported as no charge so far today)
payload[0].div = pv power going into my car
payload[0].zmo = charger mode
payload[0].pst = ev mode

Sorry, I'm distracted. Blazing saddles is on just now.

Ok.

Given the car is charging during the day from not quite full to full.

Can you show me the formula you use to determine the numbers?

No formula needed, the charger is reporting the total charge in payload[0].che
Its reported as total in kwh which has gone into the car. I do not get a battery level for the car, and cannot calculate it either if thats what you meant. I'd love to but Kia do not provide a api...

Sorry.

My bad.

So you are getting these message every 2 seconds.

At midnight, you want to store any values from the day just ended and get ready to store new values for the new day.

Is that right?

Sorry it isn't I am trying to be difficult. I just want to check. Nothing worse than me working on a wrong idea and only confusing the other person more.

So I like to check, check and double check sometimes.

Yes you are right. I think it would be good to store yesterdays values (in case I want them, I'll probably email them to myself at the end of day)
The values which would need storing are

payload[0].gen
payload[0].grd
payload[0].che

Ok.

Let me think about it.

I'll make a sample flow for you. It will show the mechanics of what you could do but you will have to change some of the names, etc.

My car has just started charging. What I wanted to do doesnt really work. I think the problem will be tomorrow morning, when payload[0].che is not being sent, like in the first debug I have sent you.
This is a debug for when it has charged today

{"sno":xxx,"dat":"23-08-2023","tim":"11:37:42","ectp1":1534,"ectp2":0,"ectp3":0,"ectt1":"Internal Load","ectt2":"None","ectt3":"None","bsm":0,"bst":0,"cmt":254,"dst":1,"div":1534,"frq":49.93,"fwv":"3562S4.539","gen":2399,"grd":-15,"pha":1,"pri":1,"sta":3,"tz":0,"vol":2451,"che":0.42,"bss":0,"lck":16,"pst":"C2","zmo":3,"pwm":1260,"zs":3078,"rdc":3,"rac":61,"rrac":-55,"zsh":12,"zsl":6,"ectt4":"None","ectt5":"None","ectt6":"None","newAppAvailable":false,"newBootloaderAvailable":false,"beingTamperedWith":false,"batteryDischargeEnabled":false,"g100LockoutState":"NONE","mgl":100,"sbh":17,"sbk":5}

Ok, you've told me the values that you want to keep.

payload[0].gen
payload[0].grd
payload[0].che

Are they also stored in global variables and are those global variables set before the message gets here?
If so: what are the glabal variable names?