PID, strange behavior

stable situation:
setpoint: 26
pv (temperature): 30
payload: 0

{"payload":0,"pv":30,"setpoint":26,"proportional":4,"integral":9.206083333333336,"derivative":0,"smoothed_value":30,"_msgid":"ae571205.3a6de"}

after I put the setpoint at 28, and the payload goes to 0.26 and then drops with each hit

{"payload":0.26025914296199754,"pv":28,"setpoint":26,"proportional":2,"integral":9.206083333333336,"derivative":-5.931784478497281,"smoothed_value":28,"_msgid":"b7db2087.52d8b"}

because it makes this output that the temperature is 30 .. and the setpo int at 28 is still lower and therefore should remain 0

Sorry, I don't fully understand. Generate a chart showing the setpoint, the temperature and the node output and post the result. Drawing charts is the only way to see what is happening with PID.

when I input setpoint, near to temperature, but not greater than the current temperature
I view payload number > 0

it should stay 0

Make a chart please.

But also remember, if you increase the setpoint then the output power will probably increase, that is the way pid works. Once the loop has been tuned properly it will make sense. If it is not yet properly tuned then the operation may appear to be illogical. So if you have not tuned it yet then do that first.

I want use pid for command a fancoil with 3 fan speed and off
pid between 0 - 0.33 -> speed 1
pid between 0.34 - 0.66 -> speed 2
pid between 0.67 - 1 -> speed 3
pid 0 -> off

I suppose that should work, obviously it won't be able to sit accurately on the setpoint as you cannot get full proporional control of the power so the best it can do is to settle out switching between two fan speeds. However the tuning algorithm should work ok to get initial values for the loop. Have you tried the tuning algorithm suggested in the readme?

Don’t work for fancoil because at off (pid=o) doesn’t arrive never.
What read me?
This example?

In the node's page on the node red flows site, npm and github it says
"A tuning guide that walks through a simple tuning procedure using the above flow is available at http://blog.clanlaw.org.uk/pid-loop-tuning.html"

Are you not able to use a time proportion output in order to get full control of the fan?

I use for cold


I add a function

var pid = 1 - msg.payload;
msg.payload = pid

return msg;

Schermata 2020-06-19 alle 10.16.06

You have a massive proportional band (22 degrees) so from the point of view of the pid the temperature is well within the proportional band as the error is only a few degrees. However even so, the power should eventually go to zero.
I suspect that proportional band setting is much too large, but as I said the first thing to do is to use the tuning algorithm to get initial approximate values for the proportional and integral settings. You probably won't need derivative.
For the chart I suggest scaling the output value up a bit so that will be easier to see.