Math when setting values

Issue #56 resolved
Marius Flugsrud created an issue

Hey,

I often use math when setting values, but currently I have to use Temporary Variables and then use the result from that card in the THEN card of Device Capabilities. It would be great if I could skip that step and use math directly when setting AVD values.

Here are some stuff I sometimes use:

{{round(max(temperature + 2,20),1)}} to get a set set-temp for a thermostat based on current temperature, but avoid too low temperatures.

{{round(Min+(Max-Min)*Price_ratio,1)}} to set set-temp thermostat to a value based on price ratio (from Heating Controller).

Comments (8)

  1. Marius Flugsrud reporter

    Oh, I have to use that then card. How about enabling expressions directly in the false/true and number fields?

  2. arie repo owner

    “How about enabling expressions directly in the false/true and number fields?”

    I have no idea how to do that?

    Is that something i can configure? Can you have an example where that can be done?

    I am Adding an BLL Expression card btw.

  3. Marius Flugsrud reporter

    Aren’t you already doing it with the card you used in the screenshot?

    What’s the difference between the regular/current expression card and the BLL card you’ll add? What’s the disadvantage with having just one expression card (where you can use BLL)?

  4. arie repo owner

    The current expression card is an “old” card, allowing for functions within the DC app. I need to keep that for legacy.

    However, the BLL expressions are more powerfull, contain more default functions and modules, and more customisation.

    And more and more users use BLL coding/expressions, so i want to include it int AVDs.

    About enabling expressions within false/true and numbers fields, i cannot, or i would need to change the argument type all to string.
    And than you would have the same as the expression card ;)

    And there are some advantages to having dedicated number and yes/no SET flowcards.

  5. Marius Flugsrud reporter

    Oh, right, fair point about keeping the old card for legacy.

    Thanks for the help, closing this. :)

  6. Log in to comment