Sign inSign up

beetaone/signal-timer

By beetaone

Updated almost 2 years ago

Image
0

145

beetaone/signal-timer repository overview

Signal Timer Python Processing Module

namePython Signal Timer Processing module
versionv1.0.0
DockerHub Linkbeetaone/signal-timer
authorsDenis Pilon, Bruno Lipovac

Table of Content


Description

This is a Python Processing module which is a basic signal duration timer. It monitors the input and starts a counter measuring the duration that the signal keeps or exceeds a certain value.

Module Variables

The following module configurations can be provided in a data service designer section on beetaone platform:

Environment VariablestypeDescription
MODULE_NAMEstringName of the module
MODULE_TYPEstringType of the module (Input, Processing, Output)
LOG_LEVELstringAllowed log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL. Refer to logging package documentation.
INGRESS_HOSTstringHost to which data will be received
INGRESS_PORTstringPort to which data will be received
EGRESS_URLSstringHTTP ReST endpoint for the next module
INPUT_LABELstringLabel of the monitored signal e.g. temperature
TIMESTAMPstringKey of the input object to access the timestamp value
CONDITIONenumAllowed conditions: No condition, (==) equal to, (!=) not equal to, (>) greater than, (>=) greater than or equal to, (<) less than, (<=) less than or equal to
COMPARE_VALUEfloatValue to compare to in order to start the signal duration timing
OUTPUT_UNITenumDetermines the conversion of the signal duration. Allowed units: ms, s, min, hrs
OUTPUT_LABELstringLabel of the output object for the signal duration value e.g. time_passed

Module Testing

To test module navigate to test directory. In test/assets edit both .json file to provide input for the module and expected output. During a test, data received from the listeners are compared against expected output data. You can run tests with make run_test.

Dependencies

The following are module dependencies:

  • bottle
  • requests

The following are developer dependencies:

  • pytest
  • flake8
  • black

Input

Input to this module is JSON body single object, key of the triggering value must be the same as the environment variable value specified in the module environment:

Example of single object:

{
  "<INPUT_LABEL>": 15,
  "timestamp": 1659527972657
}

Example when INPUT_LABEL is set to temperature:

{
  "temperature": 15,
  "timestamp": 1659527972657
}

Output

Output of this module is an object containing signal duration in the unit of time specified by the module environment variable and a timestamp for tracking purposes:

{
  "<OUTPUT_LABEL>": 100,
  "timestamp": 1659527972757
}

Example when OUTPUT_LABEL is set to signal_duration_in_seconds:

{
  "signal_duration_in_seconds": 100,
  "timestamp": 1659527972757
}
```}

Tag summary

Content type

Image

Digest

sha256:cc13190a7

Size

49.1 MB

Last updated

almost 2 years ago

docker pull beetaone/signal-timer:v1.0.0