Network-Time-Server-DIA-example

Overview

This simple DIA example is a NTP (Network Time Protocol) connector / driver. With it, you can easily direct your ConnectPort-X to update its system time via any publicly available time server.

Prerequisites

You should register at www.digi.com/products/cloud/digi-device-cloud and then download DIA. After that, read the Getting Started guide and begin looking at the simple drivers (found under ../src/devices in the DIA source code tree). You should have a basic working knowledge of DIA (how to start / stop & use basic drivers / presentations) before proceeding.

Step 16:  

Download the Network_Time_Protocol_Dia_Driver.zip archive. The included "yml" file is the configuration is used when starting the DIA application. It's included here for reference.

## NTP Time Server DIA Configuration File
devices:
# The ntp_time_device device driver; creates a demonstration device
# containing a network time server address and timezone settings.
# Recommended update_rate for this driver is 86400 seconds (1 day).
- name: ntp_time
  driver: devices.ntp_time_device:NTPTimeDevice
  settings:
      Time_Server: "2.fedora.pool.ntp.org"
      Time_Zone: -6
      update_rate: 3540

presentations:
# Create a new console instance on TCP port 4146.  It can be connected
# to by using any telnet client.
- name: console0
  driver: presentations.console.console:Console
  settings:
      type: tcp
      port: 4146
  # Create a web presentation instance.  When running on a PC this will
  # start a new web-server on a default port
  # When running on a Digi device this presentation will "extend" the  
  # web-server built in to the Digi device with a new page named
  # "idigi_dia.html".
  - name: web0
    driver: presentations.web.web:Web
    settings:
        page: idigi_dia.html
        port: 8081

Step 17:  

Re-compile DIA to using this configuration file or incorporating the elements you require. You can do this via the command line (Python make.py ntp_time.yml) or using the Digi IDE for DIA.

Step 18:  

Test the "virtual" device with your browser (Gateway IP Address/idigi_dia.html) or via telnet (to port 4146 on your Gateway). You can adjust the Time Server, Time Zone and the update rate (in seconds).