Converters
Converters are helper functions that come into play when you want to change the way some Signal K data appears in a SKipper Control. For example, position data is stored in Signal K in a format that's not very easy to read, but with a converter, it becomes very easy to read. (See image below.) Other converters exist to match Zones in Signal K to colors in SKipper, to convert dates and times in Signal K to the desired format in SKipper, and to extract almost any data from a JSON object in Signal K and use it however you want in SKipper. As more people user SKipper for more things, more converters will be added.
All of the converters are described below. If you need a new converter, please let us know on Support.
Position to WGS-84 String
As the name suggests, this converts the Signal K path navigation.position structured JSON value into a string. Available string formats for latitude and longitude are: DDD°MM'SS'' N/S/W/E
or 000.000 N/S/W/E
. With either one, you can select the "Two lines" option to display the position as shown in the above example.
Zone to Color
This converter allows you to use the Signal K Zones feature to change the color of something in SKipper depending on the Zone state. When the Zone state is either Normal or Nominal, the converter returns Green; when the Zone state is Warning, the converter will return Orange; and when the Zone state is Alert, Critical, or Emergency, the converter will return Red. There is also an argument to this converter that allows you to set the colors to "translucent", which you may prefer.
When using this converter, you must use it on one of the colors properties of the Control. (Using it on the value of the Control will do nothing). For example, if you are using the Horizontal Bar Control to display the voltage of a battery, and you want the colored bar of the Horizontal Bar Control to change color based on the Zones that you have defined in Signal K, you must bind the "Stroke color" property of the Horizontal Bar Control to the path in Signal K for which you have defined the Zones. In this case, it might be 'electrial.batteries.house.voltage'. So you bind this path to the Value of the Control, but without the "Zone to Color" converter. Then you also bind this path to the Stroke Color of the Control, and this time, you enable the "Zone to Color" converter.
Datetime to String
This converter allows you to parse various date and time strings from a datetime daa path in Signal K. You can select the following output strings: - datetime - shows the full date and time in the format of the local device and culture. - twolines - shows the same data as the 'datetime' argument (minus the seconds), but the date is on one line and the time is on a new line below the date. - date - shows only the date in the format of the local device and culture. - time - shows only the time in the format of the local device and culture. - difference - shows the time span between the local device time and the time of the selected Signal K path, in the format 'hh:mm:ss'.
The image below shows most of the options presented above.
You can choose the time zone for the displayed date and time. (See image below.) When 'local' is selected, SKipper will use the local time zone defined by the device. When a specific UTC option is selected, it will always display the date and time in that time zone. SKipper always assumes that the date and date time coming from Signal K is UTC/GMT.
JSON Template Converter
This converter allows you to extract specific data from a Signal K JSON object.
When you bind a SKipper data field to a specific path in Signal K, you're actually binding it to the JSON object that the path points to. Usually, the data in that JSON object is a single value, and SKipper extracts the data by extracting the value of the single element, which is represented in the JSON object like this: { propertyName : 10 }.
But some Signal K paths point to JSON objects that contain more than one data element, like the navigation.position path. See the image at the top of this page that shows the unformatted GPS position data as it's stored in a JSON object. There are two data elements, longitude and latitude. With the JSON Template Converter, you can directly access the value of the individual elements.
To extract more than just a single value, and to give it a label and some formatting, you can enter something like Latitude {{latitude}}{{$newline}}Longitude: {{longitude}} in the "Converter settings" field of the JSON Template Converter, and you'll see the output in the image below. Notice that you can type in simple text (in the example, we typed Latitude, Longitude, some colons, and some spaces), some formatting ($newline), as well as the names of the two properties you want. Also notice that you use two sets of curly brackets around each element that needs to be converted to something other text.
To extract a single numeric value from a JSON object in any Control that can display a numeric value, you can just type name of the JSON object property that contains the data you want, and SKipper will try to extract the number and convert it to the correct type. The image below illustrates this:
- (top frame) The raw JSON object that's stored at the navigation.gnss.satellitesInView path.
- (middle frame) Extracting only the value of the count property for a simple digital display, by typing just 'count' into the "Converter settings" field.
- (bottom frame) Extracting only the value of count for display in the Analog Gauge.
How to Extract the value of the "count" property. (You don't need any brackets around the property name, but you can put them in if you want. That is, either count
or {{count}}
will work.)
TimeSpan Converter
This converts a number of seconds to a time span, represented as hh:mm:ss
. By Default, any part of the time, starting from the left, will be omitted if it's 00, so 00:24:18
will display only 24:18
. If the argument is set to Full, the format will always be hh:mm:ss
, even when there are only seconds left (like 00:00:42
). You also have options to output Total hours or Total minutes, with no other parts of the time displayed. (This Converter was added for the benefit of some sailors for racing, so they could have a countdown to the start of the race, by using this Converter on the path navigation.racing.timeToStart.)