Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Unsolved
Collapse
Discussion Forum to share and further the development of home control and automation, independent of platforms.

Global Moderators

Forum wide moderators

Private

Posts


  • [MSR] Rule do not fire
    therealdbT therealdb

    Thanks, make sense. I realized from a backup that I had previously solar into the triggers. So I don’t know, maybe I was tired. Thanks for your help, I’ll try to rework this and create two rules!

    Multi-System Reactor

  • [MSR] Rule do not fire
    toggledbitsT toggledbits

    I'm not sure how I can help here. Your assessment seems correct. Like the other recent post, the displayed states here show the triggers going true substantially before the constraints did, so the constraints prevented the rule from SETting.

    That seems like a logic issue. You need different approach, and I can't really gauge how you want this to work, and what the system limitations and risks are. That's knowledge only you can possess, at least not without a much lengthier explanation/q&a about what all this is meant to do, what you want it to do, etc.

    I can, however, throw out some things based on assumptions (and because they are assumptions, they may be completely useless to your problem and not make any sense)... assuming two key goals: you don't want to start A/C unless solar power is high, and once A/C is running you want to keep it that way, at least for a while. You could move the solar power condition to triggers and latch it. To make sure A/C is stopped if solar drops too low, add a trigger condition requiring solar > whatever minimum, so you basically have solar >= ACthreshold (latched) AND solar > ACminimum in the triggers. If solar momentarily drops below threshold, the latch keeps the A/C running, but when it drops below minimum, that condition going false resets the latch (and presumably allows the A/C to turn off). Additionally, you could add a delay reset on the A/C, to enforce a minimum runtime. This is often recommended to avoid cycling compressors too often, but also helps make sure that the money you spent on the startup inrush gets some useful life. Be careful here, though, because you now introduce the possibility that the A/C could run when the solar is below minimum (held on by the time delay).

    I will also repeat advice I've given previously... sometimes it is easier and, in fact, necessary to separate "turn on" and "turn off" logic into separate rules. I know there's a big temptation to use the SET and RESET reactions of a single rule, but it can make the triggers and constraints excessively complex to support. For example, I have a dehumidifier in my garage (where I live, my tools would rust every summer otherwise). Three garage doors, temperature, humidity, standby generator operation, and other large loads in the space are all considerations for both stop and start, but with varying logic. One aspect perhaps similar to your rule here, is that the dehumidifier isn't stopped when the garage door opens for a short period (e.g. a car pulls in or out of the garage), because of the wear on the compressor starting it, and brief periods of door open don't significantly drag on dehumidification, but long periods definitely do. I have one rule with just the start conditions, and those conditions include (a) the dehumidifier hasn't been running for at least ten minutes (prevent short cycling; it doesn't have smart controls), (b) the doors are all closed, (c) the humidity has been above threshold for 30 minutes (via a "sustained for" option on that condition). If those are met, the unit is started (via the SET reaction). In the rule with stop conditions that turns the unit off, the triggers are (a) dehumidifier has been on for at least five minutes, and (b) the start rule isn't SET (i.e. the conditions that call for it to be on are no longer met), also sustained for at least five minutes. SET reactions only; no RESET reactions. While the basic logic isn't complicated, it would be very difficult to get the independent timing of the two (on and off) processes to work in a single rule. By the way, I have a separate rule to detect if doors are open; I don't look at each individual entity in every rule, because...

    More general advice to the community: many (most?) posts lately have had huge monolithic rules posted. I don't recommend it. I don't do this to myself, and I wrote the darned thing. I make liberal use of the Rule State condition and separate out chunks of logic into small, easy to define, easy to debug, easy to test condition-only (no reaction) rules that are tested by other (action-oriented) rules. Modular design. Using the overrides on the UI makes it easier to test, because you can SET and RESET your input rules at will and in any order. When devices fail or change, there are then a lot fewer rules to update. I always start with this approach on anything new. If I later find it's overkill for the task, I can always import the input (condition-only) rules into the action rule and get rid of them.

    Again, just some thoughts/rambling without deeper knowledge of the task...

    Multi-System Reactor

  • [MSR] Rule do not fire
    therealdbT therealdb

    I have this rule that stopped working recently, I think with the latest update:

    02d6513a-0286-4859-ab1e-ad3ddb48de21-image.png

    As you can see, all is true, but the rule stays reset. Resetting the rule does the work and the A/C starts. I think it's because the trigger window is true, while a specific constraint (power_solar >= 1800) is not true when the triggers are true. But I don't want to put this into triggers, since I want the A/C to stay ON after it started, even if we have rain or similar, because of the inertia to start it. Any hint is appreciated here @toggledbits. Thanks.

    Multi-System Reactor

  • Rule condition shows TRUE in UI but Rule never transitions to SET — survives full restart
    toggledbitsT toggledbits

    In the first image, the triggers show true as of 9:42:09. The constraints show true 10 seconds later. That's a not pass. The constraints have to be true at the instant the triggers are also true (or before), or the rule does not SET. If the constraints become true later, that doesn't matter, the rule does not SET.

    Your third image shows the same. Triggers true at 10:31:53, but constraints didn't go true until 10:32:12 (19 seconds later).

    From the docs:

    c1035d81-2187-46c4-ab50-3c14d2f4dbd8-image.png

    Multi-System Reactor

  • DynamicGroupController and attributes
    toggledbitsT toggledbits

    This is now available in build 26242. The config has changed slightly, so review the final documentation for correct usage and examples.

    Multi-System Reactor

  • Reactor (Multi-System/Multi-Hub) Announcements
    toggledbitsT toggledbits

    Reactor build 26242

    • DynamicGroupController: Custom attributes (calculated) see docs;
    • Expressions: new map() and reduce() array functions see docs;
    • HassController: Bless HA to 2026.8.3
    Multi-System Reactor announcements

  • Rule condition shows TRUE in UI but Rule never transitions to SET — survives full restart
    toggledbitsT toggledbits

    A couple of things here...

    • Editing the rule will cause re-evaluation, which is likely why you have repeated RESETs in the history with no SETs between.
    • As hard as I try, and I keep looking, finding, and fixing, the UI can get out of sync with the running engine/service, so always hard-refresh when the UI isn't making sense.
    • If a Rule has been edited, especially multiple times, and it's not performing as expected, reset the Rule. There's button for that: 43f46006-5e40-4dd8-a7a3-82fffc3e5849-image.png Even restarting Reactor doesn't do what this button does.
    • Beyond that, it would also be handy to see the top part of the screen shot that has been cut off (the Triggers group heading and stuff above it).
    Multi-System Reactor

  • Ooops - Deleted Reactor Ex Machina II
    toggledbitsT toggledbits

    No backup? Restore from backup (recommended) is the best way, of course.

    Beyond that, recreating it should not be difficult, but there have been key changes since that original post. Some detail beyond "did not work" is necessary here. Show your work and tell us about your environment.

    Multi-System Reactor

  • DynamicGroupController and attributes
    therealdbT therealdb

    This sounds really complete. I’ll give it a try when available.

    Multi-System Reactor

  • DynamicGroupController and attributes
    toggledbitsT toggledbits

    Here are the docs for what I have built thus far. Comments and suggestions on functionality appreciated!

    Custom Attributes

    In addition to setting the primary attribute for a dynamic group, users may add custom attributes to the group. The values of these custom attributes are typically derived from attribute values of the group's members. For example, a group of temperature sensors can have a calculated average of the readings of all the sensors.

    Custom attributes are defined under the calculate: object in a group's configuration. Here's a possible configuration for the example given above as a group with ID temp_sensors. The select configuration simply selects all entities having the temperature_sensor capability, for illustration purposes (in practice, we'd probably want to include_entity some specific entities for this purpose).

            temp_sensors:
              select:
                - include_capability: temperature_sensor
              calculate:
                - attribute: 'temperature_sensor.value'
                  source:
                    attribute: temperature_sensor.value  # Where to get data values
                  op: average
    

    This is the most basic form of custom attribute configuration. The calculate object is an array of configuration objects. The attribute key is required for each array element and specifies the attribute to be defined and calculated on the group. The source substructure tells DynamicGroupController what attributes on the member entities should be used for calculation. Any member entity that does not have the specified source attribute, or for which the attribute's value is null, is simply ignored. The op tells DGC how to reduce (or aggregate) the multiple values from the member entities down to a single value. Pre-defined operations for op are defined below:

    op Type Description
    average, avg, mean numeric The average (arithmetic mean) of the available values.
    median numeric The median of the available values (i.e. the middle value of the values when sorted).
    min, max numeric The minimum or maximum of the available values.
    sum numeric The sum of the available values.
    count numeric Count of non-null values.
    and, nand boolean Logical AND of available values. All values must be boolean true for the result to be true. If nand is used, the result is inverted (i.e. false when all values are true)
    or, nor boolean Logical OR of available values. If any value is true, the result is true. nor inverts the results (false when any value is true)
    xor, xnor boolean Logical XOR. Since more than two values may be considered, this operation is only true when exactly one of the values is true. If multiple are true, or all are false, the result is false. The xnor inverts the result.
    first string Given a string or an array of strings to match in a value key (at the same level as op), this operation returns the first matching value. That is, each element of value is checked to see if it matches a source value from any of the group's member entities; if so, that element/value is the result; if not, the test moves on to the next element. If no match, null results.

    !!! note "null Member Attribute Values"
    All of the above operations ignore null values from the source, unless otherwise indicated.

    There may be circumstances where the source values require some pre-conditioning or filtering. This is enabled by the value_expr subkey under source. The result of the expression is the value that will be added to the array of values for op or reduce_expr. For example, in our temperature sensor group, some of the sensors return temperatures in Celsius, and others in Fahrenheit. We can use value_expr to convert the values to a consistent unit, so that the resulting reduction operation yields a consistent value in that same unit:

            temp_sensors:
              select:
                - include_capability: temperature_sensor
              calculate:
                - attribute: 'temperature_sensor.value'
                  source:
                    attribute: temperature_sensor.value  # Where to get data values
                    # Convert Celsius temperatures to Fahrenheight
                    value_expr: >
                      local units = entity.attributes.temperature_sensor.units;
                      local d = ( units === 'C' || units === '°C' ) ? value * 1.8 + 32 : value;
                      ( d <= 0 || indexOf( ['C','F','°C','°F'], units ) < 0 ) ? null : d
                  op: average
                  prec: 2  # two decimal digit max result
    

    Step by step, the value_expr above first fetches the member entity's temperature units into a local variable called units. Since the attribute under source is temperature_sensor.value, the context variable value will contain the raw value from that attribute. The second line of the expression then checks if the units are Celsius, and if so, converts them to Fahrenheit (if units are not Celsius, it just takes the current value) and assigns it to a local variable d. Finally (third line of the expression), if the value is in range and the units are known, the value of d is returned, otherwise null. As stated above, most of the predefined operations ignore null values in their computation. So value_expr can function both to condition values and to filter them.

    The prec key allows you to define the number of decimal digits precision for the result value; the result is rounded to comply. For example, a calculated value of 3.14159265 with prec: 4 results in 3.1416.

    If none of the pre-defined operations addresses the need, the op: key can be replaced with an expression defined by reduce_expr:. The result value of the expression will be the value assigned to the custom attribute. The context for reduce_expr includes the following variables: group refers to the group entity being defined; members is an array of canonical IDs of the member entities at the time of evaluation (which may change in a truly dynamic group); and values is an array of the member values (as derived from source).

            temp_sensors:
              select:
                - include_capability: temperature_sensor
              calculate:
                - attribute: 'temperature_sensor.value'
                  source:
                    attribute: temperature_sensor.value  # Where to get data values
                  # Compute harmonic mean (not predefined) using expression (trivialized for illustration)
                  reduce_expr: >
                    local s = 0;
                    each v of values: do
                      s = s + (1.0 / v)
                    done;
                    len(values) / s
                  prec: 2  # two decimal digit max result
    

    Finally, custom attributes that should have fixed values can be defined by simply supplying value: under source:, like this:

                - attribute: 'temperature_sensor.units'
                  source:
                    value: '°F'
    

    Make sure the data type of the value configured matches the expected type of attribute being defined.

    Multi-System Reactor

Member List

CatmanV2C CatmanV2
therealdbT therealdb
toggledbitsT toggledbits
akbooerA akbooer
DesTD DesT
rafale77R rafale77
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Unsolved