From 1f94344d4e82d5185a648693af68c94cd23415ec Mon Sep 17 00:00:00 2001 From: 1technophile <12672732+1technophile@users.noreply.github.com> Date: Sun, 26 Apr 2026 12:27:13 -0500 Subject: [PATCH] iNodeEM: emit batt as int 100 instead of string "100" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `_batt` static-value override was written as `["static_value", "100"]` (quoted), so when the byte-20 condition matches, the property is set to a string `"100"` instead of an int. Other rules' `static_value` numeric literals (e.g. battery percent fallbacks elsewhere) use unquoted numbers, so unwrapping it here aligns with the rest of the decoder and matches what the existing test_ble.cpp `expected` array already declares (`"batt":100`). Behaviour change is type-only — value is still 100 — but consumers that parse the JSON strictly (e.g. Python json.loads on an MQTT payload) now see an int where the expected output already promised an int. The upstream test passed before only because ArduinoJson 6's JsonVariant `!=` operator silently coerces a numeric string to a number. Strict consumers (Theengs Android app surfacing this via MQTT) saw the string and reported a field-type diff vs the catalog. --- src/devices/iNodeEM_json.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/iNodeEM_json.h b/src/devices/iNodeEM_json.h index 4bea0b50..aac3d6ed 100644 --- a/src/devices/iNodeEM_json.h +++ b/src/devices/iNodeEM_json.h @@ -1,4 +1,4 @@ -const char* _iNodeEM_json = "{\"brand\":\"iNode\",\"model\":\"Energy Meter\",\"model_id\":\"INEM\",\"tag\":\"0c01\",\"condition\":[\"manufacturerdata\",\"index\",0,\"90\",\"|\",\"manufacturerdata\",\"index\",0,\"92\",\"|\",\"manufacturerdata\",\"index\",0,\"94\",\"|\",\"manufacturerdata\",\"index\",0,\"96\",\"&\",\"manufacturerdata\",\"=\",26,\"index\",2,\"82\"],\"properties\":{\".cal\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",16,4,true,false],\"post_proc\":[\"&\",16383]},\"avg\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",4,4,true,false],\"post_proc\":[\"*\",60,\"/\",\".cal\"]},\"avgu\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",18,0,\"kW\",\"m³\"]},\"sum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",8,4,true,false],\"post_proc\":[\"/\",\".cal\"]},\"sumu\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",18,0,\"kWh\",\"m³\"]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,1,false,false],\"post_proc\":[\"-\",1,\"*\",10]},\"_batt\":{\"condition\":[\"manufacturerdata\",20,\"1\",\"|\",\"manufacturerdata\",20,\"c\",\"|\",\"manufacturerdata\",20,\"d\",\"|\",\"manufacturerdata\",20,\"e\",\"|\",\"manufacturerdata\",20,\"f\"],\"decoder\":[\"static_value\",\"100\"]},\"lowbatt\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",1,2,false,true]}}}"; +const char* _iNodeEM_json = "{\"brand\":\"iNode\",\"model\":\"Energy Meter\",\"model_id\":\"INEM\",\"tag\":\"0c01\",\"condition\":[\"manufacturerdata\",\"index\",0,\"90\",\"|\",\"manufacturerdata\",\"index\",0,\"92\",\"|\",\"manufacturerdata\",\"index\",0,\"94\",\"|\",\"manufacturerdata\",\"index\",0,\"96\",\"&\",\"manufacturerdata\",\"=\",26,\"index\",2,\"82\"],\"properties\":{\".cal\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",16,4,true,false],\"post_proc\":[\"&\",16383]},\"avg\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",4,4,true,false],\"post_proc\":[\"*\",60,\"/\",\".cal\"]},\"avgu\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",18,0,\"kW\",\"m³\"]},\"sum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",8,4,true,false],\"post_proc\":[\"/\",\".cal\"]},\"sumu\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",18,0,\"kWh\",\"m³\"]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,1,false,false],\"post_proc\":[\"-\",1,\"*\",10]},\"_batt\":{\"condition\":[\"manufacturerdata\",20,\"1\",\"|\",\"manufacturerdata\",20,\"c\",\"|\",\"manufacturerdata\",20,\"d\",\"|\",\"manufacturerdata\",20,\"e\",\"|\",\"manufacturerdata\",20,\"f\"],\"decoder\":[\"static_value\",100]},\"lowbatt\":{\"decoder\":[\"bit_static_value\",\"manufacturerdata\",1,2,false,true]}}}"; /*R""""( { "brand":"iNode", @@ -31,7 +31,7 @@ const char* _iNodeEM_json = "{\"brand\":\"iNode\",\"model\":\"Energy Meter\",\"m }, "_batt":{ "condition":["manufacturerdata", 20, "1", "|", "manufacturerdata", 20, "c", "|", "manufacturerdata", 20, "d", "|", "manufacturerdata", 20, "e", "|", "manufacturerdata", 20, "f"], - "decoder":["static_value", "100"] + "decoder":["static_value", 100] }, "lowbatt":{ "decoder":["bit_static_value", "manufacturerdata", 1, 2, false, true]