Switch nodes problem - change nodes when certain value and reset

It is set to chill but it takes a little while to start chilling so temperature carries on rising when it is switched on.

ARGH!

Ok......

:wink: :slight_smile:

So the unit it turned on and starts spitting out the temperature every 15 seconds.
It starts around 65 and then wobbles a bit up and/or down.

0 means CHILL and 1 means HEAT.

That is in the raspberry part of the payload.

(Again: that is confusing.)
mode would be better. Then you can have 0 as cooling and 1 as heating.

Or even better:
msg.payload.mode and it can be heat or cool.
No ambiguity then.

All these changes can be done easily with a change node upstream from this part of the flow at no real cost to you.

But again I ask:

What are the values expected?
min - max

If you have it split to heating and cooling, say:
40-60 heating
61-80 cooling

I still don't really know or understand.

So to restate your problem. You are trying to control a heater and a cooler in some container. There is also a sensor in the container.

If the temperature goes above 66 you want to turn on the chiller.
Once the container gets above 69 you want to turn off the chiller and turn on the heater.

In other words you want to keep the temperature as close as you can to between 66 and 69 degrees.

Is that about right?
How often does the sensor read the temperature?

If the temperature goes above 66 I want to turn on chiller = correct

It will go over 70.

When it goes under 70 I want it to turn off and heater to come on.

Sorry, but is that right?
Just want to check as the confusion level is already fairly high.

How often does the sensor read the temperature?

what do the two items in the inject nodes represent
msg.payload,raspberry and msg.payload.test?

So basically either the heater or the chiller is going to be on.
The heater goes on and chiller goes off when the temp drops below 66 (I should have said below in my prior post)
The chiller goes off and the heater goes on when the temperature goes above 70.

with out knowing what the two values (msg.payload,raspberry and msg.payload.test) are for it is hard to help you.

It seems one of them should be msg.temperature (as Andrew suggested) to make it easy to understand the logic in your flow.

The raspberry payload switches it to the '30' switch node. Nothing else. There is a reason for that as it reacts different depending on if the raspberry is receiving value 0 or 1. I'm just going to confuse things if I go into the reasons for that.

It reads every 15 seconds

payload.raspberry represents something that changes the way heating and cooling need to be controlled.
payload.test has the temp value (and lots of other stuff that is doesn't effect this)

Ok, may I suggest this:

An absolute MINIMUM temperature - which we hope will never be seen.
An absolute MAXIMUM temperature - as above.

The lowest temperature you want to see BEFORE you start heating.
So if it gets to this temperature (or below) the heater is turned on.

The highest temperature you want to see BEFORE you start cooling.
(as above but replace
So if it gets to this temperature (or above) the cooler is turned on.

And another value:
How long must these temperatures be read before you actually do things.

eg:
(argh temperature in Fahrenheit is painful at best)

30 abs minimum
100 abs max

50 start heating
70 start cooling

3 messages

Then:
If you receive 3 consecutive messages of <50, you start heating.

Then, when you receive 3 consecutive messages of >70, you start cooling.

It switches the moment payload.test value is above threshold.

Node '66' works perfectly for turning it on. But when the temp starts falling doesn't turn it off at correct temp.

turns on at 65c temp rises above 70c and then comes back down. Needs to turn off when goes back under 70c.

So node '66' for turning on and after 70c node '70' to turn off and on from thereafter until RS switches and then resets to '66' when RS received value 0 again.

And just to put it out there, I see there is a fundamental flaw with what you are doing.

Sorry, but just saying.

This isn't CRITICAL and can be worked around but a bit more code.
Not a big deal.

For the sake of making it easier for this idiot - that is me by the way.

Let's make it a lot bigger between the START COOLING and START HEATING values.

Because the post I just posted is going to have a big effect on the whole working of things.

Oh, and the other question begging to be asked:

What EXACTLY is this?
A household fridge?
An INDUSTRIAL cooler?

And what is it storing?
Food, Milk, Blood, Meat?????

And:
What is the ALLOWABLE temperature range before what ever it is is spoiled?

RS receives payload.raspberry 0 payload.test 64 = START COOLING

RS receives payload.raspberry 0 payload.test 68 = START COOLING

RS receives payload.raspberry 0 payload.test 72 = START COOLING

as the payload.test has gone over 70 then

RS receives payload.raspberry 0 payload.test 68 = START HEATING

That's why I had two different switch nodes '66' and '70'.

I SORT of understand what you are saying/wanting to say.

As I see it, until the values for which I've asked are CLEARLY defined, you are chasing your tail and you will get very dizzy very quickly.

You will spend a lot of time achieving little.
Sorry.

Once the values are set, I can explain methods to greatly reduce the complexity of what you are doing.
I'm not saying it is the best way, but at least I can explain it clearly to you and hope you understand.

As it is, we are talking conceptually just now.

It's an environment control project. I've tried to simplify it as much as possible with heat and chill not to add to the confusion. It would definitely add to the confusion.

I'm not sure what you mean by allowable temperature range. The ranges set are in '66' and '70'. It works presently but chills too much. Back down to 64c as set in '66'.

Take a look at this flow (it just deals with the temperature) and see if it has the basics down

[{"id":"97780b9e6ba1dff2","type":"switch","z":"7f2f416d9e78b7fb","name":"Is temp < 66","property":"temperature","propertyType":"msg","rules":[{"t":"lte","v":"66","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":410,"y":580,"wires":[["cc4bf93a4db44b0a","ec5f534c2a796b31"],["a2ca243b0b4bebc1"]]},{"id":"cc4bf93a4db44b0a","type":"change","z":"7f2f416d9e78b7fb","name":"turn heater on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"turn heater on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":440,"wires":[["ef2dde12c16c38d5"]]},{"id":"a2ca243b0b4bebc1","type":"switch","z":"7f2f416d9e78b7fb","name":"is temp > 70","property":"temperature","propertyType":"msg","rules":[{"t":"gte","v":"70","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":640,"wires":[["8656a6b439efaaf3","ca36ca3480733fd5"],["c9475c7e3a8a0e94"]]},{"id":"7047dbc02dccdedd","type":"inject","z":"7f2f416d9e78b7fb","name":"temperature 60","props":[{"p":"temperature","v":"60","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":180,"y":500,"wires":[["97780b9e6ba1dff2"]]},{"id":"ef2dde12c16c38d5","type":"debug","z":"7f2f416d9e78b7fb","name":"Heater control debug 306","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1030,"y":520,"wires":[]},{"id":"135e32dc9c0afd00","type":"debug","z":"7f2f416d9e78b7fb","name":"Chiller control debug 307","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1030,"y":580,"wires":[]},{"id":"3a5abfbf86654841","type":"inject","z":"7f2f416d9e78b7fb","name":"temperature 65","props":[{"p":"temperature","v":"65","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":180,"y":540,"wires":[[]]},{"id":"a76b29057aa85025","type":"inject","z":"7f2f416d9e78b7fb","name":"temperature 72","props":[{"p":"temperature","v":"72","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":180,"y":580,"wires":[["97780b9e6ba1dff2"]]},{"id":"9968ccbfb9808694","type":"inject","z":"7f2f416d9e78b7fb","name":"temperature 30","props":[{"p":"temperature","v":"30","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":180,"y":640,"wires":[["97780b9e6ba1dff2"]]},{"id":"559a8a47bd676f12","type":"inject","z":"7f2f416d9e78b7fb","name":"temperature 60","props":[{"p":"temperature","v":"60","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":180,"y":680,"wires":[["97780b9e6ba1dff2"]]},{"id":"ec5f534c2a796b31","type":"change","z":"7f2f416d9e78b7fb","name":"turn chiller off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"turn chiller off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":480,"wires":[["135e32dc9c0afd00"]]},{"id":"ca36ca3480733fd5","type":"change","z":"7f2f416d9e78b7fb","name":"turn heater off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"turn heater off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":560,"wires":[["ef2dde12c16c38d5"]]},{"id":"8656a6b439efaaf3","type":"change","z":"7f2f416d9e78b7fb","name":"turn chiller on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"turn chiller on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":600,"wires":[["135e32dc9c0afd00"]]},{"id":"c9475c7e3a8a0e94","type":"debug","z":"7f2f416d9e78b7fb","name":"do nothing","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":680,"wires":[]}]
1 Like

As you are using values like 66 and 64 I take it you are talking Fahrenheit.

So 4deg F is the absolute maximum allowable change?

Yikes! That is worrying to me.
I don't really know how much that is in my language, but that is TIGHT TOLERANCES!

And again: What environment is it?
A household fridge or an industrial one?

Or is it just the dog house in the back yard?

Again, see back to my post 33

I like you did add a do nothing output.

That is good. :wink:

And I also like how you used the topic to explain what is happening.
Top marks for that.
:+1: