WTH Make Helpers compositional (like Automations/Scripts, etc.)

In the Automations/Scripts designer, you can create things compositionally (e.g. an Or nested inside an And containing States etc.)

I don’t see why Helpers can’t be designed in the same way. For example, let’s imagine an Energy Tariff sensor and two energy monitoring devices, A and B, with usage values in kwh. What you want is to multiply each kwh value by the tariff to get a cost - and then report which is currently costing the most.

Now, atm there isn’t even a Multiply helper (or better yet a generic arithmetic operator helper). But even if there was, you would need to create a bunch of new entities:

  • Multiply: Device A kwh * Tariff
  • Multiply: Device B kwh * Tariff
  • Max: Device A cost and Device B cost

But it would be much nicer just to design a compositional helper, a Max, that had as children two Multiply helpers.

  • Max:
    • Multiply: Device A kwh * Tariff
    • Multiply: Device B kwh * Tariff

This would prevent a lot of both effort and entity pollution.

Related WTH: Make controlling of Helpers more user friendly in Automations (like Devices are)