Add option for auto-detect measurements.

In case the decoded payload contains random keys the auto-detect
measurements feature will add new measurements for each uplink. With
this option it is possible to turn auto-detection off to avoid
polluting the database with many measurements.

Closes #42.
This commit is contained in:
Orne Brocaar
2022-11-02 10:19:38 +00:00
parent 577a33ec9a
commit 0a23c71641
31 changed files with 616 additions and 360 deletions

View File

@ -64,6 +64,7 @@ function encodeDownlink(input) {
deviceProfileTemplate.setMacVersion(MacVersion.LORAWAN_1_0_3);
deviceProfileTemplate.setRegParamsRevision(RegParamsRevision.A);
deviceProfileTemplate.setFlushQueueOnActivate(true);
deviceProfileTemplate.setAutoDetectMeasurements(true);
return (
<Space direction="vertical" style={{ width: "100%" }} size="large">

View File

@ -109,6 +109,7 @@ class DeviceProfileTemplateForm extends Component<IProps, IState> {
m.setName(elm[1].name);
dp.getMeasurementsMap().set(elm[0], m);
}
dp.setAutoDetectMeasurements(v.autoDetectMeasurements);
this.props.onFinish(dp);
};
@ -418,8 +419,7 @@ class DeviceProfileTemplateForm extends Component<IProps, IState> {
<p>
ChirpStack can aggregate and visualize decoded device measurements in the device dashboard. To setup the
aggregation of device measurements, you must configure the key, kind of measurement and name
(user-defined). Please note that ChirpStack will automatically configure the keys once it has received
the first uplink(s). The following measurement-kinds can be selected:
(user-defined). The following measurement-kinds can be selected:
</p>
<ul>
<li>
@ -440,6 +440,14 @@ class DeviceProfileTemplateForm extends Component<IProps, IState> {
</li>
</ul>
</Card>
<Form.Item
label="Automatically detect measurement keys"
name="autoDetectMeasurements"
valuePropName="checked"
tooltip="If enabled, measurement-keys will be automatically added based on the decoded payload keys. If the decoded payload contains random keys, you want to disable auto-detection."
>
<Switch />
</Form.Item>
<Form.List name="measurementsMap">
{(fields, { add, remove }) => (
<>

View File

@ -73,6 +73,7 @@ function encodeDownlink(input) {
deviceProfile.setMacVersion(MacVersion.LORAWAN_1_0_3);
deviceProfile.setRegParamsRevision(RegParamsRevision.A);
deviceProfile.setFlushQueueOnActivate(true);
deviceProfile.setAutoDetectMeasurements(true);
return (
<Space direction="vertical" style={{ width: "100%" }} size="large">

View File

@ -292,6 +292,7 @@ class DeviceProfileForm extends Component<IProps, IState> {
m.setName(elm[1].name);
dp.getMeasurementsMap().set(elm[0], m);
}
dp.setAutoDetectMeasurements(v.autoDetectMeasurements);
this.props.onFinish(dp);
};
@ -710,8 +711,7 @@ class DeviceProfileForm extends Component<IProps, IState> {
<p>
ChirpStack can aggregate and visualize decoded device measurements in the device dashboard. To setup the
aggregation of device measurements, you must configure the key, kind of measurement and name
(user-defined). Please note that ChirpStack will automatically configure the keys once it has received
the first uplink(s). The following measurement-kinds can be selected:
(user-defined). The following measurement-kinds can be selected:
</p>
<ul>
<li>
@ -732,6 +732,14 @@ class DeviceProfileForm extends Component<IProps, IState> {
</li>
</ul>
</Card>
<Form.Item
label="Automatically detect measurement keys"
name="autoDetectMeasurements"
valuePropName="checked"
tooltip="If enabled, measurement-keys will be automatically added based on the decoded payload keys. If the decoded payload contains random keys, you want to disable auto-detection."
>
<Switch />
</Form.Item>
<Form.List name="measurementsMap">
{(fields, { add, remove }) => (
<>