Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed debug messages #39

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions repository/blocks/EnhancedHttpOutputBlock.mon
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ event HTTPHandler
TimerParams tp := TimerParams.relative(0.01).withPayload(res).withPartition(deviceId);
base.createTimerWith(tp);

log "Called handleResponse: " + deviceId + "/" + res.payload.data.toString() at INFO;
log "Called handleResponse: " + deviceId + "/" + res.payload.data.toString() at DEBUG;
if not res.isSuccess() {
log "Unable to connect " +host+". Error code: " + res.statusMessage at WARN;
}
Expand Down Expand Up @@ -107,9 +107,9 @@ event EnhancedHTTPOutput_$Parameters {
* An example of HTTP request from the block:
* <code>
Content-Type: application/json

{
"modelName":"model_0",
"deviceId":"84588865186",
"value": {
"value":true,
"timestamp":"1563466239",
Expand Down Expand Up @@ -170,9 +170,10 @@ event EnhancedHTTPOutput {
string modelName := $modelScopeParameters.getOrDefault(ABConstants.MODEL_NAME_IDENTIFIER).valueToString();

any data;
string deviceId := AnyExtractor($activation.partition).getString("");

if $parameters.wrapBody {
data := {"modelName":<any>modelName, "value":$input_value }; // $input_value is a Value object with fields value, timestamp, properties - this will be output as a JSON object.
data := {"modelName":<any>modelName, "value":$input_value, "deviceId": deviceId }; // $input_value is a Value object with fields value, timestamp, properties - this will be output as a JSON object.
} else {
if $input_value.properties.size() = 0 {
// if properties are empty the use the input value
Expand All @@ -187,8 +188,7 @@ event EnhancedHTTPOutput {
Request req := transport.createPOSTRequest($parameters.path, data);

// Execute the request and pass the callback action.
string deviceId := AnyExtractor($activation.partition).getString("");
log "Processing for partition: " + deviceId at INFO;
log "Processing for partition: " + deviceId at DEBUG;
req.execute(HTTPHandler(deviceId, $parameters.host, $base).handleResponse);
$base.profile(BlockBase.PROFILE_OUTPUT);
}
Expand All @@ -204,7 +204,7 @@ event EnhancedHTTPOutput {
dictionary<string, any> propertyValues := {};
any k;

log "Response raw: " + response.payload.data.toString() at INFO;
log "Response raw: " + response.payload.data.toString() at DEBUG;
for k in response.payload.data.getKeys() {
propertyValues[k.valueToString()] := response.payload.data.getEntry(k);
}
Expand Down