added support for new efento measurement types

This commit is contained in:
dashevchenko 2024-07-26 18:42:08 +03:00
parent 4d52002953
commit 569ab0b87b
6 changed files with 510 additions and 288 deletions

View File

@ -35,14 +35,13 @@ import org.thingsboard.server.common.data.device.profile.CoapDeviceProfileTransp
import org.thingsboard.server.common.data.device.profile.DeviceProfileTransportConfiguration;
import org.thingsboard.server.common.data.device.profile.EfentoCoapDeviceTypeConfiguration;
import org.thingsboard.server.common.adaptor.AdaptorException;
import org.thingsboard.server.common.adaptor.ProtoConverter;
import org.thingsboard.server.common.adaptor.AdaptorException;
import org.thingsboard.server.common.transport.auth.SessionInfoCreator;
import org.thingsboard.server.gen.transport.TransportProtos;
import org.thingsboard.server.gen.transport.coap.ConfigProtos;
import org.thingsboard.server.gen.transport.coap.DeviceInfoProtos;
import org.thingsboard.server.gen.transport.coap.MeasurementTypeProtos;
import org.thingsboard.server.gen.transport.coap.MeasurementsProtos;
import org.thingsboard.server.gen.transport.coap.MeasurementsProtos.ProtoChannel;
import org.thingsboard.server.transport.coap.AbstractCoapTransportResource;
import org.thingsboard.server.transport.coap.CoapTransportContext;
import org.thingsboard.server.transport.coap.callback.CoapDeviceAuthCallback;
@ -51,15 +50,18 @@ import org.thingsboard.server.transport.coap.efento.utils.CoapEfentoUtils;
import java.nio.ByteBuffer;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.google.gson.JsonParser.parseString;
import static org.thingsboard.server.gen.transport.coap.MeasurementTypeProtos.MeasurementType.MEASUREMENT_TYPE_FLOODING;
import static org.thingsboard.server.gen.transport.coap.MeasurementTypeProtos.MeasurementType.MEASUREMENT_TYPE_OK_ALARM;
import static org.thingsboard.server.gen.transport.coap.MeasurementTypeProtos.MeasurementType.MEASUREMENT_TYPE_OUTPUT_CONTROL;
import static org.thingsboard.server.transport.coap.CoapTransportService.CONFIGURATION;
import static org.thingsboard.server.transport.coap.CoapTransportService.CURRENT_TIMESTAMP;
import static org.thingsboard.server.transport.coap.CoapTransportService.DEVICE_INFO;
@ -228,121 +230,190 @@ public class CoapEfentoTransportResource extends AbstractCoapTransportResource {
int measurementPeriodBase = protoMeasurements.getMeasurementPeriodBase();
int measurementPeriodFactor = protoMeasurements.getMeasurementPeriodFactor();
int signal = protoMeasurements.getSignal();
List<MeasurementsProtos.ProtoChannel> channelsList = protoMeasurements.getChannelsList();
Map<Long, JsonObject> valuesMap = new TreeMap<>();
if (!CollectionUtils.isEmpty(channelsList)) {
int channel = 0;
JsonObject values;
for (MeasurementsProtos.ProtoChannel protoChannel : channelsList) {
channel++;
boolean isBinarySensor = false;
MeasurementTypeProtos.MeasurementType measurementType = protoChannel.getType();
String measurementTypeName = measurementType.name();
if (measurementType.equals(MeasurementTypeProtos.MeasurementType.OK_ALARM)
|| measurementType.equals(MeasurementTypeProtos.MeasurementType.FLOODING)) {
isBinarySensor = true;
}
if (measurementPeriodFactor == 0 && isBinarySensor) {
measurementPeriodFactor = 14;
} else {
measurementPeriodFactor = 1;
}
int measurementPeriod = measurementPeriodBase * measurementPeriodFactor;
long measurementPeriodMillis = TimeUnit.SECONDS.toMillis(measurementPeriod);
long nextTransmissionAtMillis = TimeUnit.SECONDS.toMillis(protoMeasurements.getNextTransmissionAt());
int startPoint = protoChannel.getStartPoint();
int startTimestamp = protoChannel.getTimestamp();
long startTimestampMillis = TimeUnit.SECONDS.toMillis(startTimestamp);
List<Integer> sampleOffsetsList = protoChannel.getSampleOffsetsList();
if (!CollectionUtils.isEmpty(sampleOffsetsList)) {
int sampleOfssetsListSize = sampleOffsetsList.size();
for (int i = 0; i < sampleOfssetsListSize; i++) {
int sampleOffset = sampleOffsetsList.get(i);
Integer previousSampleOffset = isBinarySensor && i > 0 ? sampleOffsetsList.get(i - 1) : null;
if (sampleOffset == -32768) {
log.warn("[{}],[{}] Sensor error value! Ignoring.", sessionId, sampleOffset);
} else {
switch (measurementType) {
case TEMPERATURE:
values = valuesMap.computeIfAbsent(startTimestampMillis, k ->
CoapEfentoUtils.setDefaultMeasurements(serialNumber, batteryStatus, measurementPeriod, nextTransmissionAtMillis, signal, k));
values.addProperty("temperature_" + channel, ((double) (startPoint + sampleOffset)) / 10f);
startTimestampMillis = startTimestampMillis + measurementPeriodMillis;
break;
case WATER_METER:
values = valuesMap.computeIfAbsent(startTimestampMillis, k ->
CoapEfentoUtils.setDefaultMeasurements(serialNumber, batteryStatus, measurementPeriod, nextTransmissionAtMillis, signal, k));
values.addProperty("pulse_counter_water_" + channel, ((double) (startPoint + sampleOffset)));
startTimestampMillis = startTimestampMillis + measurementPeriodMillis;
break;
case HUMIDITY:
values = valuesMap.computeIfAbsent(startTimestampMillis, k ->
CoapEfentoUtils.setDefaultMeasurements(serialNumber, batteryStatus, measurementPeriod, nextTransmissionAtMillis, signal, k));
values.addProperty("humidity_" + channel, (double) (startPoint + sampleOffset));
startTimestampMillis = startTimestampMillis + measurementPeriodMillis;
break;
case ATMOSPHERIC_PRESSURE:
values = valuesMap.computeIfAbsent(startTimestampMillis, k ->
CoapEfentoUtils.setDefaultMeasurements(serialNumber, batteryStatus, measurementPeriod, nextTransmissionAtMillis, signal, k));
values.addProperty("pressure_" + channel, (double) (startPoint + sampleOffset) / 10f);
startTimestampMillis = startTimestampMillis + measurementPeriodMillis;
break;
case DIFFERENTIAL_PRESSURE:
values = valuesMap.computeIfAbsent(startTimestampMillis, k ->
CoapEfentoUtils.setDefaultMeasurements(serialNumber, batteryStatus, measurementPeriod, nextTransmissionAtMillis, signal, k));
values.addProperty("pressure_diff_" + channel, (double) (startPoint + sampleOffset));
startTimestampMillis = startTimestampMillis + measurementPeriodMillis;
break;
case OK_ALARM:
boolean currentIsOk = sampleOffset < 0;
if (previousSampleOffset != null) {
boolean previousIsOk = previousSampleOffset < 0;
boolean isOk = previousIsOk && currentIsOk;
boolean isAlarm = !previousIsOk && !currentIsOk;
if (isOk || isAlarm) {
break;
}
}
String data = currentIsOk ? "OK" : "ALARM";
long sampleOffsetMillis = TimeUnit.SECONDS.toMillis(sampleOffset);
long measurementTimestamp = startTimestampMillis + Math.abs(sampleOffsetMillis);
values = valuesMap.computeIfAbsent(measurementTimestamp - 1000, k ->
CoapEfentoUtils.setDefaultMeasurements(serialNumber, batteryStatus, measurementPeriod, nextTransmissionAtMillis, signal, k));
values.addProperty("ok_alarm_" + channel, data);
break;
case PULSE_CNT:
values = valuesMap.computeIfAbsent(startTimestampMillis, k ->
CoapEfentoUtils.setDefaultMeasurements(serialNumber, batteryStatus, measurementPeriod, nextTransmissionAtMillis, signal, k));
values.addProperty("pulse_cnt_" + channel, (double) (startPoint + sampleOffset));
startTimestampMillis = startTimestampMillis + measurementPeriodMillis;
break;
case NO_SENSOR:
case UNRECOGNIZED:
log.trace("[{}][{}] Sensor error value! Ignoring.", sessionId, measurementTypeName);
break;
default:
log.trace("[{}],[{}] Unsupported measurementType! Ignoring.", sessionId, measurementTypeName);
break;
}
}
}
} else {
log.trace("[{}][{}] sampleOffsetsList list is empty!", sessionId, measurementTypeName);
}
}
} else {
long nextTransmissionAtMillis = TimeUnit.SECONDS.toMillis(protoMeasurements.getNextTransmissionAt());
List<ProtoChannel> channelsList = protoMeasurements.getChannelsList();
if (CollectionUtils.isEmpty(channelsList)) {
throw new IllegalStateException("[" + sessionId + "]: Failed to get Efento measurements, reason: channels list is empty!");
}
if (!CollectionUtils.isEmpty(valuesMap)) {
List<EfentoTelemetry> efentoMeasurements = new ArrayList<>();
for (Long ts : valuesMap.keySet()) {
EfentoTelemetry measurement = new EfentoTelemetry(ts, valuesMap.get(ts));
efentoMeasurements.add(measurement);
Map<Long, JsonObject> valuesMap = new TreeMap<>();
for (int channel = 0; channel < channelsList.size(); channel++) {
ProtoChannel protoChannel = channelsList.get(channel);
boolean isBinarySensor = isBinarySensor(protoChannel.getType());
int channelPeriodFactor = (measurementPeriodFactor == 0 ? (isBinarySensor ? 14 : 1) : measurementPeriodFactor);
int measurementPeriod = measurementPeriodBase * channelPeriodFactor;
long measurementPeriodMillis = TimeUnit.SECONDS.toMillis(measurementPeriod);
long startTimestampMillis = TimeUnit.SECONDS.toMillis(protoChannel.getTimestamp());
List<Integer> sampleOffsetsList = protoChannel.getSampleOffsetsList();
if (CollectionUtils.isEmpty(sampleOffsetsList)) {
log.trace("[{}][{}] sampleOffsetsList list is empty!", sessionId, protoChannel.getType().name());
continue;
}
return efentoMeasurements;
} else {
for (int i = 0; i < sampleOffsetsList.size(); i++) {
int sampleOffset = sampleOffsetsList.get(i);
if (isSensorError(sampleOffset)) {
log.warn("[{}],[{}] Sensor error value! Ignoring.", sessionId, sampleOffset);
continue;
}
JsonObject values;
if (isBinarySensor) {
long sampleOffsetMillis = TimeUnit.SECONDS.toMillis(sampleOffset);
long measurementTimestamp = startTimestampMillis + Math.abs(sampleOffsetMillis) - 1;
values = valuesMap.computeIfAbsent(measurementTimestamp - 1000, k ->
CoapEfentoUtils.setDefaultMeasurements(serialNumber, batteryStatus, measurementPeriod, nextTransmissionAtMillis, signal, k));
Integer previousSampleOffset = i > 0 ? sampleOffsetsList.get(i - 1) : null;
boolean previousValueIsOk = previousSampleOffset != null && previousSampleOffset < 0;
boolean valueIsOk = sampleOffset < 0;
if (binaryValueNotChanged(valueIsOk, previousValueIsOk)) {
break;
}
addBinarySample(protoChannel, valueIsOk, values, channel + 1);
} else {
long timestampMillis = startTimestampMillis + i * measurementPeriodMillis;
values = valuesMap.computeIfAbsent(timestampMillis, k -> CoapEfentoUtils.setDefaultMeasurements(
serialNumber, batteryStatus, measurementPeriod, nextTransmissionAtMillis, signal, k));
addContinuesSample(protoChannel, sampleOffset, values, channel + 1, sessionId);
}
}
}
if (CollectionUtils.isEmpty(valuesMap)) {
throw new IllegalStateException("[" + sessionId + "]: Failed to collect Efento measurements, reason, values map is empty!");
}
return valuesMap.entrySet().stream()
.map(entry -> new EfentoTelemetry(entry.getKey(), entry.getValue()))
.collect(Collectors.toList());
}
private boolean isBinarySensor(MeasurementTypeProtos.MeasurementType type) {
return type == MEASUREMENT_TYPE_OK_ALARM || type == MEASUREMENT_TYPE_FLOODING || type == MEASUREMENT_TYPE_OUTPUT_CONTROL;
}
private boolean isSensorError(int sampleOffset) {
return sampleOffset >= 8355840 && sampleOffset <= 8388607;
}
private void addContinuesSample(ProtoChannel protoChannel, int sampleOffset, JsonObject values, int channelNumber, UUID sessionId) {
int startPoint = protoChannel.getStartPoint();
switch (protoChannel.getType()) {
case MEASUREMENT_TYPE_TEMPERATURE:
values.addProperty("temperature_" + channelNumber, ((double) (startPoint + sampleOffset)) / 10f);
break;
case MEASUREMENT_TYPE_WATER_METER:
values.addProperty("pulse_counter_water_" + channelNumber, ((double) (startPoint + sampleOffset)));
break;
case MEASUREMENT_TYPE_HUMIDITY:
values.addProperty("humidity_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_ATMOSPHERIC_PRESSURE:
values.addProperty("pressure_" + channelNumber, (double) (startPoint + sampleOffset) / 10f);
break;
case MEASUREMENT_TYPE_DIFFERENTIAL_PRESSURE:
values.addProperty("pressure_diff_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_PULSE_CNT:
values.addProperty("pulse_cnt_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_IAQ:
values.addProperty("iaq_" + channelNumber, (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_ELECTRICITY_METER:
values.addProperty("watt_hour_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_SOIL_MOISTURE:
values.addProperty("soil_moisture_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_AMBIENT_LIGHT:
values.addProperty("ambient_light_" + channelNumber, (double) (startPoint + sampleOffset) / 10f);
break;
case MEASUREMENT_TYPE_HIGH_PRESSURE:
values.addProperty("high_pressure_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_DISTANCE_MM:
values.addProperty("distance_mm_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_WATER_METER_ACC_MINOR:
values.addProperty("acc_counter_water_minor_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_WATER_METER_ACC_MAJOR:
values.addProperty("acc_counter_water_major_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_HUMIDITY_ACCURATE:
values.addProperty("humidity_relative_" + channelNumber, (double) (startPoint + sampleOffset) / 10f);
break;
case MEASUREMENT_TYPE_STATIC_IAQ:
values.addProperty("static_iaq_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_CO2_EQUIVALENT:
values.addProperty("co2_ppm_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_BREATH_VOC:
values.addProperty("breath_voc_ppm_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_PERCENTAGE:
values.addProperty("percentage_" + channelNumber, (double) (startPoint + sampleOffset) / 100f);
break;
case MEASUREMENT_TYPE_VOLTAGE:
values.addProperty("voltage_" + channelNumber, (double) (startPoint + sampleOffset) / 10f);
break;
case MEASUREMENT_TYPE_CURRENT:
values.addProperty("current_" + channelNumber, (double) (startPoint + sampleOffset) / 100f);
break;
case MEASUREMENT_TYPE_PULSE_CNT_ACC_MINOR:
values.addProperty("pulse_cnt_minor_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_PULSE_CNT_ACC_MAJOR:
values.addProperty("pulse_cnt_major_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_ELEC_METER_ACC_MINOR:
values.addProperty("elec_meter_minor_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_ELEC_METER_ACC_MAJOR:
values.addProperty("elec_meter_major_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_PULSE_CNT_ACC_WIDE_MINOR:
values.addProperty("pulse_cnt_wide_minor_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_PULSE_CNT_ACC_WIDE_MAJOR:
values.addProperty("pulse_cnt_wide_major_" + channelNumber, (double) (startPoint + sampleOffset));
break;
case MEASUREMENT_TYPE_CURRENT_PRECISE:
values.addProperty("current_precise_" + channelNumber, (double) (startPoint + sampleOffset)/1000f);
break;
case MEASUREMENT_TYPE_NO_SENSOR:
case UNRECOGNIZED:
log.trace("[{}][{}] Sensor error value! Ignoring.", sessionId, protoChannel.getType().name());
break;
default:
log.trace("[{}],[{}] Unsupported measurementType! Ignoring.", sessionId, protoChannel.getType().name());
break;
}
}
private void addBinarySample(ProtoChannel protoChannel, boolean valueIsOk, JsonObject values, int channel) {
switch (protoChannel.getType()) {
case MEASUREMENT_TYPE_OK_ALARM:
values.addProperty("ok_alarm_" + channel, valueIsOk ? "OK" : "ALARM");
case MEASUREMENT_TYPE_FLOODING:
values.addProperty("flooding_" + channel, valueIsOk ? "OK" : "WATER_DETECTED");
case MEASUREMENT_TYPE_OUTPUT_CONTROL:
values.addProperty("output_control_" + channel, valueIsOk ? "OFF" : "ON");
}
}
private static boolean binaryValueNotChanged(boolean currentIsOk, boolean previousIsOk) {
boolean isOk = previousIsOk && currentIsOk;
boolean isAlarm = !previousIsOk && !currentIsOk;
if (isOk || isAlarm) {
return true;
}
return false;
}
private EfentoTelemetry getEfentoDeviceInfo(DeviceInfoProtos.ProtoDeviceInfo protoDeviceInfo) {

View File

@ -22,26 +22,13 @@ option java_package = "org.thingsboard.server.gen.transport.coap";
option java_outer_classname = "ConfigProtos";
/* Message containing optional channels control parameters */
message ProtoChannelControl {
message ProtoOutputControlState {
/* Channel index */
uint32 channel_index = 1;
/* Control parameters. Maximal number equals 4. This field is channel specific: */
/* IO_control channel: */
/* - control_params[0]: */
/* - Byte 0: On state configuration */
/* 0x01 - Low */
/* 0x02 - High */
/* 0x03 - High-Z (disconnected) */
/* - Byte 1: Off state configuration */
/* 0x01 - Low */
/* 0x02 - High */
/* 0x03 - High-Z (disconnected) */
/* - Byte 2: Power on channel state */
/* 0x01 - On */
/* 0x02 - Off */
repeated uint32 control_params = 2;
/* Channel state ON/OFF. Range (1 - OFF; 2 - ON) */
uint32 channel_state = 2;
}
/* Message containing request data for accesing calibration parameters */
@ -58,6 +45,39 @@ message ProtoCalibrationParameters {
repeated int32 parameters = 3;
}
enum BleAdvertisingPeriodMode {
/* Invalid value */
BLE_ADVERTISING_PERIOD_MODE_UNSPECIFIED = 0;
/* Default behavior - faster advertising when measurement period is < 15s. */
BLE_ADVERTISING_PERIOD_MODE_DEFAULT = 1;
/* User-configured normal interval is used. */
BLE_ADVERTISING_PERIOD_MODE_NORMAL = 2;
/* User-configured fast interval is used. */
BLE_ADVERTISING_PERIOD_MODE_FAST = 3;
}
/* Message containing BLE advertising period configuration */
message ProtoBleAdvertisingPeriod {
/* BLE advertising mode: */
/* - 1: Default, BLE advertising interval is set to 1022.5ms or some lower value, based on continuous measurement period. */
/* - 2: Normal, uses user-configured value from 'normal' field. */
/* - 3: Fast, uses user-configured value from 'fast' field (must be lower than or equal to 'normal' field). */
BleAdvertisingPeriodMode mode = 1;
/* BLE advertising interval when in normal mode, configured in 0.625ms steps. */
/* Range: [32:16384] */
uint32 normal = 2;
/* BLE advertising interval when in fast mode, configured in 0.625ms steps. */
/* Range: [32:16384] */
uint32 fast = 3;
}
/* Main message sent in the payload. Each field in this message is independent of the others - only parameters that should be */
/* changed need to be sent in the payload. */
/* If the value of a selected parameter shall not be changed, do not include it in the payload */
@ -115,16 +135,26 @@ message ProtoConfig {
/* 65535 - disable transfer limit function */
uint32 transfer_limit_timer = 10;
/* Data (measurements) server IP address */
/* IP of the data server as string in form x.x.x.x. For example: 18.184.24.239 */
/* For firmware >= 6.07.00: */
/* IP or URL address of the data (measurements) server */
/* The IP or URL of the data server, provided as string with a maximum length of 31 characters */
/* For example, use "18.184.24.239" for an IP address or "efento.test.io" for a URL */
/* For firmware < 6.07.00: */
/* IP address of the data (measurements) server */
/* For example, use "18.184.24.239" */
string data_server_ip = 11;
/* Data (measurements) server port */
/* Range: [1:65535] */
uint32 data_server_port = 12;
/* Update server IP address */
/* IP of data server as string in form x.x.x.x. For example: 18.184.24.239 */
/* For firmware >= 6.07.00: */
/* IP or URL address of the update server */
/* The IP or URL of the update server, provided as string with a maximum length of 31 characters */
/* For example, use "18.184.24.239" for an IP address or "efento.test.io" for a URL */
/* For firmware < 6.07.00: */
/* IP address of the update server */
/* For example, use "18.184.24.239" */
string update_server_ip = 13;
/* Update server port for UDP transmission */
@ -144,7 +174,8 @@ message ProtoConfig {
/* 0xFFFFFFFF or 1000000 - automatic selection */
uint32 plmn_selection = 17;
/* Device will power off its cellular modem for requested number of seconds. Maximum number of seconds 604800 (7 days) */
/* Device will power off its cellular modem for requested number of seconds. */
/* Range: [60:604800] (1 minute : 7 days) */
/* This field is only sent by server */
uint32 disable_modem_request = 18;
@ -263,9 +294,8 @@ message ProtoConfig {
/* Calendar configuration. Up to 6 calendars are supported */
repeated ProtoCalendar calendars = 47;
/* Control parameters for channels. Maximal number of requests equals 6 */
/* This field is only sent by server */
repeated ProtoChannelControl channels_control_request = 48;
/* DEPRECATED - Used for backward compatibility */
reserved 48;
/* Set/get calibration parameters for single channel. */
ProtoCalibrationParameters calibration_parameters_request = 49;
@ -295,7 +325,7 @@ message ProtoConfig {
reserved 52, 53;
/* Encryption key configuration. Sensor sends in this field two last bytes of SHA256 hash calculated from its current */
/* encryption_key configuration. */
/* encryption_key configuration. When encryption key is disabled one byte 0x7F (DEL) is sent. */
/* Max length: 16 bytes. */
/* 0x7F - encryption key disabled. */
bytes encryption_key = 54;
@ -309,4 +339,14 @@ message ProtoConfig {
/* String with special character 0x7F (DEL) only indicates that automatic password is turn on */
/* Password can only be set to custom value if apn_user_name has been configured (is not automatic) */
string apn_password = 56;
/* Reserved by versions above 06.20.00 */
reserved 57;
/* Control output state on channel pin. Maximal number of requests equals 3 */
/* This field is only sent by server */
repeated ProtoOutputControlState output_control_state_request = 58;
/* BLE advertising period configuration. */
ProtoBleAdvertisingPeriod ble_advertising_period = 59;
}

View File

@ -106,6 +106,11 @@ message ProtoModem
/* parameters[32] - Rx_time - [0.1s] - Range: [0:2147483647]. Unknown value: -1 */
/* parameters[33] - Tx_time - [0.1s] - Range: [0:2147483647]. Unknown value: -1 */
repeated sint32 parameters = 2;
/* ICCID of inserted/soldered sim card. String up to 22 characters long. */
/* 0x7F if sim card is not detected, empty (not sent) if device does not have modem. */
/* This field is only sent by device */
string sim_card_identification = 3;
}
message ProtoUpdateInfo
@ -115,16 +120,16 @@ message ProtoUpdateInfo
uint32 timestamp = 1;
/* Update status, possible values: */
/* - 0x1 - No update yet */
/* - 0x2 - No error */
/* - 0x3 - UDP socekt error */
/* - 0x4 - Hash error */
/* - 0x5 - Missing packet error */
/* - 0x6 - Invalid data error */
/* - 0x7 - Sending timeout error */
/* - 0x8 - No SW to update error */
/* - 0x9 - Sending unexpected error */
/* - 0x10 - Unexpected error */
/* - 1 - No update yet */
/* - 2 - No error */
/* - 3 - UDP socekt error */
/* - 4 - Hash error */
/* - 5 - Missing packet error */
/* - 6 - Invalid data error */
/* - 7 - Sending timeout error */
/* - 8 - No SW to update error */
/* - 9 - Sending unexpected error */
/* - 10 - Unexpected error */
uint32 status = 2;
}

View File

@ -19,79 +19,160 @@ option java_package = "org.thingsboard.server.gen.transport.coap";
option java_outer_classname = "MeasurementTypeProtos";
enum MeasurementType {
NO_SENSOR = 0;
/* [°C] - Celsius degree. Resolution 0.1°C. Range [-273.2-4000.0]. Type: Continuous */
TEMPERATURE = 1;
/* [% RH] - Relative humidity. Resolution 1%. Range [0-100]. Type: Continuous */
HUMIDITY = 2;
/* [hPa] - Hectopascal (1hPa = 100Pa). Resolution 0.1hPa. Range: [1.0-2000.0]. Type: Continuous */
ATMOSPHERIC_PRESSURE = 3;
/* [Pa] - Pascal. Resolution 1Pa. Range [-10000-10000]Type: Continuous */
DIFFERENTIAL_PRESSURE = 4;
/* Sign indicates state: (+) ALARM, (-) OK. Type: Binary */
OK_ALARM = 5;
/* [IAQ] - Iaq index. Resolution 1IAQ. Range [0-500]. Sensor return also calibration status */
/* as offset to measured value: */
/* - offset 3000: Sensor not stabilized (always returns 25 IAQ value) */
/* - offset 2000: Calibration required (sensor returns not accurate values) */
/* - offset 1000: Calibration on-going (sensor returns not accurate values) */
/* - offset 0: Calibration done (best accuracy of IAQ sensor) */
/* Type: Continuous */
IAQ = 6;
/* Sign indicates water presence: (+) water not detected, (-) water detected. Type: Binary */
FLOODING = 7;
/* [NB] Number of pulses. Resolution 1 pulse. Range [0-16711679]. Type: Continuous */
PULSE_CNT = 8;
/* [Wh] - Watthour; Resolution 1Wh. Range [0-16711679]. Number of Watthours in a single period. Type: Continuous */
ELECTRICITY_METER = 9;
/* [l] - Liter. Resolution 1l. Range [0-16711679]. Number of litres in a single period. Type: Continuous */
WATER_METER = 10;
/* [kPa] - Kilopascal (1kPa = 1000Pa); Resolution 1kPa. Range [-1000-0]. Soil moisture (tension). Type: Continuous */
SOIL_MOISTURE = 11;
/* [ppm] - Parts per million. Resolution 1ppm. Range [0-1000000]. Carbon monoxide concentration. Type: Continuous */
CO_GAS = 12;
/* [ppm] - Parts per million. Resolution 0.01ppm. Range [0-1000000.00]. Nitrogen dioxide concentration. Type: Continuous*/
NO2_GAS = 13;
/* [ppm] - Parts per million. Resolution 1ppm. Range [0-1000000]. Hydrogen sulfide concentration. Type: Continuous */
H2S_GAS = 14;
/* [lx] - Illuminance. Resolution 0.1lx. Range [0-100000.0]. Type: Continuous */
AMBIENT_LIGHT = 15;
/* [µg/m^3] - Micro gram per cubic meter. Resolution 1µg/m^3 Range [0-1000]. */
/* particles with an aerodynamic diameter less than 1 micrometer. Type: Continuous */
PM_1_0 = 16; // µg/m^3
/* [µg/m^3] - Micro gram per cubic meter. Resolution 1µg/m^3 Range [0-1000]. */
/* particles with an aerodynamic diameter less than 2.5 micrometers. Type: Continuous */
PM_2_5 = 17; // µg/m^3
/* [µg/m^3] - Micro gram per cubic meter. Resolution 1µg/m^3 Range [0-1000]. */
/* particles with an aerodynamic diameter less than 10 micrometers. Type: Continuous */
PM_10_0 = 18; // µg/m^3
/* [dB] - Decibels. Resolution 0.1 dB. Range: [0-130.0]. Noise level. Type: Continuous */
NOISE_LEVEL = 19; // 0.1 dB
/* [ppm] - Parts per million. Resolution 1ppm. Range [0-1000000]. Ammonia concentration. Type: Continuous */
NH3_GAS = 20;
/* [ppm] - Parts per million. Resolution 1ppm. Range [0-1000000]. Methane concentration. Type: Continuous */
CH4_GAS = 21;
/* [] - No sensor on the channel */
MEASUREMENT_TYPE_NO_SENSOR = 0;
/* [°C] - Celsius degree. Resolution 0.1°C. Range [-273.2:4000.0]. Type: Continuous */
MEASUREMENT_TYPE_TEMPERATURE = 1;
/* [% RH] - Relative humidity. Resolution 1%. Range [0:100]. Type: Continuous */
MEASUREMENT_TYPE_HUMIDITY = 2;
/* [hPa] - Hectopascal (1hPa = 100Pa). Resolution 0.1hPa. Range: [1.0:2000.0]. Atmospheric pressure. Type: Continuous */
MEASUREMENT_TYPE_ATMOSPHERIC_PRESSURE = 3;
/* [Pa] - Pascal. Resolution 1Pa. Range [-10000:10000]. Differential pressure. Type: Continuous */
MEASUREMENT_TYPE_DIFFERENTIAL_PRESSURE = 4;
/* Sign indicates state: (+) ALARM, (-) OK. Type: Binary */
MEASUREMENT_TYPE_OK_ALARM = 5;
/* [IAQ] - IAQ index. Resolution 1IAQ. Range [0:500]. To get IAQ index the value should be divided by 3. */
/* Sensor return also calibration status as metadata (is the remainder when the absolute value is divided by 3): */
/* - 0: Calibration required (sensor returns not accurate values) */
/* - 1: Calibration on-going (sensor returns not accurate values) */
/* - 2: Calibration done (best accuracy of IAQ sensor) */
/* Type: Continuous */
MEASUREMENT_TYPE_IAQ = 6;
/* Sign indicates water presence: (+) water not detected, (-) water detected. Type: Binary */
MEASUREMENT_TYPE_FLOODING = 7;
/* [NB] Number of pulses. Resolution 1 pulse. Range [0:8000000]. Type: Continuous */
MEASUREMENT_TYPE_PULSE_CNT = 8;
/* [Wh] - Watthour; Resolution 1Wh. Range [0:8000000]. Number of Watthours in a single period. Type: Continuous */
MEASUREMENT_TYPE_ELECTRICITY_METER = 9;
/* [l] - Liter. Resolution 1l. Range [0:8000000]. Number of litres in a single period. Type: Continuous */
MEASUREMENT_TYPE_WATER_METER = 10;
/* [kPa] - Kilopascal (1kPa = 1000Pa); Resolution 1kPa. Range [-1000:0]. Soil moisture (tension). Type: Continuous */
MEASUREMENT_TYPE_SOIL_MOISTURE = 11;
/* [ppm] - Parts per million. Resolution 1ppm. Range [0:1000000]. Carbon monoxide concentration. Type: Continuous */
MEASUREMENT_TYPE_CO_GAS = 12;
/* [ppm] - Parts per million. Resolution 1.0ppm. Range [0:1000000]. Nitrogen dioxide concentration. Type: Continuous */
MEASUREMENT_TYPE_NO2_GAS = 13;
/* [ppm] - Parts per million. Resolution 0.01ppm. Range [0.00:80000.00]. Hydrogen sulfide concentration. Type: Continuous */
MEASUREMENT_TYPE_H2S_GAS = 14;
/* [lx] - Lux. Resolution 0.1lx. Range [0.0:100000.0]. Illuminance. Type: Continuous */
MEASUREMENT_TYPE_AMBIENT_LIGHT = 15;
/* [µg/m^3] - Micro gram per cubic meter. Resolution 1µg/m^3. Range [0:1000]. */
/* Particles with an aerodynamic diameter less than 1 micrometer. Type: Continuous */
MEASUREMENT_TYPE_PM_1_0 = 16;
/* [µg/m^3] - Micro gram per cubic meter. Resolution 1µg/m^3. Range [0:1000]. */
/* Particles with an aerodynamic diameter less than 2.5 micrometers. Type: Continuous */
MEASUREMENT_TYPE_PM_2_5 = 17;
/* [µg/m^3] - Micro gram per cubic meter. Resolution 1µg/m^3. Range [0:1000]. */
/* Particles with an aerodynamic diameter less than 10 micrometers. Type: Continuous */
MEASUREMENT_TYPE_PM_10_0 = 18;
/* [dB] - Decibels. Resolution 0.1 dB. Range: [0.0:200.0]. Noise level. Type: Continuous */
MEASUREMENT_TYPE_NOISE_LEVEL = 19;
/* [ppm] - Parts per million. Resolution 1ppm. Range [0:1000000]. Ammonia concentration. Type: Continuous */
MEASUREMENT_TYPE_NH3_GAS = 20;
/* [ppm] - Parts per million. Resolution 1ppm. Range [0:1000000]. Methane concentration. Type: Continuous */
MEASUREMENT_TYPE_CH4_GAS = 21;
/* [kPa] - Kilopascal (1kPa = 1000Pa, 100kPa = 1bar). Resolution 1kPa. Range [0:200000]. Pressure. Type: Continuous */
MEASUREMENT_TYPE_HIGH_PRESSURE = 22;
/* [mm] - Millimeter. Resolution 1mm. Range [0:100000]. Distance. Type: Continuous */
MEASUREMENT_TYPE_DISTANCE_MM = 23;
/* [l] - Liter. Resolution 1l. Range [0:1000000]. Accumulative water meter (minor). Type: Continuous */
MEASUREMENT_TYPE_WATER_METER_ACC_MINOR = 24;
/* [hl] - Hectoliter. Resolution 1hl. Range [0:1000000]. Accumulative water meter (major). Type: Continuous */
MEASUREMENT_TYPE_WATER_METER_ACC_MAJOR = 25;
/* [ppm] - Parts per million. Resolution 1ppm. Range [0:1000000]. Carbon dioxide concentration. Type: Continuous */
MEASUREMENT_TYPE_CO2_GAS = 26;
/* [% RH] - Relative humidity. Resolution 0.1%. Range [0.0:100.0]. Type: Continuous */
MEASUREMENT_TYPE_HUMIDITY_ACCURATE = 27;
/* [sIAQ] - Static IAQ index. Resolution 1IAQ. Range [0:10000]. To get static IAQ index the value should be divided by 3. */
/* Sensor return also calibration status as metadata (is the remainder when the absolute value is divided by 3): */
/* - 0: Calibration required (sensor returns not accurate values) */
/* - 1: Calibration on-going (sensor returns not accurate values) */
/* - 2: Calibration done (best accuracy of IAQ sensor) */
/* Type: Continuous */
MEASUREMENT_TYPE_STATIC_IAQ = 28;
/* [ppm] - Parts per million. Resolution 1ppm. Range [0:1000000]. CO2 equivalent. */
/* To get CO2 equivalent the value should be divided by 3. */
/* Sensor return also calibration status as metadata (is the remainder when the absolute value is divided by 3): */
/* - 0: Calibration required (sensor returns not accurate values) */
/* - 1: Calibration on-going (sensor returns not accurate values) */
/* - 2: Calibration done (best accuracy of IAQ sensor) */
/* Type: Continuous */
MEASUREMENT_TYPE_CO2_EQUIVALENT = 29;
/* [ppm] - Parts per million. Resolution 1ppm. Range [0:100000]. Breath VOC estimate. */
/* To get breath VOC estimate the value should be divided by 3. */
/* Sensor return also calibration status as metadata (is the remainder when the absolute value is divided by 3): */
/* - 0: Calibration required (sensor returns not accurate values) */
/* - 1: Calibration on-going (sensor returns not accurate values) */
/* - 2: Calibration done (best accuracy of IAQ sensor) */
/* Type: Continuous */
MEASUREMENT_TYPE_BREATH_VOC = 30;
/* Special measurement type reserved for cellular gateway. */
/* Type: Continuous */
MEASUREMENT_TYPE_CELLULAR_GATEWAY = 31;
/* [%] - Percentage. Resolution 0.01%. Range [0.00:100.00]. Type: Continuous */
MEASUREMENT_TYPE_PERCENTAGE = 32;
/* [mV] - Milivolt. Resolution 0.1mV. Range [0.0:100000.0]. Type: Continuous */
MEASUREMENT_TYPE_VOLTAGE = 33;
/* [mA] - Milliampere. Resolution 0.01mA. Range [0.0:10000.00]. Type: Continuous */
MEASUREMENT_TYPE_CURRENT = 34;
/* [NB] Number of pulses. Resolution 1 pulse. Range [0:1000000]. Type: Continuous */
MEASUREMENT_TYPE_PULSE_CNT_ACC_MINOR = 35;
/* [kNB] Number of kilopulses. Resolution 1 kilopulse. Range [0:1000000]. Type: Continuous */
MEASUREMENT_TYPE_PULSE_CNT_ACC_MAJOR = 36;
/* [Wh] - Watt-hour; Resolution 1Wh. Range [0:1000000]. Number of watt-hours in a single period. Type: Continuous */
MEASUREMENT_TYPE_ELEC_METER_ACC_MINOR = 37;
/* [kWh] - Kilowatt-hour; Resolution 1kWh. Range [0:1000000]. Number of kilowatt-hours in a single period. Type: Continuous */
MEASUREMENT_TYPE_ELEC_METER_ACC_MAJOR = 38;
/* [NB] Number of pulses (wide range). Resolution 1 pulse. Range [0:999999]. Type: Continuous */
MEASUREMENT_TYPE_PULSE_CNT_ACC_WIDE_MINOR = 39;
/* [MNB] Number of megapulses (wide range). Resolution 1 megapulse. Range [0:999999]. Type: Continuous */
MEASUREMENT_TYPE_PULSE_CNT_ACC_WIDE_MAJOR = 40;
/* [mA] - Milliampere. Resolution 0.001mA. Range [-4 000.000:4 000.000]. Type: Continuous */
MEASUREMENT_TYPE_CURRENT_PRECISE = 41;
/* Sign indicates state: (+) ON, (-) OFF. Type: Binary */
MEASUREMENT_TYPE_OUTPUT_CONTROL = 42;
}

View File

@ -19,103 +19,108 @@ import "efento/proto_measurement_types.proto";
option java_package = "org.thingsboard.server.gen.transport.coap";
option java_outer_classname = "MeasurementsProtos";
message ProtoChannel{
/* Type of channel */
message ProtoChannel {
/* Type of channel */
MeasurementType type = 1;
/* Timestamp of the first sample (the oldest one) in seconds since UNIX EPOCH 01-01-1970 */
/* Timestamp of the first sample (the oldest one) in seconds since UNIX EPOCH 01-01-1970 */
int32 timestamp = 2;
/* Only used for 'Continuous' sensor types. Value used as the starting point for calculating the values of all */
/* measurements in the package. */
/* Format defined by 'MeasurementType' field */
/* Only used for 'Continuous' sensor types. Value used as the starting point for calculating the values of all */
/* measurements in the package. */
/* Format defined by 'MeasurementType' field */
sint32 start_point = 4;
/* 'Continuous' sensor types */
/* Value of the offset from the 'start_point' for each measurement in the package. The oldest sample first ([0]). */
/* 'sample_offsets' format defined by 'MeasurementType' field. */
/* Example: MeasurementType = 1 (temperature), start_point = 100, sample_offsets[0] = 15, sample_offsets[1] = 20 */
/* 1st sample in the package temperature value = 11.5 °C, 2nd sample in the package temperature value = 12 °C */
/* Calculating timestamps of the measurements: timestamp = 1606391700, measurement_period_base = 60, */
/* measurement_period_factor = 1. Timestamp of the 1st sample = 1606391700, timestamp of the 2nd sample = 1606391760 */
/* 'Binary' sensor types: */
/* Absolute value of the 'sample_offsets' field indicates the offset in seconds from 'timestamp' field. */
/* Sign (- or +) indicates the state of measurements depend of sensor type. */
/* Value of this field equals to '1' or '-1' indicates the state at the 'timestamp'. Other values */
/* indicate the state of the relay at the time (in seconds) equal to 'timestamp' + value. */
/* Values of this field are incremented starting from 1 (1->0: state at the time */
/* of 'timestamp', 2->1: state at the time equal to 'timestamp' + 1 s, 3->2 : */
/* state at the time equal to 'timestamp' + 2 s, etc.). The first and the last sample define the time range of the */
/* measurements. Only state changes in the time range are included in the 'sample_offsets' field */
/* Examples: if 'timestamp' value is 1553518060 and 'sample_offsets' equals '1', it means that at 1553518060 the state */
/* was high, if 'timestamp' value is 1553518060 and 'sample_offsets' equals '-9', it means at 1553518068 the state was low */
/* 'Continuous' sensor types */
/* Value of the offset from the 'start_point' for each measurement in the package. The oldest sample first ([0]). */
/* 'sample_offsets' format defined by 'MeasurementType' field. */
/* If the 'sample_offset' has a value from the range [8355840: 8388607], it should be interpreted as a sensor error code. */
/* In that case value of the 'start_point' field should not be added to this 'sample_offset'. See ES6-264 for error codes. */
/* Example: MeasurementType = 1 (temperature), start_point = 100, sample_offsets[0] = 15, sample_offsets[1] = 20, */
/* sample_offset[2] = 8388605 */
/* 1st sample in the package temperature value = 11.5 °C, 2nd sample in the package temperature value = 12 °C */
/* 3rd sample in the package has no temperature value. It has information about failure of MCP9808 (temperature) sensor. */
/* Calculating timestamps of the measurements: timestamp = 1606391700, measurement_period_base = 60, */
/* measurement_period_factor = 1. Timestamp of the 1st sample = 1606391700, timestamp of the 2nd sample = 1606391760, */
/* timestamp of the 3rd sample 1606391820 */
/* 'Binary' sensor types: */
/* Absolute value of the 'sample_offsets' field indicates the offset in seconds from 'timestamp' field. */
/* Sign (- or +) indicates the state of measurements depending on the sensor type. */
/* Value of this field equals to '1' or '-1' indicates the state at the 'timestamp'. Other values */
/* indicate the state of the relay at the time (in seconds) equal to 'timestamp' + absolute value -1. */
/* Values of this field are incremented starting from 1 (1->0: state at the time */
/* of 'timestamp', 2->1: state at the time equal to 'timestamp' + 1 s, 3->2 : */
/* state at the time equal to 'timestamp' + 2 s, etc.). The first and the last sample define the time range of the */
/* measurements. Only state changes in the time range are included in the 'sample_offsets' field */
/* Examples: if 'timestamp' value is 1553518060 and 'sample_offsets' equals '1', it means that at 1553518060 the state */
/* was high, if 'timestamp' value is 1553518060 and 'sample_offsets' equals '-9', it means at 1553518068 the state was low */
repeated sint32 sample_offsets = 5 [packed=true];
/* Deprecated - configuration is sent to endpoint 'c' */
//int32 lo_threshold = 6;
/* Deprecated - configuration is sent to endpoint 'c' */
/* int32 lo_threshold = 6; */
reserved 6;
/* Deprecated - configuration is sent to endpoint 'c' */
//int32 hi_threshold = 7;
/* Deprecated - configuration is sent to endpoint 'c' */
/* int32 hi_threshold = 7; */
reserved 7;
/* Deprecated - configurationis sent to endpoint 'c' */
//int32 diff_threshold = 8;
}
/* Deprecated - configurations sent to endpoint 'c' */
/* int32 diff_threshold = 8; */
reserved 8;
}
message ProtoMeasurements {
/* serial number of the device */
/* Serial number of the device */
bytes serial_num = 1;
/* true - battery ok, false - battery low */
/* Battery status: true - battery ok, false - battery low */
bool battery_status = 2;
/* 'Measurement_period_base' and 'measurement_period_factor' define how often the measurements are taken. */
/* Sensors of 'Continuous' type take measurement each Measurement_period_base * measurement_period_factor. */
/* Sensors of 'Binary' type take measurement each Measurement_period_base. */
/* For backward compatibility with versions 5.x in case of binary/mixed sensors, if the 'measurement_period_factor' is */
/* not sent (equal to 0), then the default value '14' shall be used for period calculation. */
/* For backward compatibility with versions 5.x in case of continues sensors, if the measurement_period_factor is */
/* not sent (equal to 0), then the default value '1' shall be used for period calculation. */
/* measurement period base in seconds */
/* 'Measurement_period_base' and 'measurement_period_factor' define how often the measurements are taken. */
/* Sensors of 'Continuous' type take measurement each Measurement_period_base * measurement_period_factor. */
/* Sensors of 'Binary' type take measurement each Measurement_period_base. */
/* For backward compatibility with versions 5.x in case of binary/mixed sensors, if the 'measurement_period_factor' is */
/* not sent (equal to 0), then the default value '14' shall be used for period calculation. */
/* For backward compatibility with versions 5.x in case of continues sensors, if the measurement_period_factor is */
/* not sent (equal to 0), then the default value '1' shall be used for period calculation. */
/* measurement period base in seconds */
uint32 measurement_period_base = 3;
/* Measurement period factor */
/* Measurement period factor */
uint32 measurement_period_factor = 8;
repeated ProtoChannel channels = 4;
/* Timestamp of the next scheduled transmission. If the device will not send data until this time, */
/* it should be considered as 'lost' */
/* Timestamp of the next scheduled transmission. If the device will not send data until this time, */
/* it should be considered as 'lost' */
uint32 next_transmission_at = 5;
/* reason of transmission - unsigned integer where each bit indicates different */
/* possible communication reason. Can be more than one */
/* - bit 0: first message after sensor reset */
/* - bit 1: user button triggered */
/* - bit 2: user BLE triggered */
/* - bit 3-7: number of retries -> incremented after each unsuccessful transmission. Max value 4. */
/* Set to 0 after a successful transmission. */
/* - bit 8: channel 1 lower threshold exceeded */
/* - bit 9: channel 1 lower threshold returned */
/* - bit 10: channel 1 higher threshold exceeded */
/* - bit 11: channel 1 higher threshold returned */
/* - bit 12: channel 1 differential threshold crossed */
/* - bits 13-17: channel 2 thresholds (same as for channel 1) */
/* - bits 18-22: channel 3 thresholds (same as for channel 1) */
/* - bits 23-27: channel 4 or 5 or 6 thresholds (same as for channel 1) */
/* Reason of transmission - unsigned integer where each bit indicates different possible communication reason. */
/* Can be more than one: */
/* - bit 0: first message after sensor reset */
/* - bit 1: user button triggered */
/* - bit 2: user BLE triggered */
/* - bit 3-7: number of retries -> incremented after each unsuccessful transmission. Max value 31. */
/* Set to 0 after a successful transmission. */
/* - bit 8...19: rule 1...12 was met */
/* - bit 20: triggered after the end of the limit */
uint32 transfer_reason = 6;
/* Signal strength level mapped from RSSI */
/* - 0 : 113 dBm or less */
/* - 1 : 111 dBm */
/* - 2...30 : 109...-53 dBm */
/* - 31 : -51 dBm or greater */
/* - 99 : Not known or not detectable */
/* Signal strength level mapped from RSSI: */
/* - 0: RSSI < -110 dBm */
/* - 1: -110 dBm <= RSSI < -109 dBm */
/* - 2...61: -109 <= RSSI < -108 dBm ... -50 dBm <= RSSI < -49 dBm */
/* - 62: -49 dBm <= RSSI < -48 dBm */
/* - 63: RSSI >= -48 dBm */
/* - 99: Not known or not detectable */
uint32 signal = 7;
/* Hash of the current configuration. Hash value changes each time a device receives a new configuration */
/* Hash of the current configuration. Hash value changes each time a device receives a new configuration */
uint32 hash = 9;
/* Optional string up to 36 bytes long. Can be set to any user define value or hold device's IMEI */
/* Optional string up to 36 bytes long. Can be set to any user define value or hold device's IMEI */
string cloud_token = 16;
}

View File

@ -50,11 +50,19 @@ option java_outer_classname = "ProtoRuleProtos";
/* - CO2_EQUIVALENT - [ppm] - Parts per million. Resolution 1ppm. Range [0:1000000]. Carbon dioxide equivalent. */
/* - BREATH_VOC - [ppm] - Parts per million. Resolution 1ppm. Range [0:100000]. Breath VOC estimate. */
/* - PERCENTAGE - [%] - Percentage. Resolution 0.01%. Range [0.00:100.00]. */
/* - VOLTAGE - [mV] - Milivolt. Resolution 0.1mV. Range [0.0:100000.0]. */
/* - CURRENT - [mA] - Miliampere. Resolution 0.01mA. Range [0.00:10000.00]. */
/* - PULSE_CNT_ACC_MINOR - [NB] - Number of pulses. Resolution 1 pulse. Range [0:1000000]. Accumulative pulse counter (minor). */
/* - PULSE_CNT_ACC_MAJOR - [kNB] - Number of kilopulses. Resolution 1 kilopulse. Range [0:1000000]. */
/* Accumulative pulse counter (major). */
/* - ELEC_METER_ACC_MINOR - [Wh] - Watt-hour. Resolution 1Wh. Range [0:1000000]. Accumulative electricity meter (minor). */
/* - ELEC_METER_ACC_MAJOR - [kWh] - Kilowatt-hour. Resolution 1kWh. Range [0:1000000]. Accumulative electricity meter (major). */
/* - PULSE_CNT_ACC_WIDE_MINOR - [NB] - Number of pulses. Resolution 1 pulse. Range [0:999999]. */
/* Accumulative pulse counter wide range (minor). */
/* - PULSE_CNT_ACC_WIDE_MAJOR - [MNB] - Number of megapulses. Resolution 1 megapulse. Range [0:999999]. */
/* Accumulative pulse counter wide range (major). */
/* - CURRENT_PRECISE - [mA] - Miliampere. Resolution 0.001mA. Range [-4 000.000:4 000.000]. */
/* - OUTPUT_CONTROL - Not applicable */
/* Encoding R: used to set relative values in the Rules (e.g. differential threshold and hysteresis) */
/* - TEMPERATURE - [°C] - Celsius degree. Resolution 0.1°C. Range [0.1:4273.2]. */
@ -88,11 +96,19 @@ option java_outer_classname = "ProtoRuleProtos";
/* - CO2_EQUIVALENT - [ppm] - Parts per million. Resolution 1ppm. Range [1:1000000]. Carbon dioxide equivalent. */
/* - BREATH_VOC - [ppm] - Parts per million. Resolution 1ppm. Range [1:100000]. Breath VOC estimate. */
/* - PERCENTAGE - [%] - Percentage. Resolution 0.01%. Range [0.01:100.00]. */
/* - VOLTAGE - [mV] - Milivolt. Resolution 0.1mV. Range [0.1:100000.0]. */
/* - CURRENT - [mA] - Miliampere. Resolution 0.01mA. Range [0.01:10000.00]. */
/* - PULSE_CNT_ACC_MINOR - [NB] - Number of pulses. Resolution 1 pulse. Range [1:1000000]. Accumulative pulse counter (minor). */
/* - PULSE_CNT_ACC_MAJOR - [kNB] - Number of kilopulses. Resolution 1 kilopulse. Range [1:1000000]. */
/* Accumulative pulse counter (major). */
/* - ELEC_METER_ACC_MINOR - [Wh] - Watt-hour. Resolution 1Wh. Range [1:1000000]. Accumulative electricity meter (minor). */
/* - ELEC_METER_ACC_MAJOR - [kWh] - Kilowatt-hour. Resolution 1kWh. Range [1:1000000]. Accumulative electricity meter (major). */
/* - PULSE_CNT_ACC_WIDE_MINOR - [NB] - Number of pulses. Resolution 1 pulse. Range [1:999999]. */
/* Accumulative pulse counter wide range (minor). */
/* - PULSE_CNT_ACC_WIDE_MAJOR - [MNB] - Number of megapulses. Resolution 1 megapulse. Range [1:999999]. */
/* Accumulative pulse counter wide range (major). */
/* - CURRENT_PRECISE - [mA] - Miliampere. Resolution 0.001mA. Range [0.001:8 000.000]. */
/* - OUTPUT_CONTROL - Not applicable */
/* Condition to be checked by the device. If the condition is true, an action is triggered */
enum Condition {
@ -202,6 +218,10 @@ enum Action {
/* To trigger the transmission with ACK */
ACTION_TRIGGER_TRANSMISSION_WITH_ACK = 3;
/* To change BLE advertising period mode to fast (with lower user-configured advertising interval). */
/* Once the rule is deactived avertising period mode returns to previously configured value. */
ACTION_FAST_ADVERTISING_MODE = 4;
}
/* Type of a rule calendars. */