Sunscreen automation in Node-RED

Hi, I am in the middle of the migration from Domoticz to Home Assistant (+ Node-RED). In my Domoticz setup, I have a Blockly automation which controls my sunscreens (see attached screenshot).


This automation consists of four different triggers:

  • a dummy switch (automatische zonwering) to enable/disable the automation
  • a time (window) when the function needs to be triggered
  • a check of the temperature outside. As the temperature is higher than 30 degrees Celsius, the function is triggered.
  • a check of the current state of the sunscreens. It makes no sense to enable this automation and close the sunscreens if they are already closed.

Besides this, I have added a user variable called “status zonwering” which will be enabled when sunscreens are going up or down. This is to prevent that during opening or closing the function is enabled again and the sunscreens stop to move. This variable is enabled during 90 seconds and will be reset after this period.

I want to migrate this automation from Blockly to Node-RED. This is the current result:


I miss the check for the temperature, the user variable which is enabled during opening and closing and a check of the current status of the sunscreens.

It is very difficult to find a solution for all the triggers together (multiple AND statements) in Node-RED. Besides that I am not able to create a variabele which can be used in the automation. Who is able to help me with this challenge? Thanks in advance.

1 Like

Think of it more as a linear flow. You can use a “Current state” node to check a condition within a flow. For instance, if I want the flow to stop if the temperature is very cool. If the states does not match, it will stop. If it does meet the conditions, it will continue. To do an “or”, just split the flow into two flows.

I would add it like this

Also, to make sure the status is not opening or closing, it would be like this:


Just add another one in line for is not “opening”

As an example we have a hot water circulation pump to ensure hot water is always at the tap. The trigger is an inject node that fires every 60 minutes between 6am and 7pm. First, the flow checks that a switch called 'vacation mode" is off. Next it checks if the house is occupied. If both conditions are met, it turns on the pump and begins a 10 minute delay to off.

1 Like

Hi, I have tried several things to get this working. My question is: is it possible to optimise this flow?

At this moment, the blinds do not work when I use them as “Cover”. Therefore I have added them as “Switch”. However this means that I am not able to check the status of the blinds when opening or closing. This is the current situation:

It consists of the following parts:

  • Temperatuur > 30 graden?: this part checks the outside temperature. If the temperature is higher than 30 degrees, it will continu.
  • Time between sunrise and 18:30h: this part takes care that this function is only executed during the day.
  • Automatische zonwering aan?: this part is a dummy switch (see code below) to switch on/off this flow.
  • Zonwering omhoog: this part checks the current state of the blinds. If the blinds are already down, it makes no sense to activate this flow again.
  • Zonwering status uit?: this part checks the status of a dummy switch. It will take some time to open or close the blinds. During this time period, I want to prevent that the flow is enabled again. This will stop the opening and closing of the blinds. So if this dummy switch is enabled, it means that the blinds are currently opening or closing.

When all items above are true, the blinds will be closed. Besides that, the dummy switch “Zonwering Status” will be enabled for 90 seconds. After these 90 seconds the virtual switch will be disabled again.

Code for dummy switches in configuration.yaml:

input_boolean:
  zonwering_switch:
    name: Automatische Zonwering
    initial: off
    icon: mdi:window-shutter

  zonwering_status:
    name: Zonwering Status
    initial: off

Thanks in advance for your reaction!

Instead of the fake status switch, I would simply use a delay node to rate-limit 1 message per 90 seconds, and having it drop any message received at that time. So if the flow it triggered within that 90 seconds, it just ignores it. This would mean that all control of this shade should go through this flow though, to ensure that the signal to close is blocked by every possible means while it is moving.

1 Like

Hi, I have added the delay node. Besides this, I have created a flow to open the blinds again on a specific time. This is the current situation. Do you have any other ideas to optimise things?

Thanks for your help! The flow is working now!