Skip to content

4.5. Conditions

John edited this page Dec 25, 2015 · 8 revisions

Conditions provide the possibility to enable/disable complete messages for a particular variant of a device.

A good example for this is a product line of heat pumps, each of which answers to the same query with different meanings of the returned values (e.g. evaporator temperature versus air outlet temperature).

In order to make a message definition conditional, the first field (the message type) has to be prefixed with one or more condition names in square brackets. The rough syntax of a conditional message definition is this:

[conditions part]message part,fields part

The conditions part consists of one or more condition names in square brackets, e.g.:

[brinetowater][SW>201][HW>=100]r,ehp,prerun,,,08,B509,0D9E01,...

In this example, the message "prerun" for the circuit "ehp" is only valid, if the conditions named "brinetowater", "SW>201", and "HW>=100" are all met, i.e. these are combined using a logical AND operator.

Condition definition

In order to use a named condition, it has to be defined in the same CSV file before the message using it. A condition definition line is prefixed with a "*" (just like a defaults row) and looks like this:

*[CONDITIONNAME],MESSAGECIRCUIT,MESSAGENAME,COMMENT,FIELDNAME,ZZ,VALUES

The individual columns are these:

  • CONDITIONNAME:
    The name of the condition.
  • MESSAGECIRCUIT:
    The circuit name of the message carrying the values the condition is composed of (defaults to the own circuit name derived from the CSV file name).
  • MESSAGENAME:
    The name of the message carrying the values the condition is composed of. If left empty, the condition references the scan of the own slave address or another.
  • COMMENT:
    An optional comment for the condition.
  • FIELDNAME:
    The name of the message field carrying the values the condition is composed of. If left empty, the first numeric field of the message is used instead.
  • ZZ:
    The optional slave address from which to read the message (defaults to the own address derived from the CSV file name).
  • VALUES:
    The list of numeric values the referenced message field has to match in order for the condition to be true. Multiple items are separated by a semicolon. Each item is either a single value (e.g. "18"), a simple value range separated by a dash (19-22), or a value range using numeric compare (e.g. "<=5", ">10").
    If left empty, the referenced message is only checked for having been seen.

Examples

Here are some example condition definitions:

*[brinetowater],ehp,ApplianceCode,,,,4-10
This condition is true, when the first numeric field of the message named "ApplianceCode" in the circuit "ehp" has a raw value between 4 and 10 (both inclusive).

*[dhw],mc,CfgHeatSinkType,water,,,2
This condition is true, when the first numeric field of the message named "CfgHeatSinkType" in the circuit "mc" has a raw value of 2.

*[SW>201],scan,,,SW,,>201
This condition is true, when the scan of the own slave address reveals a software version of higher than 201.