Hub dev architecture, More than one RM rule and or apps affecting the same device - How to handle the device instructions?

Hi Guys,

I have a roof fan. There are several use cases for this fan of which some are:

  • RM rule turns the fan on when someone is taking a shower and leaves the fan on until the humidity is lower than a parameter value
  • RM rule turns the fan on or off if someone presses one of two buttons controling the fan where the different buttons has different priorities over other rules.
  • Custom app turns the fan on if the inside temperature needs cooling and the outside temperature is cooler

The challenge is to know and govern if the fan should be turned off or not. One rule may have turned it on but another may want to turn it off.

As long as I had only RM rules it has been easy to use hub variables so that each input device 'knows' if another device has turned the fan on, and if the current action should lead to the fan being turned off or if the input should be ignored when another use case has precidence. The logic has been kept with each input device. But when adding a custom app I feel the situation is not as easy to oversee anymore with rules in different places. This is also true for log messages. What would you do:

A. Centralize all rules and replace all RM rules with one big custom app

B. Keep it as it is and continue keeping logic for each device in each place (rule/app) with collective common hub variables

C. Do one parent app (master script) that calls other child apps/rules of which one could be dedicated to holding a fan rule to rule them all

D. Other approach?

The fan is one component among others (thermostats, radiator switches etc) that governs to heating and cooling of the house.

How would you do?

Cheers,

Quickest approach would be to create a global variable to store the rule that turned on the fan on.

1 Like

Thanks for your thoughts @thebearmay ! And in addition to that, have a validation rule in each device rule to decide if the calling rule has precidence or not?

That's probably the way I'd do it.

1 Like