snaky69
(Snaky69)
February 13, 2024, 2:57pm
1
Good day,
I’ve been having issues with my first Node-Red flow. Part of it already correctly works but I wanted to add an AND statement.
Here is the flow
This takes information from my Gree AC, splits it in topics, then again in run modes.
My cool, dry and heat nodes contain this:
With different swingVert options depending on mode. This works just fine.
What I’d like to do is to add a boolean logic to the “heat” node.
If “Présence Cuisine” is “on”, I would like its payload to be “fixedMid”. If else I want to stay as it is.
Any help is appreciated.
Mikefila
(Mike Fila)
February 13, 2024, 3:07pm
2
What ever entity this belongs to would go in a current state node. Place that node between run mode and heat. Then add another change node with "fixedMid"
snaky69
(Snaky69)
February 13, 2024, 3:09pm
3
Is there a way for you to show me graphically? Saying I’m a node-red noob is an understatement.
Mikefila
(Mike Fila)
February 13, 2024, 3:14pm
4
[{"id":"573157b3cd89ee84","type":"api-current-state","z":"60f2d2277843c698","name":"","server":"","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"Présence Cuisine","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"payload","valueType":"jsonata"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1050,"y":400,"wires":[[],[]]}]
The output property is important to preserve the original payload. If it is true, the message comes out the top otherwise the bottom.
snaky69
(Snaky69)
February 13, 2024, 3:17pm
5
Okay so I’ve got this so far and I can see it changes state correctly.
Now I need another “Heat” node basically?
snaky69
(Snaky69)
February 13, 2024, 3:22pm
7
Okay, it’s not pretty, but like so?
Mikefila
(Mike Fila)
February 13, 2024, 3:24pm
8
The event state is not necessary for presence cuisine
snaky69
(Snaky69)
February 13, 2024, 3:27pm
9
We’re getting somewhere. Flipping the boolean on and off always results in fixedMid though.
I want it to be fixedMid when on, fixedBottom when off. I’m probably missing a little something?
Mikefila
(Mike Fila)
February 13, 2024, 3:30pm
10
When presence is off, the message still comes out the top output?
snaky69
(Snaky69)
February 13, 2024, 3:31pm
11
Flipping the boolean does not update the current state I think.
Mikefila
(Mike Fila)
February 13, 2024, 3:33pm
12
Does the status of the node below say off?
All states should be immediately updated.
snaky69
(Snaky69)
February 13, 2024, 3:35pm
13
It doesn’t update at all. It sees the state when I deploy the flow and stays there.
Mikefila
(Mike Fila)
February 13, 2024, 3:45pm
14
You need to trigger the flow try putting a inject node before the current state to test it. Turn the boolean on inject. You should see a green staus with on.
Turn off presence hit the inject again, it should be red with off.
Mikefila
(Mike Fila)
February 13, 2024, 4:12pm
15
I assume that the hvac is independently controlled. So in your instance you would already be in the kitchen, hvac turns on it then goes to mid.
You would need another automation to change the heating mode if the hvac was on and then you entered the kitchen.
snaky69
(Snaky69)
February 13, 2024, 4:14pm
16
Just gave it a try. Still no dice. It reads the state when deploying and stays there.
Mikefila
(Mike Fila)
February 13, 2024, 4:15pm
17
You are pressing the little grey button to the left of the inject?
snaky69
(Snaky69)
February 13, 2024, 4:18pm
18
This changes the entire message to “fixedBottom”.
Mikefila
(Mike Fila)
February 13, 2024, 4:24pm
19
That is because the inject node does not send the same information as the ac node. It can’t change a message that is not there. Turn the ac on and off and the message will be correct.
msg topic isn’t there
snaky69
(Snaky69)
February 13, 2024, 4:25pm
20
Restarting the flow on state change would work just fine I think? When I do that by hand it works.