Text Input to Miniserver

Contents





The Miniserver doesn’t have a simple function to ingest Text strings. A Virtual Input can, however, ingest a single character. Further, we can build a string of characters using Status Blocks. The method is somewhat tedious to set up, however it does have the benefit of being contained entirely within the Miniserver. ie. a separate server or Loxberry is not required.

The primary motivation for this function is to send a variable text string to a Text-to-Speech output. The secondary motivation is to provide a text field in the Loxone App. Other uses include retrieving multi-character tokens for authentication flows in IoT devices.





The attached Loxone Config file contains the populated Status Blocks. This framework can be adapted to any text field including web-pages, calendars and RSS feeds. It can also be used with the saved response from a Virtual Output when the VO Command is set to 'Save HTTP reply'. The following is another example of a variable text display –







There are 53 Status Blocks connected in this file (which creates a 53 character text string). This number simply represents a comfortable amount of Status Blocks that can fit on one Config tab. More characters can be added using additional Status Blocks if required.

If less characters are required, delete Status blocks from the end of the chain, working back towards the beginning.



Adjusting Command Recognition with Virtual Inputs

The Virtual Inputs need to be created and adjusted to the desired application. Command Recognition has a facility to ingest single bytes. This is done with the following example from a CalDAV-4-Lox calendar event –

We wish to retrieve the text ‘Yello lid recycling bin’.

The first Virtual Input’s Command Recognition to retrieve the text after Summary is as follows -

"Summary": "\s0\1

This will ingest the first byte from the Summary field of the calendar title (ie. the single text character Y).

The next two Virtual Input’s Command Recognition will ingest the second and third bytes (text characters e and l) in the Summary field of the calendar title.

"Summary": "\s1\1

"Summary": "\s2\1

Three Virtual Inputs are required to retrieve the first three characters Yel. You will need to create as many Virtual Inputs as dictated by the largest expected text length.

Note that in the example Command Recognition above there are quotation marks (") around "Summary" that are not visible in the original web-page. In a browser (eg. Chrome browser), right click the page and 'View page source'. This will display invisible text that may be required for correctly functioning Command Recogntion.



Important - The Miniserver processes the Virtual Inputs in the order they were created. The processing order is essential for the correct functioning of the text recognition. For this reason, create the Virtual Input called 'Byte 1', then create 'Byte 2', then create 'Byte 3' etc.

Failure to observe this will cause errors in the text recognition.



Command Recognition Blocks

An alternative to using Virtual Inputs for injesting text is when the text already exists within the Loxone Configuration. The Command Recogniton syntax is the same as that used for a Virtual Input. An example is depicted below where a specific lighting Mood Name is required for further use. The Mood Name is called RELAXING and the Command Recognition syntax is depicted (ie. \s17\1). The values output from the Command Recognition blocks will be used as described below.


The values returned to the Miniserver (via Virtual Input or Command Recognition block) will be the ASCII decimal value (Dec) for the particular character (Chr). For standard characters, those values are as follows -

Standard ASCII Table



The word ‘The’ will be interpreted as 84 (T), 104 (h), and 101 (e)


The string of Status Blocks acts as a simple ASCII to text converter. Each Status Block derives one character, then appends it to the previous block’s text string. The sequence cascades until a delimiter is encountered (ie. the symbol that marks the end of the text field).

 

Hover the cursor over the TQ field with Liveview active to see the current text string.

 

The Delimiter

In the case of CalDAV-4-Lox, the delimiter is the next instance of " (quotation mark). We need to create sufficient Virtual Inputs to cover the largest expected text length for what might be a variable length text string. When shorter length text occurs, we then need to identify where the text stops by recognising the delimiter.



The Status Blocks continue to cascade the text sequence but do not add any characters from the " symbol onwards. The ASCII decimal value for " is 34.

The ‘Unique 1st Block’ has an empty Status-text value against Value 34. This means that no character will print for value 34.





The ‘Repeating block’ has the Status-text as <v1>, but doesn’t add any more characters if the previous block was a delimiter ". The ‘State value’ 34 is output to subsequent blocks. This means they also won’t add characters.





Different delimiters might be used for different applications. If this is the case, modification of the Status Block is required.

Delimiter for RSS Feed

An example RSS feed is given below. In this case the delimiter is the < (less than symbol).

 



To alter the example file to suit this RSS feed, it is preferable to delete all Status blocks except for the ‘Unique 1st Block’ and the first ‘Repeating block’. After modifying the ‘Repeating block’, it will need to be copied multiple times and connected as originally done (a simple but tedious process…)

The ‘Unique 1st Block’ will need the following modifications.

  1. Add in the " (quote) symbol in-line with Value 34. We want this symbol to be printable again.

  2. Delete the Status-text in-line with Value 60. The ASCII decimal value for the < symbol is 60 and we don’t want it to print.



The ‘Repeating block’ will need to be modified at four places –

  1. AI2 = 60. This is because 60 is the ASCII decimal value for the < symbol,

  2. Status-text = <v1> and State value = 60,

  3. The value for 34 can be returned to a printable character by placing " (quote) after the <v1>,

  4. Change AI3 = 60 to a non-printable character by deleting the symbol < after <v1>.



Now copy and paste the ‘Repeating block’ multiple times and join up….!

If you wish to check progress at any stage, create a link from the TQ output of the last 'Repeating block' and join to the input of the 'Virtual Status' block.



Extended ASCII Characters



Some provision has been made for Extended ASCII characters in the text recognition. Those characters are -

ä   Ä   ö   Ö   ü   Ü   ß   €   £

These characters require more than one byte for recognition. In the case of the euro , the symbol requires 3 bytes. The values presented by the symbol are 226, 130, and 172.



The ‘Unique 1st Block’ has an empty Status-text against value 226. The ‘Repeating block’ has the logic nested within a single block, but the process identifies the character over three blocks.







Using this method, additional Extended ASCII Characters can be added as desired.



When a character is not defined in the Status Block, the Status Block will print a blank space.

Eg. Test this symÃbol.







Related Articles

CalDAV-4-Lox

TTS-Engine