Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ardisdk:creating_an_event_ardi_driver [2024/09/24 06:29]
optrix created
ardisdk:creating_an_event_ardi_driver [2024/09/24 23:46] (current)
optrix [Creating a Web Interface]
Line 54: Line 54:
 Your class has access to some important functions and variables. Your class has access to some important functions and variables.
  
-===Query.AddLine()===+===Query.AddLineFromDictionary()===
  
-This function is responsible for outputting a line of historical data to be sent to ARDI. +This function is responsible for outputting an event that is then sent to ARDI. 
  
 ^Parameter^Purpose^ ^Parameter^Purpose^
-|Address|The address that this value was read from| +|Dictionary|A dictionary describing the event. At minimum, it should include the keys **start** and **name**.|
-|Date Stamp|The date that the measurement was made (as datetime)| +
-|Value|The value read from your data source+
  
-Note that if your historical data link has a transform attachedthis function will automatically apply the transform for you.  +Data from the dictionary is used to create an Event. Each event needs - as an absolute minimum - a **start** element (containing the UTC date/time of the event) and a **name** element (used to identify the event). 
 + 
 +They may also include **end** or **duration** properties. //End// is the UTC date/time when the event is complete, and //Duration// is the number of seconds the event lasts for. Note that if both //end// and //duration// are given, the 'end' time is given priority. 
 + 
 +Any other properties you include are displayed as **metadata** for the event. For example, you could include status information, averages or totals for key events. These other elements are not translated (ie. any dates/times given in these properties will **not** be translated into UTC).
  
 ===self.core.logger=== ===self.core.logger===
Line 200: Line 202:
 This will require some basic HTML & PHP. This will require some basic HTML & PHP.
  
-Firstly, copy one of the existing drivers user interfaces by copying **/opt/ardi/web/data/live/text** to **/opt/ardi/web/data/live/text2** (the folder name must match the name of the driver folder & file).+Firstly, copy one of the existing drivers user interfaces by copying **/opt/ardi/web/data/event/logfile** to **/opt/ardi/web/data/event/logfile2** (the folder name must match the name of the driver folder & file).
  
 There are several PHP files in this folder. Click on them for examples and documentation on what they do. There are several PHP files in this folder. Click on them for examples and documentation on what they do.
Line 209: Line 211:
 |[[saveconfig-source_php|saveconfig-source.php]]|Convert the properties set in //configure-source.php// to a machine-readable address string| |[[saveconfig-source_php|saveconfig-source.php]]|Convert the properties set in //configure-source.php// to a machine-readable address string|
 |[[friendlyname_php|friendlyname.php]]|Convert the address from //saveconfig-source.php// to a human-readable text string| |[[friendlyname_php|friendlyname.php]]|Convert the address from //saveconfig-source.php// to a human-readable text string|
-|[[link_php|link.php]]|The user interface for setting up a data link between the source and an asset property| 
-|[[encode_php|encode.php]]|Convert the properties set in //link.php// to a machine-readable address string| 
-|[[decode_php|decode.php]]|Convert the address from //encode.php// to a human-readable description|