Senzorv1.0.0

Validation errors

Every problem Senzor reports when it loads a project, what it means and how to fix it.

Senzor checks a project whenever it loads it: senzor-cli validate and senzor-cli run check it before they do anything else, and the GUI checks it after every edit and lists the problems in the Problems tab. This page lists every message. In the messages, <name> stands for a part that Senzor fills in.

Reading a problem

A problem reads <location>: <message>. senzor-cli puts the path of the project file in front:

project.toml: device `office`: unknown template `co-2`
LocationRefers to
line <L>, column <C>A TOML syntax or schema error at that position.
project fileA TOML error the parser cannot place.
brokerThe [broker] table.
template `<id>`The [[templates]] entry with this id.
device `<id>`The [[devices]] entry with this id.

How problems are reported, and what they block:

  • A TOML error stops loading, so it is the only problem reported. Fix it and validate again to see the rest.
  • Otherwise every problem is reported at once: broker problems first, then templates and devices in file order.
  • A broker problem blocks every device.
  • A template problem blocks every device that uses the template. Those devices get no message of their own.
  • A device problem blocks that device.
  • Senzor checks a device's instance IDs and renders its templates only when the device's other settings are valid, so fixing one problem can reveal the next.

senzor-cli runs nothing while there is any problem, and exits with code 2. The GUI runs the devices that are not blocked; see Editing while running.

File syntax and schema

These come from the TOML parser and carry a line and column. The most common ones:

ExampleMeaning and fix
unknown field `prot`, expected one of `host`, `port`, …A key that this table does not have. Fix the spelling; the message lists the valid keys.
missing field `template`A required key is missing. Add it.
invalid type: string "x", expected u16The value has the wrong type, here a string where a number belongs.
invalid value: integer `70000`, expected u16The number is out of range; a port is at most 65535.
invalid value: integer `-1`, expected u64The number must not be negative, as for seed.
invalid value: string "30", expected a durationA duration without a unit. Write "30s".
invalid type: integer `30`, expected a durationA duration written as a number. Write it as a string with a unit, "30s".
unknown variant `linear`, expected one of `constant`, `random_walk`, `sine`, `uniform`, `sequence`An unknown generator name.
missing field `generator`A field table without a generator key.
data did not match any variant of untagged enum ValueA param or value that is not a string, number or boolean, such as an array.
unclosed table, expected `]`A TOML syntax error.

See Project file reference for every key and its type.

Broker

MessageMeaning and fix
host must not be emptyhost is empty or only spaces.
port must not be 0Use the broker's port, 1 to 65535.
keep_alive must be at least 1sSet keep_alive to "1s" or more.
use either password or password_env, not bothRemove one of them.
environment variable `<name>` (password_env) is not setSet the variable before you start Senzor or run senzor-cli.
a password requires a usernameAdd username, or remove the password.
cannot read tls.<key> `<path>`: <reason>A TLS file (ca_file, client_cert or client_key) cannot be read. Relative paths start at the folder of the project file.
tls.client_cert and tls.client_key must be set togetherSet both, or neither.
tls.client_cert requires tls.ca_fileAdd ca_file when you use a client certificate.

Templates

MessageMeaning and fix
`<id>` is a built-in template id; choose another idco2, temperature and humidity are taken by the built-in templates. Rename the template. Devices that use the ID keep using the built-in one.
duplicate template idTwo templates have the same id. Rename one.
at least one message is requiredmessages is empty.
at least one field is requiredfields is empty.
qos must be 0, 1 or 2, got <n>Set qos to 0, 1 or 2.
interval must be greater than 0interval is "0s".
field `<name>` uses a reserved nameRename the field; see reserved names.
field `<name>`: <problem>The field's generator breaks a rule; see Generator problems.
syntax error: <details> (in <template>:<line>)A topic or payload is not valid Jinja. <template> is messages[<n>].topic, messages[<n>].payload or availability.topic, with messages counted from 1.

A syntax error is reported for the first broken template string only. For example, a payload {{ v without the closing braces gives syntax error: unexpected end of input, expected end of variable block (in messages[1].payload:1).

Generator problems

Reported as field `<name>`: <problem> in a template, and as field `<name>` override: <problem> in a device. See Generators for the parameters.

ProblemMeaning and fix
numbers must be finiteA parameter or value is nan, inf or -inf.
noise must be greater than 0Remove noise or make it positive.
noise requires numeric valuesnoise on a constant or sequence whose values are not all numbers.
min must be less than maxrandom_walk or uniform with min equal to or above max.
start must be between min and maxMove start inside the bounds of the random_walk.
step must be greater than 0Give the random_walk a positive step.
period must be greater than 0Give the sine a period longer than "0s".
values must not be emptyGive the sequence at least one value.

Devices

MessageMeaning and fix
unknown template `<id>`No template in the file or among the built-ins has this ID. Check the spelling.
duplicate device idSeveral devices have this id. It is reported once and blocks all of them. Rename all but one.
count must be at least 1count is 0.
interval must be greater than 0The device's interval is "0s".
param `<name>` uses a reserved nameRename the param; see reserved names.
param `<name>` has the same name as a fieldThe template has a field with this name. Rename the param.

Rendering problems

Senzor renders each device's templates once while it validates, for the first instance and with sample values (see Template variables). It reports the first failure.

MessageMeaning and fix
undefined value: `<name>` is undefined (in <template>:<line>)A template uses a variable that does not exist here: a typo, a param this device does not set, or a variable this template string cannot see.
availability topic: topic is emptyThe availability topic renders to nothing.
availability topic: topic `<topic>` contains a wildcard (+ or #)The rendered availability topic contains + or #, maybe from a param.
message <n> topic: topic is emptyMessage <n> (counted from 1) has a topic that renders to nothing.
message <n> topic: topic `<topic>` contains a wildcard (+ or #)The rendered topic of message <n> contains + or #.
Other MiniJinja errors, e.g. unknown filter: filter <name> is unknown (in <template>:<line>)A filter or operation fails on the sample values.

Field overrides

MessageMeaning and fix
override of unknown field `<name>`The device overrides a field its template does not have. Check the field name.
field `<name>` override: <problem>The field after the override is not a valid generator. <problem> is one of the generator problems or a schema error such as missing field `max` (an override with generator replaces the whole field, so it needs every parameter) or unknown field `stepp`, expected one of `start`, `min`, `max`, `step`, `noise`.

See Field overrides for how overrides merge.

Instance IDs

MessageMeaning and fix
instance_id: syntax error: <details> (in <string>:1)instance_id is not valid Jinja.
instance_id: undefined value: `<name>` is undefined (in <string>:1)instance_id uses a variable it cannot see. It can use id, index and the device's params.
instance_id renders to an empty stringinstance_id produces an empty ID.
instance id `<id>` repeats; include {{ index }} in instance_idTwo instances of the device get the same ID. With count above 1, put {{ index }} in instance_id.
instance id `<id>` is already used by device `<device>`An instance ID of this device is also an instance ID of an earlier device. Change instance_id or the device id.

(in <string>:1) is literal text: it is how MiniJinja names the instance_id template.

On this page