Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleConfiguration of the download trigger rule
 	<rule rule_id="Prodos download trigger">
 	  <triggers>
 	    <trigger value_name="dosing_mode" value_type="string" trigger_topic="calibrated_result" sensor_id="globalstates_dosing_mode"/>
 	  </triggers>
 	  <conditions>
 	    <condition expr="dosing_mode == 'AUTO Dosing _ END' or dosing_mode == 'Dosing _ END'">
 	      <true>
 	        <action_list>
 	          <action action_id="download_memodata" command="download"/>
 	        </action_list>
 	      </true>
 	    </condition>
 	  </conditions>
 	</rule>

Please refer to The the da_rest_client action to get more information about the download action.

...

Code Block
languagexml
titleConfiguration of the download action
    <action action_id="download_memodata" device_id="rest_test">
      <commands>
        <command command_id="download">download('/fcgi/control/memodata_download')</command>
      </commands>
    </action>

Determine the completion of memodata download

As described in the da_rest_client action the da_rest_client is able to represent the download completion and the download time in a specific sensor gateway (the sensor gateway id is identical to the device id of the da_rest_client).

Code Block
languagexml
titleConfiguration of a sensor to indcate the download
    <sensor sensor_id="rest_download_file">
      <sensor_class>unknown</sensor_class>
      <upload>always</upload>
      <error_severity>200</error_severity>
      <state_evaluation_expressions>
        <state_evaluation_expression>
          <expression>True</expression>
            <true>%value%</true>
        </state_evaluation_expression>
      </state_evaluation_expressions>
      <sensor_gateway sensor_gateway_id="rest_test">
        <demux>
          <keys>
            <key>dl_file</key>
          </keys>
        </demux>
      </sensor_gateway>
    </sensor>


Info

For a valid XML configuration it is required to add the sensor gateway id to the device configuration of the da_rest_client:

Code Block
languagexml
   <device device_id="rest_test">
     <rest_client_device>
       <host>...</host>
     </rest_client_device>
      <sensor_gateways>
      	<sensor_gateway sensor_gateway_id="rest_test">
      	  <simulator/>
      	</sensor_gateway>
      </sensor_gateways>
   </device>


Processing of the downloaded memodata

An AutomationController rule detects the completion of a download

Code Block
languagexml
titleConfiguration of a processing trigger rule
 	<rule rule_id="Prodos log processing">
 	  <triggers>
 	    <trigger value_name="dl_file" value_type="string" trigger_topic="calibrated_result" sensor_id="rest_download_file"/>
 	  </triggers>
 	  <conditions>
 	    <condition expr="dl_file is not None">
 	      <true>
 	        <action_list>
 	          <action action_id="process_memodata" command="go"/>
 	        </action_list>
 	      </true>
 	    </condition>
 	  </conditions>
 	</rule>

The action itself is configured this way:

Code Block
languagexml
titleConfiguration of a memodata processing action
    <action action_id="process_memodata" device_id="VirtualSensorProvider">
      <commands>
        <command command_id="go">launch_exec_job('process_memodata')</command>
      </commands>
    </action>

Please refer to the Prodos log processor to get detailed information about the processing. For completeness the minimal configuration in the SiteController.cfg to launch the processing is shown here:

Code Block
languagebash
[remote_exec_calls]
process_memodata=/opt/azeti/SiteController/src/prodos_log_processor.py