Skip to content

4.2. Defaults

John edited this page Apr 27, 2024 · 8 revisions

Usually, field values can not only be read from a device but also be written to that device. In order to avoid duplicate message definitions, defaults can be used.

A row starting with a star symbol "*" in front of a message type defines the defaults for further rows in that file. The defaults will then be used for blank columns of a message definition with that message type (ignoring the poll priority).

One exception to this generic approach is the "CIRCUIT" column which might consist only of the security level as explained in the message definition (e.g. "#installer"). In this case, the circuit itself is kept as it is but the access level is adjusted.

Another exception is the "ID" column: The value of the ID column in a defaults row will be prepended to the "ID" column in message definitions of that type having an empty "PBSB" column.

Fields part of a defaults row will be prepended to the fields of a message definition of that type.

When the default text for the message circuit, name, or comment column contains a star symbol, the value from the default row will be combined with the value from the actual row by replacing the first star symbol in the default text with the actual text, e.g. "prefix*suffix" in defaults plus "middle" in the row will lead to the result "prefixmiddlesuffix".

Example

By using defaults, the example from the previous chapter can be reduced to this:

type circuit name comment QQ ZZ PBSB ID field1 part type/templates divider/values unit comment field2 part type/templates divider/values unit comment
*r ehp 08 B509 0D
*w ehp 08 B509 0E
r1 brinetemp 0F00 temp D2C °C temperature sensor UCH 0=ok;85=circuit;170=cutoff sensor status
r;w brinetempcal CD00 calibration D2C K
Download CSV

Defaults for conditions

There is another version of a defaults row when it starts with "*[". In this case, the row defines a condition that can be used for conditional messages. See Conditions for details.

Defaults extracted from the file name

From the CSV configuration file name certain parts are extracted and used as defaults for a defaults row if that does not define these values.

The potential parts extracted from a file name matching the format "ZZ[.IDENT][.CIRCUIT][.SUFFIX][.*].csv" are these:

  • ZZ: the device slave address
  • IDENT: the device identification (see Scanning)
  • CIRCUIT: the optional circuit name (instead of the IDENT part)
  • SUFFIX: the optional suffix to the circuit name (or IDENT if CIRCUIT is missing)

Note: The defaults from file name are only applied to the defaults rows. If no defaults row is present, the defaults from filename are not used at all.