Entity value * 1000

Sorry for being a n00b at this.
I have found this https://forum.pvoutput.org/t/nodered-home-assistant-uploader/2472
I have imported it in NodeRed and changed the entities etc.
The problem is that my entities sends its values in KWh and not in Wh or watt.
So I tried to create a entity template for that value in HA but I cannot use that entity in NR, so that doesn't work in this situation.
Now I am searching for another solution but I am not a programmer.
I think it would be possible to the same in NodeRed and change to value to = and do *1000 or something.
Maybe someone can help me?

Welcome to the forum!
Can you show us what you have in your 'V' change nodes (one will do!)

Thank you. Sure I can:

Try using jsonata, like this;

power

EDIT - If the payload is a string value, and not a number, then change the jsonata function to;

$number(payload)*1000
2 Likes

Getting this in debug info now.

msg : string[87]
"Invalid JSONata expression: The left side of the "*" operator must evaluate to a number"

Will try to ues $number(payload)*1000 now

26-11-2020 22:30:48node: headercheckv2 : msg : Object

{ payload: "OK 200: Added Status", topic: "v2", _msgid: "6147e5e5.6d647c", settings: object, action: object … }

This is great, it works!
Thank you! I would like to know how do you know this? Were can I study those codes and what is the "language" of the code?

It's jsonata, see https://docs.jsonata.org/overview.html
I'm no expert, I learnt all I know from @janvda here in the forum by learning from his examples.

1 Like

Ok its the first time that I work with it.
I must say that I was close at my try. I tried this @ first:
image

But happy that you came with the solution

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.