From ed0fec00a7482b1f56a89fe8c6df07d01de0ed20 Mon Sep 17 00:00:00 2001 From: "Christian W. Zuckschwerdt" Date: Fri, 11 Jun 2021 11:56:57 +0200 Subject: [PATCH] Change old battery keys to battery_ok --- examples/rtl_433_collectd_pipe.py | 5 +-- examples/rtl_433_graphite_relay.py | 7 +--- examples/rtl_433_mqtt_relay.py | 7 +--- examples/rtl_433_statsd_pipe.py | 7 +--- examples/rtl_433_statsd_relay.py | 7 +--- src/devices/acurite.c | 46 +++++++++++------------ src/devices/alecto.c | 8 ++-- src/devices/ambient_weather.c | 8 ++-- src/devices/ambientweather_tx8300.c | 8 ++-- src/devices/ambientweather_wh31e.c | 8 ++-- src/devices/blueline.c | 34 ++++++++--------- src/devices/bresser_3ch.c | 4 +- src/devices/bresser_5in1.c | 10 ++--- src/devices/bresser_6in1.c | 2 +- src/devices/bt_rain.c | 8 ++-- src/devices/cavius.c | 2 +- src/devices/current_cost.c | 2 +- src/devices/directv.c | 2 +- src/devices/dsc.c | 2 +- src/devices/efergy_e2_classic.c | 16 ++++---- src/devices/fineoffset.c | 26 ++++++------- src/devices/fineoffset_wh1050.c | 4 +- src/devices/fineoffset_wh1080.c | 4 +- src/devices/generic_temperature_sensor.c | 12 +++--- src/devices/gt_wt_02.c | 4 +- src/devices/hcs200.c | 22 +++++------ src/devices/hideki.c | 10 ++--- src/devices/holman_ws5029.c | 4 +- src/devices/honeywell.c | 22 +++++------ src/devices/honeywell_cm921.c | 1 + src/devices/honeywell_wdb.c | 4 +- src/devices/ikea_sparsnas.c | 19 +++++----- src/devices/infactory.c | 6 +-- src/devices/insteon.c | 4 +- src/devices/interlogix.c | 10 ++--- src/devices/kedsum.c | 26 ++++++------- src/devices/kerui.c | 2 +- src/devices/klimalogg.c | 19 +++++----- src/devices/lacrosse_tx141x.c | 9 ++--- src/devices/lacrosse_tx35.c | 6 +-- src/devices/lacrosse_ws7000.c | 12 +++--- src/devices/mebus.c | 4 +- src/devices/missil_ml0757.c | 8 ++-- src/devices/nexus.c | 6 +-- src/devices/oregon_scientific.c | 48 ++++++++++++------------ src/devices/oregon_scientific_v1.c | 4 +- src/devices/philips_aj3650.c | 8 ++-- src/devices/prologue.c | 4 +- src/devices/rftech.c | 15 ++++---- src/devices/rubicson.c | 4 +- src/devices/s3318p.c | 10 ++--- src/devices/sharp_spc775.c | 2 +- src/devices/solight_te44.c | 4 +- src/devices/springfield.c | 4 +- src/devices/steelmate.c | 20 +++++----- src/devices/tfa_drop_30.3233.c | 2 +- src/devices/tfa_twin_plus_30.3049.c | 8 ++-- src/devices/tpms_abarth124.c | 2 +- src/devices/tpms_citroen.c | 2 +- src/devices/tpms_hyundai_vdo.c | 2 +- src/devices/tpms_jansite.c | 2 +- src/devices/tpms_jansite_solar.c | 2 +- src/devices/tpms_pmv107j.c | 26 +++++++------ src/devices/tpms_renault.c | 16 ++++---- src/devices/tpms_toyota.c | 18 +++++---- src/devices/ts_ft002.c | 6 +-- src/devices/ttx201.c | 18 +++++---- src/devices/vaillant_vrt340f.c | 34 ++++++++--------- src/devices/visonic_powercode.c | 22 +++++------ src/devices/wssensor.c | 4 +- src/devices/wt450.c | 4 +- src/devices/x10_sec.c | 2 +- src/r_api.c | 19 ---------- 73 files changed, 364 insertions(+), 385 deletions(-) diff --git a/examples/rtl_433_collectd_pipe.py b/examples/rtl_433_collectd_pipe.py index 7caa17583..faac1ac3a 100755 --- a/examples/rtl_433_collectd_pipe.py +++ b/examples/rtl_433_collectd_pipe.py @@ -48,10 +48,7 @@ def rtl_433_probe(): attributes = {} temperatures = {} - if data["battery"] == "OK": - attributes["battery"] = 1.0 - else: - attributes["battery"] = 0.0 + attributes["battery"] = data["battery_ok"] attributes["humidity"] = data["humidity"] diff --git a/examples/rtl_433_graphite_relay.py b/examples/rtl_433_graphite_relay.py index e2ecc97f2..3554c465e 100755 --- a/examples/rtl_433_graphite_relay.py +++ b/examples/rtl_433_graphite_relay.py @@ -84,11 +84,8 @@ def rtl_433_probe(): label += ".ID" + str(data["id"]) path = GRAPHITE_PREFIX + label - if "battery" in data: - if data["battery"] == "OK": - graphite.push(path + '.battery', 1, now) - else: - graphite.push(path + '.battery', 0, now) + if "battery_ok" in data: + graphite.push(path + '.battery', data["battery_ok"], now) if "humidity" in data: graphite.push(path + '.humidity', data["humidity"], now) diff --git a/examples/rtl_433_mqtt_relay.py b/examples/rtl_433_mqtt_relay.py index e0241ea40..e665c8b18 100755 --- a/examples/rtl_433_mqtt_relay.py +++ b/examples/rtl_433_mqtt_relay.py @@ -56,11 +56,8 @@ def publish_sensor_to_mqtt(mqttc, data, line): elif "id" in data: path += "/" + str(data["id"]) - if "battery" in data: - if data["battery"] == "OK": - pass - else: - mqttc.publish(path + "/battery", str(data["battery"])) + if "battery_ok" in data: + mqttc.publish(path + "/battery", data["battery_ok"]) if "humidity" in data: mqttc.publish(path + "/humidity", data["humidity"]) diff --git a/examples/rtl_433_statsd_pipe.py b/examples/rtl_433_statsd_pipe.py index e4fb273b2..659917374 100755 --- a/examples/rtl_433_statsd_pipe.py +++ b/examples/rtl_433_statsd_pipe.py @@ -36,11 +36,8 @@ def rtl_433_probe(): if "channel" in data: label += ".CH" + str(data["channel"]) - if "battery" in data: - if data["battery"] == "OK": - statsd.gauge(label + '.battery', 1) - else: - statsd.gauge(label + '.battery', 0) + if "battery_ok" in data: + statsd.gauge(label + '.battery', data["battery_ok"]) if "humidity" in data: statsd.gauge(label + '.humidity', data["humidity"]) diff --git a/examples/rtl_433_statsd_relay.py b/examples/rtl_433_statsd_relay.py index 48e4f0cde..f95b2ab61 100755 --- a/examples/rtl_433_statsd_relay.py +++ b/examples/rtl_433_statsd_relay.py @@ -54,11 +54,8 @@ def rtl_433_probe(): if "channel" in data: label += ".CH" + str(data["channel"]) - if "battery" in data: - if data["battery"] == "OK": - statsd.gauge(label + '.battery', 1) - else: - statsd.gauge(label + '.battery', 0) + if "battery_ok" in data: + statsd.gauge(label + '.battery', data["battery_ok"]) if "humidity" in data: statsd.gauge(label + '.humidity', data["humidity"]) diff --git a/src/devices/acurite.c b/src/devices/acurite.c index ba876ce71..41b21526b 100644 --- a/src/devices/acurite.c +++ b/src/devices/acurite.c @@ -204,7 +204,7 @@ static int acurite_th_decode(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "Acurite-609TXC", "id", "", DATA_INT, id, - "battery", "", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, tempc, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "status", "", DATA_INT, status, @@ -405,7 +405,7 @@ static int acurite_6045_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign "model", "", DATA_STRING, "Acurite-6045M", "id", NULL, DATA_INT, sensor_id, "channel", NULL, DATA_STRING, channel_str, - "battery", "battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_F", "temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, tempf, "humidity", "humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "strike_count", "strike_count", DATA_INT, strike_count, @@ -547,8 +547,8 @@ static int acurite_atlas_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsig "id", NULL, DATA_INT, sensor_id, "channel", NULL, DATA_STRING, &channel_str, "sequence_num", NULL, DATA_INT, sequence_num, - "battery_ok", NULL, DATA_INT, !battery_low, - "message_type", NULL, DATA_INT, message_type, + "battery_ok", "Battery", DATA_INT, !battery_low, + "message_type", NULL, DATA_INT, message_type, "wind_avg_mi_h", "Wind Speed", DATA_FORMAT, "%.1f mi/h", DATA_DOUBLE, wind_speed_mph, NULL); /* clang-format on */ @@ -739,7 +739,7 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Acurite-Tower", "id", "", DATA_INT, sensor_id, "channel", NULL, DATA_STRING, &channel_str, - "battery_ok", "", DATA_INT, !battery_low, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, tempc, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "mic", "Integrity", DATA_STRING, "CHECKSUM", @@ -788,7 +788,7 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Acurite-515", "id", "", DATA_INT, sensor_id, "channel", NULL, DATA_STRING, &channel_str, - "battery_ok", "", DATA_INT, !battery_low, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_F", "Temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, tempf, "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); @@ -848,7 +848,7 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer) "id", NULL, DATA_INT, sensor_id, "channel", NULL, DATA_STRING, &channel_str, "sequence_num", NULL, DATA_INT, sequence_num, - "battery", NULL, DATA_STRING, battery_low ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, !battery_low, "wind_avg_km_h", "wind_speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, wind_speed_kph, "wind_dir_deg", NULL, DATA_FORMAT, "%.1f", DATA_DOUBLE, wind_dir, "rain_in", "Rainfall Accumulation", DATA_FORMAT, "%.2f in", DATA_DOUBLE, raincounter * 0.01f, @@ -875,7 +875,7 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer) "id", NULL, DATA_INT, sensor_id, "channel", NULL, DATA_STRING, &channel_str, "sequence_num", NULL, DATA_INT, sequence_num, - "battery", NULL, DATA_STRING, battery_low ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, !battery_low, "wind_avg_km_h", "wind_speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, wind_speed_kph, "temperature_F", "temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, tempf, "humidity", NULL, DATA_FORMAT, "%u %%", DATA_INT, humidity, @@ -904,7 +904,7 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer) "id", NULL, DATA_FORMAT, "0x%02X", DATA_INT, sensor_id, "channel", NULL, DATA_STRING, &channel_str, "sequence_num", NULL, DATA_INT, sequence_num, - "battery", NULL, DATA_STRING, battery_low ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, !!battery_low, // NOTE: is this really flipped? "wind_avg_mi_h", "wind_speed", DATA_FORMAT, "%.1f mi/h", DATA_DOUBLE, wind_speed_mph, "temperature_F", "temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, tempf, "humidity", NULL, DATA_FORMAT, "%u %%", DATA_INT, humidity, @@ -1078,7 +1078,7 @@ static int acurite_986_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Acurite-986", "id", NULL, DATA_INT, sensor_id, "channel", NULL, DATA_STRING, channel_str, - "battery", "battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_F", "temperature", DATA_FORMAT, "%f F", DATA_DOUBLE, (float)tempf, "status", "status", DATA_INT, status, "mic", "Integrity", DATA_STRING, "CRC", @@ -1103,7 +1103,7 @@ static int acurite_606_decode(r_device *decoder, bitbuffer_t *bitbuffer) int row; int16_t temp_raw; // temperature as read from the data packet float temp_c; // temperature in C - int battery; // the battery status: 1 is good, 0 is low + int battery_ok; // the battery status: 1 is good, 0 is low int sensor_id; // the sensor ID - basically a random number that gets reset whenever the battery is removed row = bitbuffer_find_repeated_row(bitbuffer, 3, 32); // expected are 6 rows @@ -1134,7 +1134,7 @@ static int acurite_606_decode(r_device *decoder, bitbuffer_t *bitbuffer) // Upper 4 bits are stored in nibble 1, lower 8 bits are stored in nibble 2 // upper 4 bits of nibble 1 are reserved for other usages (e.g. battery status) sensor_id = b[0]; - battery = (b[1] & 0x80) >> 7; + battery_ok = (b[1] & 0x80) >> 7; temp_raw = (int16_t)((b[1] << 12) | (b[2] << 4)); temp_raw = temp_raw >> 4; temp_c = temp_raw * 0.1f; @@ -1143,7 +1143,7 @@ static int acurite_606_decode(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "Acurite-606TX", "id", "", DATA_INT, sensor_id, - "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, battery_ok, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c, "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); @@ -1159,7 +1159,7 @@ static int acurite_590tx_decode(r_device *decoder, bitbuffer_t *bitbuffer) uint8_t *b; int row; int sensor_id; // the sensor ID - basically a random number that gets reset whenever the battery is removed - int battery; // the battery status: 1 is good, 0 is low + int battery_ok; // the battery status: 1 is good, 0 is low int channel; int humidity; int temp_raw; // temperature as read from the data packet @@ -1203,7 +1203,7 @@ static int acurite_590tx_decode(r_device *decoder, bitbuffer_t *bitbuffer) // Upper 4 bits are stored in nibble 1, lower 8 bits are stored in nibble 2 // upper 4 bits of nibble 1 are reserved for other usages (e.g. battery status) sensor_id = b[0] & 0xFE; //first 6 bits and it changes each time it resets or change the battery - battery = (b[0] & 0x01); //1=ok, 0=low battery + battery_ok = (b[0] & 0x01); //1=ok, 0=low battery //next 2 bits are checksum //next two bits are identify ID (maybe channel ?) channel = (b[1] >> 4) & 0x03; @@ -1221,7 +1221,7 @@ static int acurite_590tx_decode(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "Acurite-590TX", "id", "", DATA_INT, sensor_id, - "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, battery_ok, "channel", "Channel", DATA_INT, channel, "humidity", "Humidity", DATA_COND, humidity != -1, DATA_INT, humidity, "temperature_C", "Temperature", DATA_COND, humidity == -1, DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c, @@ -1298,7 +1298,7 @@ static int acurite_00275rm_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, model_flag ? "Acurite-00275rm" : "Acurite-00276rm", "subtype", "Probe", DATA_INT, probe, "id", "", DATA_INT, id, - "battery", "", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Celsius", DATA_FORMAT, "%.1f C", DATA_DOUBLE, tempc, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "water", "", DATA_COND, probe == 1, DATA_INT, water, @@ -1338,7 +1338,7 @@ r_device acurite_rain_896 = { static char *acurite_th_output_fields[] = { "model", "id", - "battery", + "battery_ok", "temperature_C", "humidity", "status", @@ -1368,7 +1368,7 @@ static char *acurite_txr_output_fields[] = { "channel", "sequence_num", "battery_ok", - "battery", + "battery_ok", "temperature_C", "temperature_F", "humidity", @@ -1416,7 +1416,7 @@ static char *acurite_986_output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_F", "status", NULL, @@ -1443,7 +1443,7 @@ r_device acurite_986 = { static char *acurite_606_output_fields[] = { "model", "id", - "battery", + "battery_ok", "temperature_C", "mic", NULL, @@ -1452,7 +1452,7 @@ static char *acurite_606_output_fields[] = { static char *acurite_590_output_fields[] = { "model", "id", - "battery", + "battery_ok", "channel", "temperature_C", "humidity", @@ -1481,7 +1481,7 @@ static char *acurite_00275rm_output_fields[] = { "model", "subtype", "id", - "battery", + "battery_ok", "temperature_C", "humidity", "water", diff --git a/src/devices/alecto.c b/src/devices/alecto.c index bfa451429..de2b94063 100644 --- a/src/devices/alecto.c +++ b/src/devices/alecto.c @@ -162,7 +162,7 @@ static int alectov1_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "AlectoV1-Wind", "id", "House Code", DATA_INT, sensor_id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "wind_avg_m_s", "Wind speed", DATA_FORMAT, "%.2f m/s", DATA_DOUBLE, speed * 0.2F, "wind_max_m_s", "Wind gust", DATA_FORMAT, "%.2f m/s", DATA_DOUBLE, gust * 0.2F, "wind_dir_deg", "Wind Direction", DATA_INT, direction, @@ -183,7 +183,7 @@ static int alectov1_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "AlectoV1-Rain", "id", "House Code", DATA_INT, sensor_id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "rain_mm", "Total Rain", DATA_FORMAT, "%.02f mm", DATA_DOUBLE, rain_mm, "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); @@ -208,7 +208,7 @@ static int alectov1_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "AlectoV1-Temperature", "id", "House Code", DATA_INT, sensor_id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "mic", "Integrity", DATA_STRING, "CHECKSUM", @@ -225,7 +225,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "humidity", "rain_mm", diff --git a/src/devices/ambient_weather.c b/src/devices/ambient_weather.c index af9155765..a8c52aa13 100644 --- a/src/devices/ambient_weather.c +++ b/src/devices/ambient_weather.c @@ -49,17 +49,19 @@ static int ambient_weather_decode(r_device *decoder, bitbuffer_t *bitbuffer, uns temperature = (temp_f - 400) * 0.1f; humidity = b[4]; + /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Ambientweather-F007TH", "id", "House Code", DATA_INT, deviceID, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, isBatteryLow ? "Low" : "OK", + "battery_ok", "Battery", DATA_INT, !isBatteryLow, "temperature_F", "Temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, temperature, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "mic", "Integrity", DATA_STRING, "CRC", NULL); - decoder_output_data(decoder, data); + /* clang-format on */ + decoder_output_data(decoder, data); return 1; } @@ -106,7 +108,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_F", "humidity", "mic", diff --git a/src/devices/ambientweather_tx8300.c b/src/devices/ambientweather_tx8300.c index b59efe3e0..1c4c023e9 100644 --- a/src/devices/ambientweather_tx8300.c +++ b/src/devices/ambientweather_tx8300.c @@ -107,11 +107,11 @@ static int ambientweather_tx8300_callback(r_device *decoder, bitbuffer_t *bitbuf /* clang-format off */ data = data_make( "model", "", DATA_STRING, "AmbientWeather-TX8300", - "id", "", DATA_INT, sensor_id, - "channel", "", DATA_INT, channel, - "battery", "Battery", DATA_INT, battery_low, // mapping unknown + "id", "", DATA_INT, sensor_id, + "channel", "", DATA_INT, channel, + "battery", "Battery", DATA_INT, battery_low, // mapping unknown "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c, - "humidity", "Humidity", DATA_COND, humidity >= 0, DATA_FORMAT, "%u %%", DATA_INT, humidity, + "humidity", "Humidity", DATA_COND, humidity >= 0, DATA_FORMAT, "%u %%", DATA_INT, humidity, "mic", "MIC", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ diff --git a/src/devices/ambientweather_wh31e.c b/src/devices/ambientweather_wh31e.c index d3a0690ff..3c341f62d 100644 --- a/src/devices/ambientweather_wh31e.c +++ b/src/devices/ambientweather_wh31e.c @@ -223,7 +223,7 @@ static int ambientweather_whx_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "AmbientWeather-WH31E", "id" , "", DATA_INT, id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_ok ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, battery_ok, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "data", "Extra Data", DATA_STRING, extra, @@ -301,7 +301,7 @@ static int ambientweather_whx_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "EcoWitt-WH40", "id" , "", DATA_INT, id, //"channel", "Channel", DATA_INT, channel, - //"battery", "Battery", DATA_STRING, battery_ok ? "OK" : "LOW", + //"battery_ok", "Battery", DATA_INT, battery_ok, "rain_mm", "Total Rain", DATA_FORMAT, "%.1f mm", DATA_DOUBLE, rain_raw * 0.1, "data", "Extra Data", DATA_STRING, extra, "mic", "Integrity", DATA_STRING, "CRC", @@ -340,7 +340,7 @@ static int ambientweather_whx_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "EcoWitt-WS68", "id" , "", DATA_INT, id, "battery_raw", "Battery Raw", DATA_INT, batt, - "battery", "Battery", DATA_STRING, battery_ok ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, battery_ok, "lux_raw", "lux", DATA_INT, lux, "wind_avg_raw", "Wind Speed", DATA_INT, wspeed, "wind_max_raw", "Wind Gust", DATA_INT, wgust, @@ -365,7 +365,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "humidity", "rain_mm", diff --git a/src/devices/blueline.c b/src/devices/blueline.c index 854526184..2e21ac25f 100644 --- a/src/devices/blueline.c +++ b/src/devices/blueline.c @@ -304,9 +304,9 @@ static int blueline_decode(r_device *decoder, bitbuffer_t *bitbuffer) const uint16_t received_sensor_id = ((current_row[2] << 8) | current_row[1]); /* clang-format off */ data = data_make( - "model", "", DATA_STRING, BLUELINE_MODEL, - "id", "", DATA_INT, received_sensor_id, - "mic", "", DATA_STRING, "CRC", + "model", "", DATA_STRING, BLUELINE_MODEL, + "id", "", DATA_INT, received_sensor_id, + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ decoder_output_data(decoder, data); @@ -322,10 +322,10 @@ static int blueline_decode(r_device *decoder, bitbuffer_t *bitbuffer) const uint16_t ms_per_pulse = offset_payload_u16; /* clang-format off */ data = data_make( - "model", "", DATA_STRING, BLUELINE_MODEL, - "id", "", DATA_INT, context->current_sensor_id, - "gap", "", DATA_INT, ms_per_pulse, - "mic", "", DATA_STRING, "CRC", + "model", "", DATA_STRING, BLUELINE_MODEL, + "id", "", DATA_INT, context->current_sensor_id, + "gap", "", DATA_INT, ms_per_pulse, + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ decoder_output_data(decoder, data); @@ -362,12 +362,12 @@ static int blueline_decode(r_device *decoder, bitbuffer_t *bitbuffer) const float temperature_C = (0.436 * temperature) - 30.36; /* clang-format off */ data = data_make( - "model", "", DATA_STRING, BLUELINE_MODEL, - "id", "", DATA_INT, context->current_sensor_id, - "flags", "", DATA_FORMAT, "%02x", DATA_INT, flags, - "battery_ok", "", DATA_INT, !battery, - "temperature_C", "", DATA_DOUBLE, temperature_C, - "mic", "", DATA_STRING, "CRC", + "model", "", DATA_STRING, BLUELINE_MODEL, + "id", "", DATA_INT, context->current_sensor_id, + "flags", "", DATA_FORMAT, "%02x", DATA_INT, flags, + "battery_ok", "Battery", DATA_INT, !battery, + "temperature_C", "", DATA_DOUBLE, temperature_C, + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ decoder_output_data(decoder, data); @@ -377,10 +377,10 @@ static int blueline_decode(r_device *decoder, bitbuffer_t *bitbuffer) const uint16_t pulses = offset_payload_u16; /* clang-format off */ data = data_make( - "model", "", DATA_STRING, BLUELINE_MODEL, - "id", "", DATA_INT, context->current_sensor_id, - "impulses", "", DATA_INT, pulses, - "mic", "", DATA_STRING, "CRC", + "model", "", DATA_STRING, BLUELINE_MODEL, + "id", "", DATA_INT, context->current_sensor_id, + "impulses", "", DATA_INT, pulses, + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ decoder_output_data(decoder, data); diff --git a/src/devices/bresser_3ch.c b/src/devices/bresser_3ch.c index 5d61e60b1..1b4ada925 100644 --- a/src/devices/bresser_3ch.c +++ b/src/devices/bresser_3ch.c @@ -88,7 +88,7 @@ static int bresser_3ch_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Bresser-3CH", "id", "Id", DATA_INT, id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW": "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_F", "Temperature", DATA_FORMAT, "%.2f F", DATA_DOUBLE, temp_f, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "mic", "Integrity", DATA_STRING, "CHECKSUM", @@ -103,7 +103,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_F", "humidity", "mic", diff --git a/src/devices/bresser_5in1.c b/src/devices/bresser_5in1.c index 3506661c1..2668f7bc6 100644 --- a/src/devices/bresser_5in1.c +++ b/src/devices/bresser_5in1.c @@ -129,7 +129,7 @@ static int bresser_5in1_decode(r_device *decoder, bitbuffer_t *bitbuffer) int rain_raw = (msg[23] & 0x0f) + ((msg[23] & 0xf0) >> 4) * 10 + (msg[24] & 0x0f) * 100; float rain = rain_raw * 0.1f; - int battery_ok = ((msg[25] & 0x80) == 0); + int battery_low = (msg[25] & 0x80); /* check if the message is from a Bresser Professional Rain Gauge */ if ((msg[15] & 0xF) == 0x9) { @@ -139,7 +139,7 @@ static int bresser_5in1_decode(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "Bresser-ProRainGauge", "id", "", DATA_INT, sensor_id, - "battery", "Battery", DATA_STRING, battery_ok ? "OK": "LOW", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temperature, "rain_mm", "Rain", DATA_FORMAT, "%.1f mm", DATA_DOUBLE, rain, "mic", "Integrity", DATA_STRING, "CHECKSUM", @@ -151,9 +151,9 @@ static int bresser_5in1_decode(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "Bresser-5in1", "id", "", DATA_INT, sensor_id, - "battery", "Battery", DATA_STRING, battery_ok ? "OK": "LOW", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temperature, - "humidity", "Humidity", DATA_INT, humidity, + "humidity", "Humidity", DATA_INT, humidity, "wind_max_m_s", "Wind Gust", DATA_FORMAT, "%.1f m/s", DATA_DOUBLE, wind_gust, "wind_avg_m_s", "Wind Speed", DATA_FORMAT, "%.1f m/s", DATA_DOUBLE, wind_avg, "wind_dir_deg", "Direction", DATA_FORMAT, "%.1f", DATA_DOUBLE, wind_direction_deg, @@ -169,7 +169,7 @@ static int bresser_5in1_decode(r_device *decoder, bitbuffer_t *bitbuffer) static char *output_fields[] = { "model", "id", - "battery", + "battery_ok", "temperature_C", "humidity", "wind_max_m_s", diff --git a/src/devices/bresser_6in1.c b/src/devices/bresser_6in1.c index d50cd99bf..0f52cb765 100644 --- a/src/devices/bresser_6in1.c +++ b/src/devices/bresser_6in1.c @@ -186,7 +186,7 @@ static int bresser_6in1_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Bresser-6in1", "id", "", DATA_FORMAT, "%08x", DATA_INT, id, "channel", "", DATA_INT, chan, - "battery_ok", "Battery OK", DATA_INT, batt, + "battery_ok", "Battery", DATA_INT, batt, "temperature_C", "Temperature", DATA_COND, temp_ok, DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_COND, temp_ok && moisture < 0, DATA_INT, humidity, "sensor_type", "Sensor type", DATA_INT, s_type, diff --git a/src/devices/bt_rain.c b/src/devices/bt_rain.c index 9a98f7fec..eab884843 100644 --- a/src/devices/bt_rain.c +++ b/src/devices/bt_rain.c @@ -70,9 +70,9 @@ static int bt_rain_decode(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Biltema-Rain", - "id", "ID", DATA_INT, id, - "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery ? "LOW" : "OK", + "id", "ID", DATA_INT, id, + "channel", "Channel", DATA_INT, channel, + "battery_ok", "Battery", DATA_INT, !battery, "transmit", "Transmit", DATA_STRING, button ? "MANUAL" : "AUTO", // TODO: delete this "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp_c, "rain_rate_mm_h", "Rain per hour", DATA_FORMAT, "%.02f mm/h", DATA_DOUBLE, rainrate, @@ -88,7 +88,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "transmit", // TODO: delete this "temperature_C", "rain_rate_mm_h", diff --git a/src/devices/cavius.c b/src/devices/cavius.c index d3044d3f3..7fc17428e 100644 --- a/src/devices/cavius.c +++ b/src/devices/cavius.c @@ -110,7 +110,7 @@ static int cavius_decode(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "Cavius-Security", "id", "Device ID", DATA_INT, sender_id, - "battery_ok", "Battery OK", DATA_INT, !batt_low, + "battery_ok", "Battery", DATA_INT, !batt_low, "net_id", "Net ID", DATA_INT, net_id, "message", "Message", DATA_INT, message, "text", "Description", DATA_STRING, text, diff --git a/src/devices/current_cost.c b/src/devices/current_cost.c index 975d232ed..ef3cd0cb9 100644 --- a/src/devices/current_cost.c +++ b/src/devices/current_cost.c @@ -79,7 +79,7 @@ static int current_cost_decode(r_device *decoder, bitbuffer_t *bitbuffer) "power0_W", "Power 0", DATA_FORMAT, "%d W", DATA_INT, watt0, "power1_W", "Power 1", DATA_FORMAT, "%d W", DATA_INT, watt1, "power2_W", "Power 2", DATA_FORMAT, "%d W", DATA_INT, watt2, - //"battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", //TODO is there some low battery indicator ? + //"battery_ok", "Battery", DATA_INT, !battery_low, //TODO is there some low battery indicator ? NULL); /* clang-format on */ decoder_output_data(decoder, data); diff --git a/src/devices/directv.c b/src/devices/directv.c index a57dd5f96..139a4e488 100644 --- a/src/devices/directv.c +++ b/src/devices/directv.c @@ -363,7 +363,7 @@ static int directv_decode(r_device *decoder, bitbuffer_t *bitbuffer) "button_id", "", DATA_FORMAT, "0x%02X", DATA_INT, dtv_button_id, "button_name", "", DATA_FORMAT, "[%s]", DATA_STRING, get_dtv_button_label(dtv_button_id), "event", "", DATA_STRING, row_sync_len > ROW_SYNC_SHORT_LEN ? "INITIAL" : "REPEAT", - "mic", "", DATA_STRING, "CHECKSUM", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ diff --git a/src/devices/dsc.c b/src/devices/dsc.c index ef204df73..125c7c0d0 100644 --- a/src/devices/dsc.c +++ b/src/devices/dsc.c @@ -217,7 +217,7 @@ static int dsc_callback(r_device *decoder, bitbuffer_t *bitbuffer) "closed", "", DATA_INT, s_closed, // @todo make bool "event", "", DATA_INT, s_event, // @todo make bool "tamper", "", DATA_INT, s_tamper, // @todo make bool - "battery_ok", "", DATA_INT, !s_battery_low, + "battery_ok", "Battery", DATA_INT, !s_battery_low, "xactivity", "", DATA_INT, s_xactivity, // @todo make bool // Note: the following may change or be removed diff --git a/src/devices/efergy_e2_classic.c b/src/devices/efergy_e2_classic.c index 299c1a328..24c7e14c9 100644 --- a/src/devices/efergy_e2_classic.c +++ b/src/devices/efergy_e2_classic.c @@ -93,13 +93,13 @@ static int efergy_e2_classic_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "Efergy-e2CT", - "id", "Transmitter ID", DATA_INT, address, - "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", - "current", "Current", DATA_FORMAT, "%.2f A", DATA_DOUBLE, current_adc, - "interval", "Interval", DATA_FORMAT, "%ds", DATA_INT, interval, - "learn", "Learning", DATA_STRING, learn ? "YES" : "NO", - "mic", "Integrity", DATA_STRING, "CHECKSUM", + "model", "", DATA_STRING, "Efergy-e2CT", + "id", "Transmitter ID", DATA_INT, address, + "battery_ok", "Battery", DATA_INT, !!battery, + "current", "Current", DATA_FORMAT, "%.2f A", DATA_DOUBLE, current_adc, + "interval", "Interval", DATA_FORMAT, "%ds", DATA_INT, interval, + "learn", "Learning", DATA_STRING, learn ? "YES" : "NO", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ @@ -110,7 +110,7 @@ static int efergy_e2_classic_callback(r_device *decoder, bitbuffer_t *bitbuffer) static char *output_fields[] = { "model", "id", - "battery", + "battery_ok", "current", "interval", "learn", diff --git a/src/devices/fineoffset.c b/src/devices/fineoffset.c index 98d0d6e50..a0aded758 100644 --- a/src/devices/fineoffset.c +++ b/src/devices/fineoffset.c @@ -308,8 +308,8 @@ static int fineoffset_WH24_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( "model", "", DATA_STRING, type == MODEL_WH24 ? "Fineoffset-WH24" : "Fineoffset-WH65B", - "id", "ID", DATA_INT, id, - "battery", "Battery", DATA_STRING, low_battery ? "LOW" : "OK", + "id", "ID", DATA_INT, id, + "battery_ok", "Battery", DATA_INT, !low_battery, "temperature_C", "Temperature", DATA_COND, temp_raw != 0x7ff, DATA_FORMAT, "%.01f C", DATA_DOUBLE, temperature, "humidity", "Humidity", DATA_COND, humidity != 0xff, DATA_FORMAT, "%u %%", DATA_INT, humidity, "wind_dir_deg", "Wind direction", DATA_COND, wind_dir != 0x1ff, DATA_INT, wind_dir, @@ -560,7 +560,7 @@ static int fineoffset_WH25_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_COND, type == 32, DATA_STRING, "Fineoffset-WH32B", "model", "", DATA_COND, type == 25, DATA_STRING, "Fineoffset-WH25", "id", "ID", DATA_INT, id, - "battery", "Battery", DATA_STRING, low_battery ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !low_battery, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temperature, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "pressure_hPa", "Pressure", DATA_COND, pressure_raw != 0xffff, DATA_FORMAT, "%.01f hPa", DATA_DOUBLE, pressure, @@ -733,8 +733,8 @@ static int alecto_ws1200v1_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Alecto-WS1200v1", - "id", "ID", DATA_INT, id, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "id", "ID", DATA_INT, id, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temperature, "rain_mm", "Rain", DATA_FORMAT, "%.01f mm", DATA_DOUBLE, rainfall, "mic", "Integrity", DATA_STRING, "CRC", @@ -819,8 +819,8 @@ static int alecto_ws1200v2_dcf_callback(r_device *decoder, bitbuffer_t *bitbuffe /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Alecto-WS1200v2", - "id", "ID", DATA_INT, id, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "id", "ID", DATA_INT, id, + "battery_ok", "Battery", DATA_INT, !battery_low, "radio_clock", "Radio Clock", DATA_STRING, clock_str, "mic", "Integrity", DATA_STRING, "CRC", NULL); @@ -895,8 +895,8 @@ static int alecto_ws1200v2_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Alecto-WS1200v2", - "id", "ID", DATA_INT, id, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "id", "ID", DATA_INT, id, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temperature, "rain_mm", "Rain", DATA_FORMAT, "%.01f mm", DATA_DOUBLE, rainfall, "mic", "Integrity", DATA_STRING, "CRC", @@ -969,8 +969,8 @@ static int fineoffset_WH0530_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Fineoffset-WH0530", - "id", "ID", DATA_INT, id, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "id", "ID", DATA_INT, id, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temperature, "rain_mm", "Rain", DATA_FORMAT, "%.01f mm", DATA_DOUBLE, rainfall, "mic", "Integrity", DATA_STRING, "CRC", @@ -993,7 +993,7 @@ static char *output_fields[] = { static char *output_fields_WH25[] = { "model", "id", - "battery", + "battery_ok", "temperature_C", "humidity", "pressure_hPa", @@ -1027,7 +1027,7 @@ static char *output_fields_WH51[] = { static char *output_fields_WH0530[] = { "model", "id", - "battery", + "battery_ok", "temperature_C", "rain_mm", "radio_clock", diff --git a/src/devices/fineoffset_wh1050.c b/src/devices/fineoffset_wh1050.c index 4216cb276..edd372b69 100644 --- a/src/devices/fineoffset_wh1050.c +++ b/src/devices/fineoffset_wh1050.c @@ -106,7 +106,7 @@ static int fineoffset_wh1050_callback(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "Fineoffset-WH1050", "id", "StationID", DATA_FORMAT, "%04X", DATA_INT, device_id, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temperature, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "wind_avg_km_h", "Wind avg speed", DATA_FORMAT, "%.02f", DATA_DOUBLE, speed, @@ -123,7 +123,7 @@ static int fineoffset_wh1050_callback(r_device *decoder, bitbuffer_t *bitbuffer) static char *output_fields[] = { "model", "id", - "battery", + "battery_ok", "temperature_C", "humidity", "wind_avg_km_h", diff --git a/src/devices/fineoffset_wh1080.c b/src/devices/fineoffset_wh1080.c index 3aacd299f..1e2f31ea5 100644 --- a/src/devices/fineoffset_wh1080.c +++ b/src/devices/fineoffset_wh1080.c @@ -265,7 +265,7 @@ static int fineoffset_wh1080_callback(r_device *decoder, bitbuffer_t *bitbuffer, "model", "", DATA_STRING, "Fineoffset-WHx080", "subtype", "Msg type", DATA_INT, msg_type, "id", "Station ID", DATA_INT, device_id, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temperature, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "wind_dir_deg", "Wind Direction", DATA_INT, direction_deg, @@ -332,7 +332,7 @@ static char *output_fields[] = { "model", "subtype", "id", - "battery", + "battery_ok", "temperature_C", "humidity", "wind_dir_deg", diff --git a/src/devices/generic_temperature_sensor.c b/src/devices/generic_temperature_sensor.c index 2d641351f..c7ee29149 100644 --- a/src/devices/generic_temperature_sensor.c +++ b/src/devices/generic_temperature_sensor.c @@ -43,16 +43,16 @@ static int generic_temperature_sensor_callback(r_device *decoder, bitbuffer_t *b } device = (b[0]); - battery = (b[1] & 0xF0) >> 4; + battery = (b[1] & 0xC0) >> 6; temp_raw = (int16_t)(((b[1] & 0x3f) << 10) | (b[2] << 2)); temp_f = (temp_raw >> 4) * 0.1f; /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "Generic-Temperature", - "id", "Id", DATA_INT, device, - "battery", "Battery?", DATA_INT, battery, - "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_f, + "model", "", DATA_STRING, "Generic-Temperature", + "id", "Id", DATA_INT, device, + "battery_ok", "Battery?", DATA_INT, battery, + "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_f, NULL); /* clang-format on */ @@ -63,7 +63,7 @@ static int generic_temperature_sensor_callback(r_device *decoder, bitbuffer_t *b static char *output_fields[] = { "model", "id", - "battery", + "battery_ok", "temperature_C", NULL, }; diff --git a/src/devices/gt_wt_02.c b/src/devices/gt_wt_02.c index 63d04a1e2..81b19eb9c 100644 --- a/src/devices/gt_wt_02.c +++ b/src/devices/gt_wt_02.c @@ -92,7 +92,7 @@ static int gt_wt_02_process_row(r_device *decoder, bitbuffer_t *bitbuffer, int r "model", "", DATA_STRING, "GT-WT02", "id", "ID Code", DATA_INT, sensor_id, "channel", "Channel", DATA_INT, channel + 1, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%.0f %%", DATA_DOUBLE, (double)humidity, "button", "Button ", DATA_INT, button_pressed, @@ -118,7 +118,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "humidity", "button", diff --git a/src/devices/hcs200.c b/src/devices/hcs200.c index 890dfbb4a..6e7da2df5 100644 --- a/src/devices/hcs200.c +++ b/src/devices/hcs200.c @@ -74,17 +74,17 @@ static int hcs200_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "Microchip-HCS200", - "id", "", DATA_STRING, serial_str, - "id_rev", "", DATA_STRING, serial_rev_str, - "encrypted", "", DATA_STRING, encrypted_str, - "encrypted_rev", "", DATA_STRING, encrypted_rev_str, - "button1", "", DATA_STRING, ((b[8] & 0x04) == 0x04) ? "ON" : "OFF", - "button2", "", DATA_STRING, ((b[8] & 0x02) == 0x02) ? "ON" : "OFF", - "button3", "", DATA_STRING, ((b[8] & 0x09) == 0x09) ? "ON" : "OFF", - "button4", "", DATA_STRING, ((b[8] & 0x06) == 0x06) ? "ON" : "OFF", - "misc", "", DATA_STRING, (b[8] == 0x0F) ? "ALL_PRESSED" : "", - "battery_ok", "", DATA_INT, (((b[9] >> 4) & 0x08) == 0x08) ? 0 : 1, + "model", "", DATA_STRING, "Microchip-HCS200", + "id", "", DATA_STRING, serial_str, + "id_rev", "", DATA_STRING, serial_rev_str, + "encrypted", "", DATA_STRING, encrypted_str, + "encrypted_rev", "", DATA_STRING, encrypted_rev_str, + "button1", "", DATA_STRING, ((b[8] & 0x04) == 0x04) ? "ON" : "OFF", + "button2", "", DATA_STRING, ((b[8] & 0x02) == 0x02) ? "ON" : "OFF", + "button3", "", DATA_STRING, ((b[8] & 0x09) == 0x09) ? "ON" : "OFF", + "button4", "", DATA_STRING, ((b[8] & 0x06) == 0x06) ? "ON" : "OFF", + "misc", "", DATA_STRING, (b[8] == 0x0F) ? "ALL_PRESSED" : "", + "battery_ok", "Battery", DATA_INT, (((b[9] >> 4) & 0x08) == 0x08) ? 0 : 1, NULL); /* clang-format on */ diff --git a/src/devices/hideki.c b/src/devices/hideki.c index 5014a4a30..10cec0682 100644 --- a/src/devices/hideki.c +++ b/src/devices/hideki.c @@ -137,7 +137,7 @@ static int hideki_ts04_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Hideki-TS04", "id", "Rolling Code", DATA_INT, rc, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_ok ? "OK": "LOW", + "battery_ok", "Battery", DATA_INT, battery_ok, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp/10.f, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "mic", "Integrity", DATA_STRING, "CRC", @@ -159,7 +159,7 @@ static int hideki_ts04_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Hideki-Wind", "id", "Rolling Code", DATA_INT, rc, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_ok ? "OK": "LOW", + "battery_ok", "Battery", DATA_INT, battery_ok, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp * 0.1f, "wind_avg_mi_h", "Wind Speed", DATA_FORMAT, "%.02f mi/h", DATA_DOUBLE, wind_speed * 0.1f, "wind_max_mi_h", "Gust Speed", DATA_FORMAT, "%.02f mi/h", DATA_DOUBLE, gust_speed * 0.1f, @@ -177,7 +177,7 @@ static int hideki_ts04_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Hideki-Temperature", "id", "Rolling Code", DATA_INT, rc, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_ok ? "OK": "LOW", + "battery_ok", "Battery", DATA_INT, battery_ok, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp * 0.1f, "mic", "Integrity", DATA_STRING, "CRC", NULL); @@ -194,7 +194,7 @@ static int hideki_ts04_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Hideki-Rain", "id", "Rolling Code", DATA_INT, rc, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_ok ? "OK": "LOW", + "battery_ok", "Battery", DATA_INT, battery_ok, "rain_mm", "Rain", DATA_FORMAT, "%.01f mm", DATA_DOUBLE, rain_units * 0.7f, "mic", "Integrity", DATA_STRING, "CRC", NULL); @@ -210,7 +210,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "humidity", "wind_avg_mi_h", diff --git a/src/devices/holman_ws5029.c b/src/devices/holman_ws5029.c index 0df92a3a6..5b359d238 100644 --- a/src/devices/holman_ws5029.c +++ b/src/devices/holman_ws5029.c @@ -194,12 +194,12 @@ static int holman_ws5029pwm_decode(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "Holman-WS5029", "id", "", DATA_INT, id, - "battery_ok", "", DATA_INT, !battery_low, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "rain_mm", "Total rainfall", DATA_FORMAT, "%.01f mm", DATA_DOUBLE, rain_mm, "wind_avg_km_h", "Wind avg speed", DATA_FORMAT, "%u km/h", DATA_INT, speed_kmh, - "wind_dir_deg", "Wind Direction", DATA_INT, (int)(wind_dir * 22.5), + "wind_dir_deg", "Wind Direction", DATA_INT, (int)(wind_dir * 22.5), "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ diff --git a/src/devices/honeywell.c b/src/devices/honeywell.c index 4a303ed02..8879a8a1a 100644 --- a/src/devices/honeywell.c +++ b/src/devices/honeywell.c @@ -105,17 +105,17 @@ static int honeywell_decode(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "Honeywell-Security", - "id", "", DATA_FORMAT, "%05x", DATA_INT, device_id, - "channel", "", DATA_INT, channel, - "event", "", DATA_FORMAT, "%02x", DATA_INT, event, - "state", "", DATA_STRING, contact ? "open" : "closed", // Ignore the reed switch legacy. - "contact_open", "", DATA_INT, contact, - "reed_open", "", DATA_INT, reed, - "alarm", "", DATA_INT, alarm, - "tamper", "", DATA_INT, tamper, - "battery_ok", "", DATA_INT, !battery_low, - "heartbeat", "", DATA_INT, heartbeat, + "model", "", DATA_STRING, "Honeywell-Security", + "id", "", DATA_FORMAT, "%05x", DATA_INT, device_id, + "channel", "", DATA_INT, channel, + "event", "", DATA_FORMAT, "%02x", DATA_INT, event, + "state", "", DATA_STRING, contact ? "open" : "closed", // Ignore the reed switch legacy. + "contact_open", "", DATA_INT, contact, + "reed_open", "", DATA_INT, reed, + "alarm", "", DATA_INT, alarm, + "tamper", "", DATA_INT, tamper, + "battery_ok", "Battery", DATA_INT, !battery_low, + "heartbeat", "", DATA_INT, heartbeat, NULL); /* clang-format on */ diff --git a/src/devices/honeywell_cm921.c b/src/devices/honeywell_cm921.c index b82a0bb24..96755bcea 100644 --- a/src/devices/honeywell_cm921.c +++ b/src/devices/honeywell_cm921.c @@ -431,6 +431,7 @@ static char *output_fields[] = { "pump_run_time", "actuator_run_time", "min_flow_temp", + "mic", NULL, }; diff --git a/src/devices/honeywell_wdb.c b/src/devices/honeywell_wdb.c index 768cc043d..8dead469d 100644 --- a/src/devices/honeywell_wdb.c +++ b/src/devices/honeywell_wdb.c @@ -106,7 +106,7 @@ static int honeywell_wdb_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Honeywell-ActivLink", "subtype", "Class", DATA_FORMAT, "%s", DATA_STRING, class, "id", "Id", DATA_FORMAT, "%x", DATA_INT, device, - "battery", "Battery", DATA_STRING, battery ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery, "alert", "Alert", DATA_FORMAT, "%s", DATA_STRING, alert, "secret_knock", "Secret Knock",DATA_FORMAT, "%d", DATA_INT, secret_knock, "relay", "Relay", DATA_FORMAT, "%d", DATA_INT, relay, @@ -122,7 +122,7 @@ static char *output_fields[] = { "model", "subtype", "id", - "battery", + "battery_ok", "alert", "secret_knock", "relay", diff --git a/src/devices/ikea_sparsnas.c b/src/devices/ikea_sparsnas.c index 8b8d66608..e24d435ea 100644 --- a/src/devices/ikea_sparsnas.c +++ b/src/devices/ikea_sparsnas.c @@ -265,19 +265,18 @@ static int ikea_sparsnas_decode(r_device *decoder, bitbuffer_t *bitbuffer) //} float cumulative_kWh = ((float)pulses) / ((float)ikea_sparsnas_pulses_per_kwh); - data_t *data; /* clang-format off */ - data = data_make( + data_t *data = data_make( "model", "Model", DATA_STRING, "Ikea-Sparsnas", - "id", "Sensor ID", DATA_INT, rcv_sensor_id, - "sequence", "Sequence Number", DATA_INT, sequence_number, - "battery", "Battery", DATA_FORMAT, "%d%%", DATA_INT, battery, - "pulses_per_kWh", "Pulses per kWh", DATA_INT, ikea_sparsnas_pulses_per_kwh, + "id", "Sensor ID", DATA_INT, rcv_sensor_id, + "sequence", "Sequence Number", DATA_INT, sequence_number, + "battery_ok", "Battery level", DATA_INT, battery * 0.01f, // 0-100 + "pulses_per_kWh", "Pulses per kWh", DATA_INT, ikea_sparsnas_pulses_per_kwh, "cumulative_kWh", "Cumulative kWh", DATA_FORMAT, "%7.3fkWh", DATA_DOUBLE, cumulative_kWh, "effect", "Effect", DATA_FORMAT, "%dW", DATA_INT, effect, - "pulses", "Pulses", DATA_INT, pulses, - "mode", "Mode", DATA_INT, mode, - "mic", "Integrity", DATA_STRING, "CRC", + "pulses", "Pulses", DATA_INT, pulses, + "mode", "Mode", DATA_INT, mode, + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ @@ -289,7 +288,7 @@ static char *output_fields[] = { "model", "id", "sequence", - "battery", + "battery_ok", "pulses_per_kwh", "cumulative_kWh", "effect", diff --git a/src/devices/infactory.c b/src/devices/infactory.c index a218587ae..3c4e3308d 100644 --- a/src/devices/infactory.c +++ b/src/devices/infactory.c @@ -91,9 +91,9 @@ static int infactory_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( "model", "", DATA_STRING, "inFactory-TH", - "id", "ID", DATA_INT, id, - "channel", "Channel", DATA_INT, channel, - "battery_ok", "Battery OK", DATA_INT, !battery_low, + "id", "ID", DATA_INT, id, + "channel", "Channel", DATA_INT, channel, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_F", "Temperature", DATA_FORMAT, "%.02f F", DATA_DOUBLE, temp_f, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "mic", "Integrity", DATA_STRING, "CRC", diff --git a/src/devices/insteon.c b/src/devices/insteon.c index 53a8a37f5..50fd1be6b 100644 --- a/src/devices/insteon.c +++ b/src/devices/insteon.c @@ -376,7 +376,7 @@ static int parse_insteon_pkt(r_device *decoder, bitbuffer_t *bits, unsigned int "hopsmax", "Hops_Max", DATA_INT, hopsmax, "hopsleft", "Hops_Left", DATA_INT, hopsleft, "formatted", "Packet", DATA_STRING, pkt_formatted, - "mic", "Integrity", DATA_STRING, "CRC", // CRC, CHECKSUM, or PARITY + "mic", "Integrity", DATA_STRING, "CRC", "payload", "Payload", DATA_STRING, payload, "cmd_dat", "CMD_Data", DATA_ARRAY, data_array(cmd_array_len, DATA_INT, cmd_array), // "payload", "Payload", DATA_ARRAY, data_array(min_pkt_len, DATA_INT, data_payload), @@ -495,7 +495,7 @@ static char *output_fields[] = { "hops_max", // almost always 3 "hops_left", // remaining hops "formatted", // entire packet as a formatted string with hex - "mic", // remove if not applicable + "mic", "payload", // packet as a hex string "cmd_dat", // array of int containing command + data "msg_str", diff --git a/src/devices/interlogix.c b/src/devices/interlogix.c index 2ee9c810f..39399d745 100644 --- a/src/devices/interlogix.c +++ b/src/devices/interlogix.c @@ -107,7 +107,7 @@ static int interlogix_decode(r_device *decoder, bitbuffer_t *bitbuffer) char *device_type; char device_serial[7]; char raw_message[7]; - char *low_battery; + int low_battery; char *f1_latch_state; char *f2_latch_state; char *f3_latch_state; @@ -182,14 +182,14 @@ static int interlogix_decode(r_device *decoder, bitbuffer_t *bitbuffer) // keyfob logic. see protocol description addendum for protocol exceptions if ((reverse8(message[2]) >> 4) == 0xf) { - low_battery = "OK"; + low_battery = 0; f1_latch_state = ((message[3] & 0xe) == 0x4) ? "CLOSED" : "OPEN"; f2_latch_state = ((message[3] & 0xe) == 0x8) ? "CLOSED" : "OPEN"; f3_latch_state = ((message[3] & 0xe) == 0xc) ? "CLOSED" : "OPEN"; f4_latch_state = ((message[3] & 0xe) == 0x2) ? "CLOSED" : "OPEN"; f5_latch_state = ((message[3] & 0xe) == 0xa) ? "CLOSED" : "OPEN"; } else { - low_battery = (message[3] & 0x10) ? "LOW" : "OK"; + low_battery = (message[3] & 0x10) ? 1 : 0; f1_latch_state = (message[3] & 0x04) ? "OPEN" : "CLOSED"; f2_latch_state = (message[3] & 0x01) ? "OPEN" : "CLOSED"; f3_latch_state = (message[4] & 0x40) ? "OPEN" : "CLOSED"; @@ -202,7 +202,7 @@ static int interlogix_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "Model", DATA_STRING, "Interlogix-Security", "subtype", "Device Type", DATA_STRING, device_type, "id", "ID", DATA_STRING, device_serial, - "battery", "Battery", DATA_STRING, low_battery, + "battery_ok", "Battery", DATA_INT, !low_battery, "switch1", "Switch1 State", DATA_STRING, f1_latch_state, "switch2", "Switch2 State", DATA_STRING, f2_latch_state, "switch3", "Switch3 State", DATA_STRING, f3_latch_state, @@ -221,7 +221,7 @@ static char *output_fields[] = { "subtype", "id", "raw_message", - "battery", + "battery_ok", "switch1", "switch2", "switch3", diff --git a/src/devices/kedsum.c b/src/devices/kedsum.c index 33b8676da..358f79d8d 100644 --- a/src/devices/kedsum.c +++ b/src/devices/kedsum.c @@ -65,27 +65,27 @@ static int kedsum_callback(r_device *decoder, bitbuffer_t *bitbuffer) if (crc != (b[4] & 0xf)) return DECODE_FAIL_MIC; - int id = b[0]; - int battery = b[1] >> 6; + int id = (b[0]); + int battery = (b[1] >> 6); // level 0-2 int channel = ((b[1] & 0x30) >> 4) + 1; int temp_raw = ((b[2] & 0x0f) << 8) | (b[2] & 0xf0) | (b[1] & 0x0f); int humidity = ((b[3] & 0x0f) << 4) | ((b[3] & 0xf0) >> 4); float temp_f = (temp_raw - 900) * 0.1f; - char *battery_str = battery == 2 ? "OK" : battery == 1 ? "WEAK" : "LOW"; - int flags = (b[1] & 0xc0) | (b[4] >> 4); + battery = battery == 2 ? 100 : battery * 10; // level 0,1,2 -> 0,10,100 + /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "Kedsum-TH", - "id", "ID", DATA_INT, id, - "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_str, - "flags", "Flags2", DATA_INT, flags, - "temperature_F", "Temperature", DATA_FORMAT, "%.02f F", DATA_DOUBLE, temp_f, - "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, - "mic", "Integrity", DATA_STRING, "CRC", + "model", "", DATA_STRING, "Kedsum-TH", + "id", "ID", DATA_INT, id, + "channel", "Channel", DATA_INT, channel, + "battery_ok", "Battery level", DATA_DOUBLE, battery * 0.01f, + "flags", "Flags2", DATA_INT, flags, + "temperature_F", "Temperature", DATA_FORMAT, "%.02f F", DATA_DOUBLE, temp_f, + "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ @@ -97,7 +97,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "flags", "temperature_F", "humidity", diff --git a/src/devices/kerui.c b/src/devices/kerui.c index 95eda5981..ad827fa95 100644 --- a/src/devices/kerui.c +++ b/src/devices/kerui.c @@ -83,7 +83,7 @@ static int kerui_callback(r_device *decoder, bitbuffer_t *bitbuffer) "opened", "", DATA_COND, cmd == 0x7, DATA_INT, 0, "tamper", "", DATA_COND, cmd == 0xb, DATA_INT, 1, "water", "", DATA_COND, cmd == 0x5, DATA_INT, 1, - "battery_ok", "", DATA_COND, cmd == 0xf, DATA_INT, 0, + "battery_ok", "Battery", DATA_COND, cmd == 0xf, DATA_INT, 0, "state", "State", DATA_STRING, cmd_str, NULL); /* clang-format on */ diff --git a/src/devices/klimalogg.c b/src/devices/klimalogg.c index 62e53e881..c7b273b60 100644 --- a/src/devices/klimalogg.c +++ b/src/devices/klimalogg.c @@ -89,27 +89,28 @@ static int klimalogg_decode(r_device *decoder, bitbuffer_t *bitbuffer) humidity = msg[6]&0x7F; battery_low = (msg[7]&0x80) >> 7; sequence_nr = (msg[8]&0xF0) >> 4; + /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "Klimalogg Pro", - "id", "Id", DATA_FORMAT, "%04x", DATA_INT, id, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", - "temperature_C", "Temperature", DATA_STRING, temperature_str, - "humidity", "Humidity", DATA_INT, humidity, - "sequence_nr","Sequence Number", DATA_INT, sequence_nr, - "mic", "Integrity", DATA_STRING, "CRC", + "model", "", DATA_STRING, "Klimalogg Pro", + "id", "Id", DATA_FORMAT, "%04x", DATA_INT, id, + "battery_ok", "Battery", DATA_INT, !battery_low, + "temperature_C", "Temperature", DATA_STRING, temperature_str, + "humidity", "Humidity", DATA_INT, humidity, + "sequence_nr", "Sequence Number", DATA_INT, sequence_nr, + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ decoder_output_data(decoder, data); - return 0; + return 1; } static char *output_fields[] = { "model", "id", "temperature_C", - "battery", + "battery_ok", "humidity", "sequence_nr", "mic", diff --git a/src/devices/lacrosse_tx141x.c b/src/devices/lacrosse_tx141x.c index e75a2e2a5..f5b10a3fc 100644 --- a/src/devices/lacrosse_tx141x.c +++ b/src/devices/lacrosse_tx141x.c @@ -259,7 +259,7 @@ static int lacrosse_tx141x_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "LaCrosse-TX141B", "id", "Sensor ID", DATA_FORMAT, "%02x", DATA_INT, id, "temperature_C", "Temperature", DATA_FORMAT, "%.2f C", DATA_DOUBLE, temp_c, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "test", "Test?", DATA_STRING, test ? "Yes" : "No", NULL); /* clang-format on */ @@ -270,7 +270,7 @@ static int lacrosse_tx141x_decode(r_device *decoder, bitbuffer_t *bitbuffer) "id", "Sensor ID", DATA_FORMAT, "%02x", DATA_INT, id, "channel", "Channel", DATA_FORMAT, "%02x", DATA_INT, channel, "temperature_C", "Temperature", DATA_FORMAT, "%.2f C", DATA_DOUBLE, temp_c, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "test", "Test?", DATA_STRING, test ? "Yes" : "No", NULL); /* clang-format on */ @@ -281,7 +281,7 @@ static int lacrosse_tx141x_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "LaCrosse-TX141Bv3", "id", "Sensor ID", DATA_FORMAT, "%02x", DATA_INT, id, "channel", "Channel", DATA_FORMAT, "%02x", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.2f C", DATA_DOUBLE, temp_c, "test", "Test?", DATA_STRING, test ? "Yes" : "No", NULL); @@ -297,7 +297,7 @@ static int lacrosse_tx141x_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "LaCrosse-TX141THBv2", "id", "Sensor ID", DATA_FORMAT, "%02x", DATA_INT, id, "channel", "Channel", DATA_FORMAT, "%02x", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.2f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "test", "Test?", DATA_STRING, test ? "Yes" : "No", @@ -314,7 +314,6 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", "battery_ok", "temperature_C", "humidity", diff --git a/src/devices/lacrosse_tx35.c b/src/devices/lacrosse_tx35.c index ce4a20d9d..27de6bb88 100644 --- a/src/devices/lacrosse_tx35.c +++ b/src/devices/lacrosse_tx35.c @@ -136,7 +136,7 @@ static int lacrosse_it(r_device *decoder, bitbuffer_t *bitbuffer, int device29or data = data_make( "model", "", DATA_STRING, (device29or35 == 29 ? "LaCrosse-TX29IT" : "LaCrosse-TX35DTHIT"), "id", "", DATA_INT, sensor_id, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "newbattery", "NewBattery", DATA_INT, newbatt, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c, "mic", "Integrity", DATA_STRING, "CRC", @@ -147,7 +147,7 @@ static int lacrosse_it(r_device *decoder, bitbuffer_t *bitbuffer, int device29or data = data_make( "model", "", DATA_STRING, (device29or35 == 29 ? "LaCrosse-TX29IT" : "LaCrosse-TX35DTHIT"), "id", "", DATA_INT, sensor_id, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "newbattery", "NewBattery", DATA_INT, newbatt, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, @@ -183,7 +183,7 @@ static int lacrossetx35_callback(r_device *decoder, bitbuffer_t *bitbuffer) static char *output_fields[] = { "model", "id", - "battery", + "battery_ok", "newbattery", "temperature_C", "humidity", diff --git a/src/devices/lacrosse_ws7000.c b/src/devices/lacrosse_ws7000.c index 661d9c30a..41ef5f97a 100644 --- a/src/devices/lacrosse_ws7000.c +++ b/src/devices/lacrosse_ws7000.c @@ -104,7 +104,7 @@ static int lacrosse_ws7000_decode(r_device *decoder, bitbuffer_t *bitbuffer) "id", "", DATA_INT, id, "channel", "", DATA_INT, addr, "temperature_C", "Temperature", DATA_DOUBLE, temperature, - "mic", "MIC", DATA_STRING, "CHECKSUM", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ @@ -124,7 +124,7 @@ static int lacrosse_ws7000_decode(r_device *decoder, bitbuffer_t *bitbuffer) "channel", "", DATA_INT, addr, "temperature_C", "Temperature", DATA_DOUBLE, temperature, "humidity", "Humidity", DATA_INT, humidity, - "mic", "MIC", DATA_STRING, "CHECKSUM", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ @@ -141,7 +141,7 @@ static int lacrosse_ws7000_decode(r_device *decoder, bitbuffer_t *bitbuffer) "id", "", DATA_INT, id, "channel", "", DATA_INT, addr, "rain_mm", "Rain counter", DATA_DOUBLE, rain * 0.3, - "mic", "MIC", DATA_STRING, "CHECKSUM", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ @@ -162,7 +162,7 @@ static int lacrosse_ws7000_decode(r_device *decoder, bitbuffer_t *bitbuffer) "wind_avg_km_h", "Wind speed", DATA_DOUBLE, speed, "wind_dir_deg", "Wind direction", DATA_DOUBLE, direction, "wind_dev_deg", "Wind deviation", DATA_DOUBLE, deviation, - "mic", "MIC", DATA_STRING, "CHECKSUM", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ @@ -184,7 +184,7 @@ static int lacrosse_ws7000_decode(r_device *decoder, bitbuffer_t *bitbuffer) "temperature_C", "Temperature", DATA_DOUBLE, temperature, "humidity", "Humidity", DATA_INT, humidity, "pressure_hPa", "Pressure", DATA_INT, pressure, - "mic", "MIC", DATA_STRING, "CHECKSUM", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ @@ -206,7 +206,7 @@ static int lacrosse_ws7000_decode(r_device *decoder, bitbuffer_t *bitbuffer) "channel", "", DATA_INT, addr, "light_lux", "Brightness", DATA_INT, brightness, "exposure_mins", "Exposition", DATA_INT, exposition, - "mic", "MIC", DATA_STRING, "CHECKSUM", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ diff --git a/src/devices/mebus.c b/src/devices/mebus.c index 3b9744cc6..417f4b651 100644 --- a/src/devices/mebus.c +++ b/src/devices/mebus.c @@ -48,7 +48,7 @@ static int mebus433_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Mebus-433", "id", "Address", DATA_INT, address, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, !!battery, "unknown1", "Unknown 1", DATA_INT, unknown1, "unknown2", "Unknown 2", DATA_INT, unknown2, "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp * 0.1f, @@ -66,7 +66,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "unknown1", "unknown2", "temperature_C", diff --git a/src/devices/missil_ml0757.c b/src/devices/missil_ml0757.c index 536368ff7..be1175239 100644 --- a/src/devices/missil_ml0757.c +++ b/src/devices/missil_ml0757.c @@ -108,8 +108,8 @@ static int missil_ml0757_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Missil-ML0757", - "id", "ID", DATA_INT, id, - "battery_ok", "Battery OK", DATA_INT, !flag_bat, + "id", "ID", DATA_INT, id, + "battery_ok", "Battery", DATA_INT, !flag_bat, "rain_mm", "Total rain", DATA_FORMAT, "%.02f mm", DATA_DOUBLE, rainfall, "wind_avg_km_h", "Wind speed", DATA_FORMAT, "%.02f km/h", DATA_DOUBLE, wind_kph, NULL); @@ -119,8 +119,8 @@ static int missil_ml0757_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Missil-ML0757", - "id", "ID", DATA_INT, id, - "battery_ok", "Battery OK", DATA_INT, !flag_bat, + "id", "ID", DATA_INT, id, + "battery_ok", "Battery", DATA_INT, !flag_bat, "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, NULL); /* clang-format on */ diff --git a/src/devices/nexus.c b/src/devices/nexus.c index 54aee1746..5ddd08bbb 100644 --- a/src/devices/nexus.c +++ b/src/devices/nexus.c @@ -80,7 +80,7 @@ static int nexus_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Nexus-T", "id", "House Code", DATA_INT, id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, !!battery, "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, NULL); /* clang-format on */ @@ -91,7 +91,7 @@ static int nexus_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Nexus-TH", "id", "House Code", DATA_INT, id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, !!battery, "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, NULL); @@ -106,7 +106,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "humidity", NULL, diff --git a/src/devices/oregon_scientific.c b/src/devices/oregon_scientific.c index c630084d7..a81106db6 100644 --- a/src/devices/oregon_scientific.c +++ b/src/devices/oregon_scientific.c @@ -269,7 +269,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, (sensor_id == ID_THGR122N) ? "Oregon-THGR122N" : "Oregon-THGR968", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, get_os_temperature(msg), "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, get_os_humidity(msg), NULL); @@ -288,7 +288,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-WGR968", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "wind_max_m_s", "Gust", DATA_FORMAT, "%2.1f m/s",DATA_DOUBLE, gustWindspeed, "wind_avg_m_s", "Average", DATA_FORMAT, "%2.1f m/s",DATA_DOUBLE, avgWindspeed, "wind_dir_deg", "Direction", DATA_FORMAT, "%3.1f degrees",DATA_DOUBLE, quadrant, @@ -319,7 +319,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-BHTR968", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Celsius", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, get_os_humidity(msg), "pressure_hPa", "Pressure", DATA_FORMAT, "%.0f hPa", DATA_DOUBLE, pressure, @@ -338,7 +338,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-RGR968", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "rain_rate_mm_h", "Rain Rate", DATA_FORMAT, "%.02f mm/h", DATA_DOUBLE, rain_rate, "rain_mm", "Total Rain", DATA_FORMAT, "%.02f mm", DATA_DOUBLE, total_rain, NULL); @@ -355,7 +355,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-THR228N", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Celsius", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, NULL); /* clang-format on */ @@ -371,7 +371,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-THN132N", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Celsius", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, NULL); /* clang-format on */ @@ -387,7 +387,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-RTGN129", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), // 1 to 5 - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Celsius", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, get_os_humidity(msg), NULL); @@ -403,7 +403,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-RTGR328N", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), // 1 to 5 - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, get_os_temperature(msg), "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, get_os_humidity(msg), NULL); @@ -432,7 +432,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-RTGR328N", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), // 1 to 5 - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "radio_clock", "Radio Clock", DATA_STRING, clock_str, NULL); /* clang-format on */ @@ -447,7 +447,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-RTGN318", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), // 1 to 5 - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Celsius", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, get_os_humidity(msg), NULL); @@ -468,7 +468,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, (sensor_id == ID_THN129) ? "Oregon-THN129" : "Oregon-RTHN129", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), // 1 to 5 - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Celsius", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, NULL); /* clang-format on */ @@ -492,12 +492,12 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-BTHGN129", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), // 1 to 5 - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Celsius", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, get_os_humidity(msg), "pressure_hPa", "Pressure", DATA_FORMAT, "%.02f hPa", DATA_DOUBLE, pressure, NULL); - /* clang-format on */ + /* clang-format on */ decoder_output_data(decoder, data); return 1; } @@ -510,7 +510,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-UVR128", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "uv", "UV Index", DATA_FORMAT, "%u", DATA_INT, uvidx, - "battery", "Battery", DATA_STRING, get_os_battery(msg)?"LOW":"OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), //"channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), NULL); /* clang-format on */ @@ -525,7 +525,7 @@ static int oregon_scientific_v2_1_decode(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-THGR328N", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), // 1 to 5 - "battery", "Battery", DATA_STRING, get_os_battery(msg) ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, get_os_temperature(msg), "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, get_os_humidity(msg), NULL); @@ -623,7 +623,7 @@ static int oregon_scientific_v3_decode(r_device *decoder, bitbuffer_t *bitbuffer "model", "", DATA_STRING, "Oregon-THGR810", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg)?"LOW":"OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Celsius", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, NULL); @@ -640,7 +640,7 @@ static int oregon_scientific_v3_decode(r_device *decoder, bitbuffer_t *bitbuffer "model", "", DATA_STRING, "Oregon-THN802", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg)?"LOW":"OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "temperature_C", "Celsius", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, NULL); /* clang-format on */ @@ -656,7 +656,7 @@ static int oregon_scientific_v3_decode(r_device *decoder, bitbuffer_t *bitbuffer "model", "", DATA_STRING, "Oregon-UV800", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg)?"LOW":"OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "uv", "UV Index", DATA_FORMAT, "%u", DATA_INT, uvidx, NULL); /* clang-format on */ @@ -673,7 +673,7 @@ static int oregon_scientific_v3_decode(r_device *decoder, bitbuffer_t *bitbuffer "model", "", DATA_STRING, "Oregon-PCR800", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg)?"LOW":"OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "rain_rate_in_h", "Rain Rate", DATA_FORMAT, "%3.1f in/h", DATA_DOUBLE, rain_rate, "rain_in", "Total Rain", DATA_FORMAT, "%3.1f in", DATA_DOUBLE, total_rain, NULL); @@ -691,7 +691,7 @@ static int oregon_scientific_v3_decode(r_device *decoder, bitbuffer_t *bitbuffer "model", "", DATA_STRING, "Oregon-PCR800a", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg)?"LOW":"OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "rain_rate_in_h", "Rain Rate", DATA_FORMAT, "%3.1f in/h", DATA_DOUBLE, rain_rate, "rain_in", "Total Rain", DATA_FORMAT, "%3.1f in", DATA_DOUBLE, total_rain, NULL); @@ -710,7 +710,7 @@ static int oregon_scientific_v3_decode(r_device *decoder, bitbuffer_t *bitbuffer "model", "", DATA_STRING, "Oregon-WGR800", "id", "House Code", DATA_INT, get_os_rollingcode(msg), "channel", "Channel", DATA_INT, get_os_channel(msg, sensor_id), - "battery", "Battery", DATA_STRING, get_os_battery(msg)?"LOW":"OK", + "battery_ok", "Battery", DATA_INT, !get_os_battery(msg), "wind_max_m_s", "Gust", DATA_FORMAT, "%2.1f m/s",DATA_DOUBLE, gustWindspeed, "wind_avg_m_s", "Average", DATA_FORMAT, "%2.1f m/s",DATA_DOUBLE, avgWindspeed, "wind_dir_deg", "Direction", DATA_FORMAT, "%3.1f degrees",DATA_DOUBLE, quadrant, @@ -755,7 +755,7 @@ static int oregon_scientific_v3_decode(r_device *decoder, bitbuffer_t *bitbuffer data = data_make( "model", "", DATA_STRING, "Oregon-CM180", "id", "House Code", DATA_INT, id, - "battery", "Battery", DATA_STRING, batt_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !batt_low, "power_W", "Power", DATA_FORMAT, "%d W",DATA_INT, ipower, "energy_kWh", "Energy", DATA_COND, itotal != 0, DATA_FORMAT, "%2.2f kWh",DATA_DOUBLE, total_energy, "sequence", "sequence number", DATA_INT, sequence, @@ -793,7 +793,7 @@ static int oregon_scientific_v3_decode(r_device *decoder, bitbuffer_t *bitbuffer data = data_make( "model", "", DATA_STRING, "Oregon-CM180i", "id", "House Code", DATA_INT, id, - "battery", "Battery", DATA_STRING, batt_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !batt_low, "power1_W", "Power1", DATA_FORMAT, "%d W",DATA_INT, ipower1, "power2_W", "Power2", DATA_FORMAT, "%d W",DATA_INT, ipower2, "power3_W", "Power3", DATA_FORMAT, "%d W",DATA_INT, ipower3, @@ -837,7 +837,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "humidity", "rain_rate", // TODO: remove this diff --git a/src/devices/oregon_scientific_v1.c b/src/devices/oregon_scientific_v1.c index 7b652a8e6..c2da764e6 100644 --- a/src/devices/oregon_scientific_v1.c +++ b/src/devices/oregon_scientific_v1.c @@ -84,7 +84,7 @@ static int oregon_scientific_v1_callback(r_device *decoder, bitbuffer_t *bitbuff "model", "", DATA_STRING, "Oregon-v1", "id", "SID", DATA_INT, sid, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, tempC, "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); @@ -100,7 +100,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "mic", NULL, diff --git a/src/devices/philips_aj3650.c b/src/devices/philips_aj3650.c index 3a404f11a..ae6b88b57 100644 --- a/src/devices/philips_aj3650.c +++ b/src/devices/philips_aj3650.c @@ -58,7 +58,7 @@ static int philips_aj3650_decode(r_device *decoder, bitbuffer_t *bitbuffer) uint8_t a, b, c; uint8_t packet[PHILIPS_PACKETLEN]; uint8_t c_crc; - uint8_t channel, battery_status; + uint8_t channel, battery_low; int temp_raw; float temperature; data_t *data; @@ -133,13 +133,13 @@ static int philips_aj3650_decode(r_device *decoder, bitbuffer_t *bitbuffer) temperature = (temp_raw - 500) * 0.1f; /* Battery status */ - battery_status = packet[PHILIPS_PACKETLEN - 1] & 0x40; + battery_low = packet[PHILIPS_PACKETLEN - 1] & 0x40; /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Philips-Temperature", "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_status ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temperature, NULL); /* clang-format on */ @@ -151,7 +151,7 @@ static int philips_aj3650_decode(r_device *decoder, bitbuffer_t *bitbuffer) static char *output_fields[] = { "model", "channel", - "battery", + "battery_ok", "temperature_C", NULL, }; diff --git a/src/devices/prologue.c b/src/devices/prologue.c index 529bfa219..47cb8d28d 100644 --- a/src/devices/prologue.c +++ b/src/devices/prologue.c @@ -82,7 +82,7 @@ static int prologue_callback(r_device *decoder, bitbuffer_t *bitbuffer) "subtype", "", DATA_INT, type, "id", "", DATA_INT, id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, !!battery, "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_raw * 0.1, "humidity", "Humidity", DATA_COND, humidity != 0xcc, DATA_FORMAT, "%u %%", DATA_INT, humidity, "button", "Button", DATA_INT, button, @@ -98,7 +98,7 @@ static char *output_fields[] = { "subtype", "id", "channel", - "battery", + "battery_ok", "temperature_C", "humidity", "button", diff --git a/src/devices/rftech.c b/src/devices/rftech.c index cb8be401e..1027dc5f7 100644 --- a/src/devices/rftech.c +++ b/src/devices/rftech.c @@ -59,23 +59,24 @@ static int rftech_callback(r_device *decoder, bitbuffer_t *bitbuffer) battery = (bb[r][2] & 0x80) == 0x80; button = (bb[r][2] & 0x60) != 0; + /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "RF-tech", - "id", "Id", DATA_INT, sensor_id, - "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", - "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, value, - "button", "Button", DATA_INT, button, + "model", "", DATA_STRING, "RF-tech", + "id", "Id", DATA_INT, sensor_id, + "battery_ok", "Battery", DATA_INT, battery, + "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, value, + "button", "Button", DATA_INT, button, NULL); + /* clang-format on */ decoder_output_data(decoder, data); - return 1; } static char *csv_output_fields[] = { "model", "id", - "battery", + "battery_ok", "temperature_C", "button", NULL, diff --git a/src/devices/rubicson.c b/src/devices/rubicson.c index 5f5078077..65b4fed36 100644 --- a/src/devices/rubicson.c +++ b/src/devices/rubicson.c @@ -78,7 +78,7 @@ static int rubicson_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Rubicson-Temperature", "id", "House Code", DATA_INT, id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, !!battery, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c, "mic", "Integrity", DATA_STRING, "CRC", NULL); @@ -92,7 +92,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "mic", NULL, diff --git a/src/devices/s3318p.c b/src/devices/s3318p.c index dec8a4b48..0f1e05a6e 100644 --- a/src/devices/s3318p.c +++ b/src/devices/s3318p.c @@ -100,12 +100,12 @@ static int s3318p_callback(r_device *decoder, bitbuffer_t *bitbuffer) /* clang-format off */ data = data_make( "model", "", DATA_STRING, "Conrad-S3318P", - "id", "ID", DATA_INT, id, - "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "id", "ID", DATA_INT, id, + "channel", "Channel", DATA_INT, channel, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_F", "Temperature", DATA_FORMAT, "%.02f F", DATA_DOUBLE, temp_f, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, - "button", "Button", DATA_INT, button, + "button", "Button", DATA_INT, button, "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ @@ -118,7 +118,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "button", "temperature_F", "humidity", diff --git a/src/devices/sharp_spc775.c b/src/devices/sharp_spc775.c index ab9882a7f..f7795afbb 100644 --- a/src/devices/sharp_spc775.c +++ b/src/devices/sharp_spc775.c @@ -92,7 +92,7 @@ static int sharp_spc775_decode(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "Sharp-SPC775", "id", "", DATA_INT, id, - "battery_ok", "", DATA_INT, !battery_low, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp_c, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "mic", "Integrity", DATA_STRING, "CRC", diff --git a/src/devices/solight_te44.c b/src/devices/solight_te44.c index 06b93760c..c3c1d76e4 100644 --- a/src/devices/solight_te44.c +++ b/src/devices/solight_te44.c @@ -73,7 +73,7 @@ static int solight_te44_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Solight-TE44", "id", "Id", DATA_INT, id, "channel", "Channel", DATA_INT, channel + 1, -// "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", +// "battery_ok", "Battery", DATA_INT, !!battery, "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c, "mic", "Integrity", DATA_STRING, "CRC", NULL); @@ -87,7 +87,7 @@ static char *output_fields[] = { "model", "id", "channel", - //"battery", + //"battery_ok", "temperature_C", "mic", NULL, diff --git a/src/devices/springfield.c b/src/devices/springfield.c index d9f1ee5ad..8b848eea4 100644 --- a/src/devices/springfield.c +++ b/src/devices/springfield.c @@ -80,7 +80,7 @@ static int springfield_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Springfield-Soil", "id", "SID", DATA_INT, sid, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery, "transmit", "Transmit", DATA_STRING, button ? "MANUAL" : "AUTO", // TODO: delete this "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c, "moisture", "Moisture", DATA_FORMAT, "%d %%", DATA_INT, moisture, @@ -100,7 +100,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "transmit", // TODO: delete this "temperature_C", "moisture", diff --git a/src/devices/steelmate.c b/src/devices/steelmate.c index 2d3c692a0..4038d5df0 100644 --- a/src/devices/steelmate.c +++ b/src/devices/steelmate.c @@ -87,17 +87,19 @@ static int steelmate_callback(r_device *decoder, bitbuffer_t *bitbuffer) pressurePSI = (float)p1 / 2; battery_mV = tmpbattery_mV * 2; + /* clang-format off */ data = data_make( - "type", "", DATA_STRING, "TPMS", - "model", "", DATA_STRING, "Steelmate", - "id", "", DATA_STRING, sensorIDhex, - "pressure_PSI", "", DATA_DOUBLE, pressurePSI, - "temperature_F", "", DATA_DOUBLE, (float)tempFahrenheit, - "battery_mV", "", DATA_INT, battery_mV, - "mic", "Integrity", DATA_STRING, "CHECKSUM", - NULL); - decoder_output_data(decoder, data); + "type", "", DATA_STRING, "TPMS", + "model", "", DATA_STRING, "Steelmate", + "id", "", DATA_STRING, sensorIDhex, + "pressure_PSI", "", DATA_DOUBLE, pressurePSI, + "temperature_F", "", DATA_DOUBLE, (float)tempFahrenheit, + "battery_mV", "", DATA_INT, battery_mV, + "mic", "Integrity", DATA_STRING, "CHECKSUM", + NULL); + /* clang-format on */ + decoder_output_data(decoder, data); return 1; } diff --git a/src/devices/tfa_drop_30.3233.c b/src/devices/tfa_drop_30.3233.c index 03316b34b..474a94462 100644 --- a/src/devices/tfa_drop_30.3233.c +++ b/src/devices/tfa_drop_30.3233.c @@ -176,7 +176,7 @@ static int tfa_drop_303233_decode(r_device *decoder, bitbuffer_t *bitbuffer) data = data_make( "model", "", DATA_STRING, "TFA-Drop", "id", "", DATA_FORMAT, "%5x", DATA_INT, sensor_id, - "battery_ok", "Battery OK", DATA_INT, !battery_low, + "battery_ok", "Battery", DATA_INT, !battery_low, "rain_mm", "Rain in MM", DATA_DOUBLE, rain_mm, "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); diff --git a/src/devices/tfa_twin_plus_30.3049.c b/src/devices/tfa_twin_plus_30.3049.c index e0e88cd69..a85353bca 100644 --- a/src/devices/tfa_twin_plus_30.3049.c +++ b/src/devices/tfa_twin_plus_30.3049.c @@ -92,9 +92,9 @@ static int tfa_twin_plus_303049_callback(r_device *decoder, bitbuffer_t *bitbuff data = data_make( "model", "", DATA_STRING, "TFA-TwinPlus", - "id", "Id", DATA_INT, sensor_id, - "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "id", "Id", DATA_INT, sensor_id, + "channel", "Channel", DATA_INT, channel, + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, tempC, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "mic", "Integrity", DATA_STRING, "CHECKSUM", @@ -108,7 +108,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "humidity", "mic", diff --git a/src/devices/tpms_abarth124.c b/src/devices/tpms_abarth124.c index 299a22650..7e6b189e3 100644 --- a/src/devices/tpms_abarth124.c +++ b/src/devices/tpms_abarth124.c @@ -81,7 +81,7 @@ static int tpms_abarth124_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsi "pressure_kPa", "Pressure", DATA_FORMAT, "%.0f kPa", DATA_DOUBLE, (float)pressure * 1.38, "temperature_C", "Temperature", DATA_FORMAT, "%.0f C", DATA_DOUBLE, (float)temperature - 50.0, "status", "", DATA_INT, status, - "mic", "", DATA_STRING, "CHECKSUM", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ diff --git a/src/devices/tpms_citroen.c b/src/devices/tpms_citroen.c index f6e998019..6e53b4d62 100644 --- a/src/devices/tpms_citroen.c +++ b/src/devices/tpms_citroen.c @@ -84,7 +84,7 @@ static int tpms_citroen_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign "pressure_kPa", "Pressure", DATA_FORMAT, "%.0f kPa", DATA_DOUBLE, (double)pressure * 1.364, "temperature_C", "Temperature", DATA_FORMAT, "%.0f C", DATA_DOUBLE, (double)temperature - 50.0, "maybe_battery", "", DATA_INT, maybe_battery, - "mic", "", DATA_STRING, "CHECKSUM", + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ diff --git a/src/devices/tpms_hyundai_vdo.c b/src/devices/tpms_hyundai_vdo.c index 72624051e..5a606c7c8 100644 --- a/src/devices/tpms_hyundai_vdo.c +++ b/src/devices/tpms_hyundai_vdo.c @@ -93,7 +93,7 @@ static int tpms_hyundai_vdo_decode(r_device *decoder, bitbuffer_t *bitbuffer, un "pressure_kPa", "pressure", DATA_FORMAT, "%.0f kPa", DATA_DOUBLE, (double)pressure * 1.375, "temperature_C", "temp", DATA_FORMAT, "%.0f C", DATA_DOUBLE, (double)temperature - 50.0, "maybe_battery", "", DATA_INT, maybe_battery, - "mic", "", DATA_STRING, "CRC", + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ diff --git a/src/devices/tpms_jansite.c b/src/devices/tpms_jansite.c index 35ebb05cc..22c6a0190 100644 --- a/src/devices/tpms_jansite.c +++ b/src/devices/tpms_jansite.c @@ -68,7 +68,7 @@ static int tpms_jansite_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign "pressure_kPa", "Pressure", DATA_FORMAT, "%.0f kPa", DATA_DOUBLE, (double)pressure * 1.7, "temperature_C", "Temperature", DATA_FORMAT, "%.0f C", DATA_DOUBLE, (double)temperature - 50.0, "code", "", DATA_STRING, code_str, - //"mic", "", DATA_STRING, "CHECKSUM", + //"mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); /* clang-format on */ diff --git a/src/devices/tpms_jansite_solar.c b/src/devices/tpms_jansite_solar.c index 305d31ff2..9aab79ece 100644 --- a/src/devices/tpms_jansite_solar.c +++ b/src/devices/tpms_jansite_solar.c @@ -89,7 +89,7 @@ static int tpms_jansite_solar_decode(r_device *decoder, bitbuffer_t *bitbuffer, "pressure_kPa", "Pressure", DATA_FORMAT, "%.0f kPa", DATA_DOUBLE, (float)pressure * 1.6, "temperature_C", "Temperature", DATA_FORMAT, "%.0f C", DATA_DOUBLE, (float)temperature - 55.0, "code", "", DATA_STRING, code_str, - "mic", "", DATA_STRING, "CRC", + "mic", "Integrity", DATA_STRING, "CRC", NULL); /* clang-format on */ diff --git a/src/devices/tpms_pmv107j.c b/src/devices/tpms_pmv107j.c index 7aadf3c8a..93364bfdf 100644 --- a/src/devices/tpms_pmv107j.c +++ b/src/devices/tpms_pmv107j.c @@ -78,18 +78,20 @@ static int tpms_pmv107j_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign sprintf(id_str, "%08x", id); + /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "PMV-107J", - "type", "", DATA_STRING, "TPMS", - "id", "", DATA_STRING, id_str, - "status", "", DATA_INT, status, - "battery", "", DATA_STRING, battery_low ? "LOW" : "OK", - "counter", "", DATA_INT, counter, - "failed", "", DATA_STRING, failed ? "FAIL" : "OK", - "pressure_kPa", "", DATA_DOUBLE, pressure_kpa, - "temperature_C", "", DATA_DOUBLE, temperature_c, - "mic", "", DATA_STRING, "CRC", - NULL); + "model", "", DATA_STRING, "PMV-107J", + "type", "", DATA_STRING, "TPMS", + "id", "", DATA_STRING, id_str, + "status", "", DATA_INT, status, + "battery_ok", "", DATA_INT, !battery_low, + "counter", "", DATA_INT, counter, + "failed", "", DATA_STRING, failed ? "FAIL" : "OK", + "pressure_kPa", "", DATA_DOUBLE, pressure_kpa, + "temperature_C", "", DATA_DOUBLE, temperature_c, + "mic", "Integrity", DATA_STRING, "CRC", + NULL); + /* clang-format on */ decoder_output_data(decoder, data); return 1; @@ -122,7 +124,7 @@ static char *output_fields[] = { "type", "id", "status", - "battery", + "battery_ok", "counter", "failed", "pressure_kPa", diff --git a/src/devices/tpms_renault.c b/src/devices/tpms_renault.c index 866e3eb8b..29eebfa96 100644 --- a/src/devices/tpms_renault.c +++ b/src/devices/tpms_renault.c @@ -63,15 +63,17 @@ static int tpms_renault_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign unknown = b[7] << 8 | b[6]; // little-endian, fixed 0xffff? sprintf(code_str, "%04x", unknown); + /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "Renault", - "type", "", DATA_STRING, "TPMS", - "id", "", DATA_STRING, id_str, - "flags", "", DATA_STRING, flags_str, - "pressure_kPa", "", DATA_FORMAT, "%.1f kPa", DATA_DOUBLE, (double)pressure_kpa, - "temperature_C", "", DATA_FORMAT, "%.0f C", DATA_DOUBLE, (double)temp_c, - "mic", "", DATA_STRING, "CRC", + "model", "", DATA_STRING, "Renault", + "type", "", DATA_STRING, "TPMS", + "id", "", DATA_STRING, id_str, + "flags", "", DATA_STRING, flags_str, + "pressure_kPa", "", DATA_FORMAT, "%.1f kPa", DATA_DOUBLE, (double)pressure_kpa, + "temperature_C", "", DATA_FORMAT, "%.0f C", DATA_DOUBLE, (double)temp_c, + "mic", "Integrity", DATA_STRING, "CRC", NULL); + /* clang-format on */ decoder_output_data(decoder, data); return 1; diff --git a/src/devices/tpms_toyota.c b/src/devices/tpms_toyota.c index 3de96157f..6a184d027 100644 --- a/src/devices/tpms_toyota.c +++ b/src/devices/tpms_toyota.c @@ -65,15 +65,17 @@ static int tpms_toyota_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsigne sprintf(id_str, "%08x", id); + /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "Toyota", - "type", "", DATA_STRING, "TPMS", - "id", "", DATA_STRING, id_str, - "status", "", DATA_INT, status, - "pressure_PSI", "", DATA_DOUBLE, pressure1*0.25-7.0, - "temperature_C", "", DATA_DOUBLE, temp-40.0, - "mic", "", DATA_STRING, "CRC", - NULL); + "model", "", DATA_STRING, "Toyota", + "type", "", DATA_STRING, "TPMS", + "id", "", DATA_STRING, id_str, + "status", "", DATA_INT, status, + "pressure_PSI", "", DATA_DOUBLE, pressure1*0.25-7.0, + "temperature_C", "", DATA_DOUBLE, temp-40.0, + "mic", "Integrity", DATA_STRING, "CRC", + NULL); + /* clang-format on */ decoder_output_data(decoder, data); return 1; diff --git a/src/devices/ts_ft002.c b/src/devices/ts_ft002.c index 3bd377dd5..e3b86aa57 100644 --- a/src/devices/ts_ft002.c +++ b/src/devices/ts_ft002.c @@ -93,9 +93,9 @@ static int ts_ft002_decoder(r_device *decoder, bitbuffer_t *bitbuffer) "depth_cm", "Depth", DATA_INT, depth, "temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp_c, "transmit_s", "Transmit Interval", DATA_INT, transmit, - //"battery_ok", "Battery Flag", DATA_INT, batt_low, - "flags", "Battery Flag?", DATA_INT, batt_low, - "mic", "MIC", DATA_STRING, "CHECKSUM", + //"battery_ok", "Battery", DATA_INT, batt_low, + "flags", "Battery Flag?", DATA_INT, batt_low, + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); decoder_output_data(decoder, data); /* clang-format on */ diff --git a/src/devices/ttx201.c b/src/devices/ttx201.c index 0e3fe0806..25eadcf06 100644 --- a/src/devices/ttx201.c +++ b/src/devices/ttx201.c @@ -172,16 +172,18 @@ ttx201_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsigned row, unsigned temperature = (int16_t)(((b[3] & 0x0f) << 12) | (b[4] << 4)); // uses sign extend temperature_c = (temperature >> 4) * 0.1f; + /* clang-format off */ data = data_make( - "model", "", DATA_STRING, "Emos-TTX201", - "id", "House Code", DATA_INT, device_id, - "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", - "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temperature_c, - "mic", "MIC", DATA_STRING, "CHECKSUM", + "model", "", DATA_STRING, "Emos-TTX201", + "id", "House Code", DATA_INT, device_id, + "channel", "Channel", DATA_INT, channel, + "battery_ok", "Battery", DATA_INT, !battery_low, + "temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temperature_c, + "mic", "Integrity", DATA_STRING, "CHECKSUM", NULL); - decoder_output_data(decoder, data); + /* clang-format on */ + decoder_output_data(decoder, data); return 1; } @@ -213,7 +215,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "mic", NULL, diff --git a/src/devices/vaillant_vrt340f.c b/src/devices/vaillant_vrt340f.c index a2b37ceec..71fbd7da0 100644 --- a/src/devices/vaillant_vrt340f.c +++ b/src/devices/vaillant_vrt340f.c @@ -171,7 +171,7 @@ vaillant_vrt340_callback(r_device *decoder, bitbuffer_t *bitbuffer) "heating", "Heating Mode", DATA_STRING, (heating_mode==0)?"OFF":((heating_mode==1)?"ON (2-point)":"ON (analogue)"), "heating_temp", "Heating Water Temp.", DATA_FORMAT, "%d", DATA_INT, (int16_t)target_temperature, "water", "Pre-heated Water", DATA_STRING, water_preheated ? "ON" : "off", - "battery", "Battery", DATA_STRING, isBatteryLow ? "Low" : "OK", + "battery_ok", "Battery", DATA_INT, !isBatteryLow, NULL); /* clang-format on */ decoder_output_data(decoder, data); @@ -204,23 +204,23 @@ vaillant_vrt340_callback(r_device *decoder, bitbuffer_t *bitbuffer) } static char *output_fields[] = { - "model", - "id", - "heating", - "heating_temp", - "water", - "battery", - NULL + "model", + "id", + "heating", + "heating_temp", + "water", + "battery_ok", + NULL, }; r_device vaillant_vrt340f = { - .name = "Vaillant calorMatic VRT340f Central Heating Control", - .modulation = OOK_PULSE_DMC, - .short_width = 836, // half-bit width 836 us - .long_width = 1648, // bit width 1648 us - .reset_limit = 4000, - .tolerance = 120, // us - .decode_fn = &vaillant_vrt340_callback, - .disabled = 0, - .fields = output_fields + .name = "Vaillant calorMatic VRT340f Central Heating Control", + .modulation = OOK_PULSE_DMC, + .short_width = 836, // half-bit width 836 us + .long_width = 1648, // bit width 1648 us + .reset_limit = 4000, + .tolerance = 120, // us + .decode_fn = &vaillant_vrt340_callback, + .disabled = 0, + .fields = output_fields, }; diff --git a/src/devices/visonic_powercode.c b/src/devices/visonic_powercode.c index ea279f57d..e01ee2148 100644 --- a/src/devices/visonic_powercode.c +++ b/src/devices/visonic_powercode.c @@ -90,17 +90,17 @@ static int visonic_powercode_decode(r_device *decoder, bitbuffer_t *bitbuffer) // populate data byte fields /* clang-format off */ data = data_make( - "model", "Model" , DATA_STRING, "Visonic-Powercode", - "id", "ID" , DATA_STRING, id, - "tamper", "Tamper" , DATA_INT, ((0x80 & msg[3]) == 0x80) ? 1 : 0, - "alarm", "Alarm" , DATA_INT, ((0x40 & msg[3]) == 0x40) ? 1 : 0, - "battery_ok", "Battery OK" , DATA_INT, ((0x20 & msg[3]) == 0x20) ? 0 : 1, - "else", "Else" , DATA_INT, ((0x10 & msg[3]) == 0x10) ? 1 : 0, - "restore", "Restore" , DATA_INT, ((0x08 & msg[3]) == 0x08) ? 1 : 0, - "supervised", "Supervised" , DATA_INT, ((0x04 & msg[3]) == 0x04) ? 1 : 0, - "spidernet", "Spidernet" , DATA_INT, ((0x02 & msg[3]) == 0x02) ? 1 : 0, - "repeater", "Repeater" , DATA_INT, ((0x01 & msg[3]) == 0x01) ? 1 : 0, - "mic", "Integrity" , DATA_STRING, "LRC", + "model", "Model", DATA_STRING, "Visonic-Powercode", + "id", "ID", DATA_STRING, id, + "tamper", "Tamper", DATA_INT, ((0x80 & msg[3]) == 0x80) ? 1 : 0, + "alarm", "Alarm", DATA_INT, ((0x40 & msg[3]) == 0x40) ? 1 : 0, + "battery_ok", "Battery", DATA_INT, ((0x20 & msg[3]) == 0x20) ? 0 : 1, + "else", "Else", DATA_INT, ((0x10 & msg[3]) == 0x10) ? 1 : 0, + "restore", "Restore", DATA_INT, ((0x08 & msg[3]) == 0x08) ? 1 : 0, + "supervised", "Supervised", DATA_INT, ((0x04 & msg[3]) == 0x04) ? 1 : 0, + "spidernet", "Spidernet", DATA_INT, ((0x02 & msg[3]) == 0x02) ? 1 : 0, + "repeater", "Repeater", DATA_INT, ((0x01 & msg[3]) == 0x01) ? 1 : 0, + "mic", "Integrity", DATA_STRING, "LRC", NULL); /* clang-format on */ diff --git a/src/devices/wssensor.c b/src/devices/wssensor.c index 8175c122b..b3cdcc499 100644 --- a/src/devices/wssensor.c +++ b/src/devices/wssensor.c @@ -87,7 +87,7 @@ static int wssensor_decode(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "Hyundai-WS", "id", "House Code", DATA_INT, sensor_id, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_status ? "OK" : "LOW", + "battery_ok", "Battery", DATA_INT, !!battery_status, "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temperature_c, "button", "Button", DATA_INT, startup, NULL); @@ -101,7 +101,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "button", NULL, diff --git a/src/devices/wt450.c b/src/devices/wt450.c index 37463b779..99da02a2f 100644 --- a/src/devices/wt450.c +++ b/src/devices/wt450.c @@ -107,7 +107,7 @@ static int wt450_callback(r_device *decoder, bitbuffer_t *bitbuffer) "model", "", DATA_STRING, "WT450-TH", "id", "House Code", DATA_INT, house_code, "channel", "Channel", DATA_INT, channel, - "battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK", + "battery_ok", "Battery", DATA_INT, !battery_low, "temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp, "humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity, "seq", "Sequence", DATA_INT, seq, @@ -122,7 +122,7 @@ static char *output_fields[] = { "model", "id", "channel", - "battery", + "battery_ok", "temperature_C", "humidity", "seq", diff --git a/src/devices/x10_sec.c b/src/devices/x10_sec.c index 512cca02a..f97909dfd 100644 --- a/src/devices/x10_sec.c +++ b/src/devices/x10_sec.c @@ -181,7 +181,7 @@ static int x10_sec_callback(r_device *decoder, bitbuffer_t *bitbuffer) "code", "Code", DATA_STRING, x10_code_str, "event", "Event", DATA_STRING, event_str, "delay", "Delay", DATA_COND, delay, DATA_INT, delay, - "battery_ok", "Battery OK", DATA_COND, battery_low, DATA_INT, !battery_low, + "battery_ok", "Battery", DATA_COND, battery_low, DATA_INT, !battery_low, "tamper", "Tamper", DATA_COND, tamper, DATA_INT, tamper, "mic", "Integrity", DATA_STRING, "CRC", NULL); diff --git a/src/r_api.c b/src/r_api.c index 2ef688efe..50551f2cc 100644 --- a/src/r_api.c +++ b/src/r_api.c @@ -372,10 +372,6 @@ char const **well_known_output_fields(r_cfg_t *cfg) /** Convert CSV keys according to selected conversion mode. Replacement is static but in-place. */ static char const **convert_csv_fields(r_cfg_t *cfg, char const **fields) { - for (char const **p = fields; *p; ++p) { - if (!strcmp(*p, "battery")) *p = "battery_ok"; - } - if (cfg->conversion_mode == CONVERT_SI) { for (char const **p = fields; *p; ++p) { if (!strcmp(*p, "temperature_F")) *p = "temperature_C"; @@ -552,21 +548,6 @@ void data_acquired_handler(r_device *r_dev, data_t *data) } #endif - // replace textual battery key with numerical battery key - for (data_t *d = data; d; d = d->next) { - if ((d->type == DATA_STRING) && !strcmp(d->key, "battery")) { - free(d->key); - d->key = strdup("battery_ok"); - if (!d->key) - FATAL_STRDUP("data_acquired_handler()"); - int ok = d->value.v_ptr && !strcmp(d->value.v_ptr, "OK"); - free(d->value.v_ptr); - d->type = DATA_INT; - d->value.v_int = ok; - break; - } - } - if (cfg->conversion_mode == CONVERT_SI) { for (data_t *d = data; d; d = d->next) { // Convert double type fields ending in _F to _C