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

add no_hardware to pubber options #340

Merged
merged 19 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion bin/pubber
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ else
done

extra_point="${options[extra_point]}"

no_hardware="${options[no_hardware]}"

if [ -n "${options[extra_field]}" ]; then
printf -v extra_field '"extraField": "%s",' "${options[extra_field]}"
fi
Expand All @@ -49,6 +50,7 @@ else
{
$extra_field
"extraPoint": "$extra_point",
"noHardware": "$no_hardware",
"projectId": "$project_id",
"sitePath": "$site_path",
"cloudRegion": "$cloud_region",
Expand Down
2 changes: 2 additions & 0 deletions docs/tools/pubber.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The following parameters are currently supported from the CLI:
(will trigger validation schema error)
* `extra_point` - adds an extra point to the device which does not exist in
device's metadata (will trigger validation additional point error)
* `no_hardware` - omits the `system.hardware` field from state messages (will
trigger validation error, missing required field)

Values can be assigned to the parameters e.g.
`bin/pubber SITE_PATH PROJECT_ID DEVICE_ID SERIAL_NO extra_point=name_of_point`
Expand Down
1 change: 1 addition & 0 deletions pubber/src/main/java/daq/pubber/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ public class Configuration {
public String serialNo;
public String macAddr;
public String extraPoint;
public String noHardware;
}
5 changes: 5 additions & 0 deletions pubber/src/main/java/daq/pubber/Pubber.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ private void initializeDevice() {
addPoint(makePoint(configuration.extraPoint,
makePointPointsetModel(true, 50, 50, "Celsius")));
}

if (configuration.noHardware != null && !configuration.noHardware.isEmpty()) {
deviceState.system.hardware = null;
}

markStateDirty(0);
}

Expand Down