sendscript

The sendscript contains the relevant code to generate a controlstring from a list of lines and send it to the zuil.

class infozuild.sendscript.DisplayMode(mode, address=0)[source]

Represents an instruction to set the controller’s display mode.

to_controlstring()[source]

Generate a control string from the known mode and address.

Returns:A string that may be sent to the controller to set the display mode.
class infozuild.sendscript.Page(lines=None)[source]

Represents one screenful of text. All attributes may be None to inherit the setting used by the previous Page.

lines

list – a list of strings containing the text to display. Should contain 8 strings when sending.

blinkspeed

int – an optional integer controlling the duration of the transition to the next page, in half-seconds. 0 <= blinkspeed <= 4.

duration

int – an optional integer controlling the time the controller waits until advancing to the next page, in milliseconds. Due to a quirk in the encoding, the set value will be rounded to floor(duration/26.7) on sending. 0 <= duration <= 218450.

brightness

int – an optional integer controlling the brightness of the leds for this page. 0 <= brightness <= 17.

scrolling

bool – A boolean that will, if True, make the letters on the page scroll in from above.

fading

bool – A boolean that will, if True, make the contents of the page fade in and out.

build_duration()[source]

Return 4 characters representing the duration of this page.

build_schedular()[source]

Return 7 characters respresenting the schedular, whatever it may be. (Unused)

classmethod from_dict(data)[source]

Initialize a page from a dict of attributes.

classmethod from_json(jsonstring)[source]

Initialize a page from a JSON-string.

to_controlstring()[source]

Convert the page to a controlstring.

Returns:A string that may be included in the controlstring of a Rotation.
Raises:ValueError if any attributes are out of range.
to_dict()[source]

Dump all relevant attributes as a dict.

to_json()[source]

Dump all relevant attributes as a JSON string.

class infozuild.sendscript.Rotation(address=0, pages=None)[source]

Contains a set of Pages that should be displayed, and the controller address.

pages

list – A list of Pages which will be shown in the given order.

address

int – The controller index to update, usually zero.

classmethod from_dict(data)[source]

Initialize a Rotation from a dict with a list of pages and address.

classmethod from_json(jsonstring)[source]

Initialize a Rotation from a JSON-string.

to_controlstring()[source]

Convert the Rotation to a controlstring that can be sent to the controller.

to_dict()[source]

Dump all relevant attributes as a dict.

to_json()[source]

Dump all relevant attributes as a JSON string.

Enclose the given text with the blink escape code.

infozuild.sendscript.bold(text)[source]

Enclose the given text with the bold escape code.

infozuild.sendscript.check_in_range(*items)[source]

Takes a number of (name, value, min, max) tuples and verifies that all min <= value <= max.

Raises:
  • ValueError if a value that is outside the given range is found. Any
  • additional values are not checked.
infozuild.sendscript.connect_and_send(host, controlstring)[source]

Open a connection to host and send the given control string.

infozuild.sendscript.decode_value(character)[source]

Convert an ascii character to a numeric value.

infozuild.sendscript.encode_value(value)[source]

Convert a numeric value to an ascii character.

infozuild.sendscript.main()[source]

zuil-send entrypoint.

infozuild.sendscript.script_set_text(args, host, address)[source]

Send a new Rotation to the zuil. Called from main().

Parameters:
  • args (argparse.Namespace) – Parsed command line arguments.
  • host (str) – Hostname or IP of the controller.
  • address (int) – Controller index
infozuild.sendscript.set_rtc(address=0, when=None)[source]

Generate an instruction to set the controller’s RTC (Real Time Clock) to the given time and date.

Parameters:
  • address – an optional integer specifying which controller to update. Should be left on zero.
  • when – an optional datetime.datetime instance that contains the new values for the RTC. The system date and time will be used if omitted.
Returns:

A string that may be sent to the controller to update the clock.

The RTC can be used in control strings with the special values as documented in Protocol.md.

infozuild.sendscript.start_controlstring(address)[source]

Generates the common header for control strings.

infozuild.sendscript.update_displaymode(host, mode, address=0)[source]

Generate a controlstring that will set the display mode, and immediately send it.

Parameters:
  • host (str) – Hostname or IP of the controller.
  • mode (int) – Display mode to switch to, see Display modes.
  • address (int) – Controller index
infozuild.sendscript.update_rtc(host, address=0, when=None)[source]

Generate a control string that will set the controller’s RTC to the given time (or the system time if None), and immediately send it to the controller.

The RTC

Some substrings, when used in the text on a page, will be automatically replaced with something else:

Original Replacement
%M Numeric month (01 for January, etc.)
%D Numeric day in month
%H Hour (24-hour clock)
%m Minute
%S Second
%R Hourglass glyph indicating time until next page

Display modes

The following display modes are listed in the manual:

  1. Blank. The display will blank until the mode is changed to normal or test on. New pages can be entered while the display is blanked, and the currently stored pages are kept.
  2. Normal. The controller will operate as usual, displaying the pages loaded earlier. Setting this mode multiple times does not seem to have any special effect.
  3. Test off. Setting this mode will disable the testing sequence and blank the display, and allow for new pages to be entered.
  4. Test pause. Setting this mode will pause the rotation of test pages on the current page. Setting this mode does not pause the rotation of normal pages.
  5. Test on. Setting this mode enables testing mode, which makes the controller show some pre-defined pages to turn on all leds and such. When test mode is enabled, all previously stored pages are forgotten!
  1. Output. According to the manual, setting this mode will toggle some kind of hardware output on the controller board. We don’t seem to use this and it has not been tested.