HA Node current status overriding payload

I have this flow but I am not super happy about it. I want to have the state node “automation on?” in the start of the sequence, but if I do it replaces my payload. I have tried to remove the check-boxes “override topic” and “override payload” but still the input is gone after traversing the node.

See the following example that does not work:

The state node looks like this:

My debug shows that there is not anymore a number flowing in the sequence but rather the state from the “automation on?”.

25

Should it not be possible to use the state node as I want in the start of the sequence?

Here is my sequence: https://pastebin.com/FiJbMDzd

Just note, in the function node I put in “msg.payload = diff;” just to see what is going on. This should be commented if everything worked… Output form the function is a string with above or below.

36

This is the output of “automation on?” with the settings above. I am confused!

on which nodes? target? charging?

The checkboxes for override topic and payload was unticked on the “automation on?” node, top left blue one (HA state node). The target one is fine, it gives me the value I need, just a number - sadly as string so therefore the f node to convert to integer.

What is the trigger to check the ‘automation on?’ state?

Are you sure it is overriding the payload? What happens when you debug the flow RIGHT out of the automation on? node?

You could instead, store the payload in another msg attribute, or in a context/flow attribute and access it later.

Yes I agree. That could be an option, just irritating that this does not work. See this screenshot of the “automation on?” state node. The debug shown is from the right side of the same node.

You should change your debug node to show the entire msg, and it will tell you WHERE the payload is actually coming from.

Again, what is the trigger that sets off this flow? How do you know the payload from THAT isn’t “on”

1 Like

Here you can see I moved the debug node til the input side of the same node (left side):

Input is 57 but traversing this state node changes it to “on” even if I remove the ticks…

You can rename your debug nodes to tell where they are generating from also…

1 Like

Entire msg in debug node. The payload gets replaced… :frowning:

Looks like a bug in this node or ?

If you’re using the original fork then yes it’s a bug with the current state node. You could switch to one of the other forks.

1 Like

Ok. I just used the npm command to install on my raspberry. Could you point me in the right direction to do what you suggest?

Uninstall the version you installed then

npm install node-red-contrib-home-assistant-websocket

1 Like

I had to do some restarting and crazyness to get the other home-assistant version currently installed to uninstall. Finally I made it, installed the new and configured it again. This new version also fixes the integer vs string problem so my logic just god better. Thanks for help!

https://pastebin.com/9m5BP5Ve