Name | Data Converter |
Version | v1.0.3 |
DockerHub | data-converter |
Authors | Ghassen Barbouchi |
The function of this module is to convert the selected input of the previous module to another type. Available options are hex string, int, ieee754 float, text, and data can be converted from and to those types.
- Detect the value to convert from the incoming JSON data.
- Validate the selected from type.
- Convert the detected value from selected input Type to selected out Type.
- Forward the new converted JSON to the next module.
Environment Variables | type | Description |
---|---|---|
INPUT_KEY | string | Input Key eg "Device.pc.price" |
FROM_TYPE | string | Input type |
TO_TYPE | string | Output type |
There are 5 module variables that are required by each module to correctly function within weeve ecosystem. In development, these variables can overridden for testing purposes. In production, these variables are set by weeve Agent.
Environment Variables | type | Description |
---|---|---|
MODULE_NAME | string | Name of the module |
MODULE_TYPE | string | Type of the module (Input, Processing, Output) |
LOG_LEVEL | string | Allowed log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL. Refer to logging package documentation. |
INGRESS_HOST | string | Host to which data will be received |
INGRESS_PORT | string | Port to which data will be received |
EGRESS_URLS | string | HTTP ReST endpoint for the next module |
The following are module dependencies:
- bottle
- requests
The following are developer dependencies:
- pytest
- flake8
- black
Input example:
{
"manufacturer" : "weeve",
"device" :{
"SN" : "1232",
"newobj":{
"a":12,
"b":"0xFD"
},
"year" : 2021
}
}
output example in case the input key is : "device.newobj.b" , the fromType :"hex" and the toType :"int"
{
"manufacturer" : "weeve",
"device" :{
"SN" : "1232",
"newobj":{
"a":12,
"b":253
},
"year" : 2021
}
}