Basic understanding question about the functionality of the "Call Service" node


I am currently trying my hand at automation for my shutters. These should automatically move up or down at sunrise and sunset.

For this I use the “suncalc module” to define when sunrise and sunset take place. If the condition (e.g. sunset) is met, the node delivers the value “0” according to my definition via a switch node to the node “call service”. In addition, shutter actuators from the company Homatic IP are used.

The “suncalc module” returns the value “0” every minute, as long as the condition is still met (i.e. in my example it is still night).

Now to the concrete question:
Let’s assume that the sunset has occurred. The “suncalc module” correctly delivers a “0” to the “Call Service” node and the shutters go down. What happens after one minute if the shutters are still down? Does “Call Service” then communicate with the actuator of the roller shutter and query the current position, even if it has not changed? Background of my question is a possible power consumption of the shutter actuators, if they are addressed every minute from the “Idle Mode” and then spark. I have 9 shutter actuators in use and if they spark every minute, that is certainly not a small consumption calculated over the year.

I don’t know, but think you should code defensively and assume the worst. You can use the second output of the sun rise/set node to only output on change. However, this would fail if NR was not running at the time of sun rise/set (eg. an unfortunately timed deploy).

Alternatively, you could fetch the current state of the shutters and only call the service if it’s different to what is required.

Hello Michael,

thank you very much for your answer. I have now implemented it as follows:

If the condition is fulfilled (e.g. it is night), it is checked before again whether the shutter is not yet completely down (closed). If it is not yet closed, a “call service” is called.

I am still a beginner, so I would like to know if there is a more elegant way to implement this?

Best regards

Looks good. My knee-jerk reaction would be to put the “current state” node before the switch so there’s only one of them, but this arguably makes it more complex because the test then becomes “is not” and the value would be JSONata to convert 0 to “closed” and 1 to “open” (or the other way around). Simpler and more visual is better.

My only other observation is the horror (:slight_smile:) of seeing you don’t use “snap to grid”. But seriously, since you’re asking, I would also recommend using groups (ctrl-shift-G) to surround a flow. This can take a while to get used to, as dragging a single node will drag the whole group - to drag a node within a group you have to click it twice first (not double-click). This is an example of one of mine, and I think the background colour makes individual flows stand out much better, and you can copy a group’s style (ctrl-shift-C) and paste to another (set ‘copy group style’ to ctrl-shift-V under keyboard shortcuts).