Infrared heating and photovoltaic

Good morning together,

I have at home some infrared heatings. I use it only when I make electricity with my photovoltaic.
To do it, I have two sockets. 1st socket is controlled with node-red (if the temperature is in range of X, the socket turn on the 2nd socket). The 2nd socket is controlled with Solar-Log which turn on/off this socket dependent of that if enough electricity is produced. It works good but I think it is possible to make this scenario with only one socket.
As attachment a screenshot from my flow. To explain how I did it:

1. I have a button by Home Assistant to turn on / off the automation
2. and 3. Independent of the temperature we go to 4 or turn off the heating
3. We check if the window is closed
4. And now I have problem. I want to have, that when (and only then) the temperature is in range X and window is closed, every some seconds the node-red check how many electricity I’m exporting and independent of that turn on/off (6) the heating. Now, the node-red check only when the temperature change the electricity amount and turn on / off the heating.
How could I change it?

7. I don’t know why but my sockets are turn on again and again though that they are already turn on. Because of that You can hear (and see in the logs), that they are for a ca. half of second turn off and directly turn on back. Because off that I block more as one signal. Is it normal situation or I make some wrong?

1. What is the better solution to check the temperature? The node 1 +2 or the 8?

The next question will be (after this above works)… I have more heatings with for example 1.400 W. How I can make, that for example first the node-red turn on the heating in living room and later, when I export enough electricity, in kitchen? I would say, I make that the living room should start by 1.420 W export and kitchen by 1.450 W but what if at once I export 1500 W? Also the solution to turn on kitchen only when living room is turn on is not good (for example living room is turn off because the temperature is above the range).
Can You give me some hints how it would the best?

Thank You and have a nice Dunday.

Best regards,
kamil

Without having the specifics of the flow (i.e. internal logic and stuff) and because my Deutsch ist nicht gut (sorry if I said that really bad), I'll have to go off of what I can see. Or saying it more simply, because I have no clue what's going on, I'm going to take a good guess.

You have what looks like a node that turns something on called previously to a node that turns something off. The connection between 7 and "Trigger and Block" doesn't need to be there. If those branches are doing something independent of each other, they should be isolated and have no feedback. I have no idea what's going on in the "Trigger and Block" node.

This is a difficult question to answer without having the specifics of your flow. But I'll pose a question to you. How do you feel about using a simple function node in your flow in place of most of those other nodes you're already using? You would only need to feed in your temperature, window and on/off button nodes into the function and then have the output of the function drive the single socket on or off. You can do all the logic inside the function with a single if statement. Your Startup tab in your function would look like this:

``````var onOffState = false; //The initial state doesn't matter.  The outside environment will change it.
var windowState = false; //Doesn't matter on this one either
var solOutput = 0; //Also doesn't matter
context.set("onOffState",onOffState);
context.set("windowState",windowState);
context.set("solOutput",solOutput);
``````

This will set it up so that your function can keep track of the state of those asynchronous inputs as they change. Since the temperature will be the most dynamic component of the setup, you can use that to trigger the actual function that looks like this:

``````if(msg.topic == "temp" && context.get("onOffState") && context.get("windowState")){ //If all conditions are met
if(msg.payload < 20 && context.get("solOutput") >= 1400){ //assuming msg.payload carries the temperature as a number, 20C is the desired temperature and solar output is at least 1400
return({payload:"on"}); //Tell the controlling node to turn on the socket
} else if(msg.payload > 21 || context.get("solOutput") <1400){ //Give a little hysteresis or turn off the socket if output is less than necessary
}
}
if(msg.topic == "window"){
}
if(msg.topic == "onOff"){
}
``````

That whole example will obviously have to be customized to your code since I don't know what identifying properties each node sends that you can check against. Whatever tells you what node sent the message, just replace msg.topic with that property and the checked condition with the value the node sends. But that's all that you need to do. The context properties of windowState and onOffState will track the changes in the window and your on-off button for comparison in the if statement. solOutput is just to capture the output value between changes for reference as well. Then as your temperature changes and sends its output, the function will determine if it needs to turn the socket on or off based on temperature and output. You can change any component of that example to match how your flow works. But that's the easiest way I know of to work with multiple conditions to drive one output.

As long as you're feeding in the live temperature into the function node, or any node really, it doesn't matter. Whatever gives a live readout will work.

Simple. You just put the same logic into another function that drives the output of that socket and give it the adjusted values for your power output. You can feed in whatever you want as conditions and the function will drive the output the way you want. It's much simpler than feeding several nodes and having to go in circles.

If you want to go that way and need help, let me know and I can guide you to make it happen. If you don't feel comfortable with that, we can work with that as well. In any case, you'll want to export that part of your flow so those of us on the board can see the details of what's going on.

Hopefully that helped answer a couple questions at least.

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