HoBo.pm
Defines maximum length for a Readingname (MAXLEN_RN) and for a Device name (MAXLEN_DN).
goodDeviceName
goodReadingName
$valid = goodReadingName($name);
This function checks if Readingname $name
is a valid format which means up to MAXLEN:RN and consisting of any UTF-8 character except
- whitespace (
\s
)
If the identifier starts with a dot .
, it's considered to be an internal identifier and is treated differently in visualization, i.e. hidden. The leading .
is not included in MAXLEN_RN length considerations.
For valid identifiers a true value is returned, false otherwise. This function can be used in if-constructs directly to test whether a Readingname is valid or not.
makeDeviceName
makeReadingName
$validName = makeReadingName($name);
This function removes from given Readingname $name
all invalid characters and replaces them with the underscore _
. Also, if the Readingname is longer than MAXLEN_RN it is pruned to this maximum length. The return value $validName
is a Readingname that has only valid characters in it (see goodReadingName
).
If $name
was already valid, $validName
equals $name
.