Page 1 of 1

Wrong battery level for a new device

Posted: Friday 04 August 2017 7:47
by BakSeeDaa
Hi there, it's me again. :oops:

I added a new Fibaro Wall plug FGWPF-102-ZW5 to my system a few days ago.

I started to get messages about low battery level for this device and it's not accurate because it's mains powered.

Here is the Domoticz device listing:

Code: Select all

{
   "ActTime" : 1501824965,
   "ServerTime" : "2017-08-04 07:36:05",
   "Sunrise" : "05:16",
   "Sunset" : "21:15",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "Off",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 4,
         "HardwareName" : "ZWaveUSB",
         "HardwareType" : "OpenZWave USB",
         "HardwareTypeVal" : 21,
         "HaveDimmer" : true,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "00006701",
         "Image" : "Light",
         "IsSubDevice" : false,
         "LastUpdate" : "2017-08-04 06:54:53",
         "Level" : 0,
         "LevelInt" : 0,
         "MaxDimLevel" : 100,
         "Name" : "Sovrumsfläkt",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Status" : "Off",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "Switch",
         "SwitchType" : "On/Off",
         "SwitchTypeVal" : 0,
         "Timers" : "false",
         "Type" : "Light/Switch",
         "TypeImg" : "lightbulb",
         "Unit" : 1,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "611"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}
And here is the dzVents debug entry:

Code: Select all

[191] = {
		["switchType"] = "On/Off";
		["timedOut"] = false;
		["description"] = "";
		["rawData"] = {
			[1] = "0";
		};
		["name"] = "Sovrumsfläkt";
		["switchTypeValue"] = 0;
		["data"] = {
			["levelVal"] = 0;
			["hardwareID"] = 1872875856;
			["icon"] = "lightbulb";
			["_state"] = "Off";
			["protected"] = false;
			["_nValue"] = 0;
			["unit"] = 1;
			["hardwareType"] = "OpenZWave USB";
			["maxDimLevel"] = 100;
			["hardwareTypeValue"] = 21;
			["hardwareName"] = "ZWaveUSB";
			["usedByCamera"] = false;
		};
		["baseType"] = "device";
		["deviceType"] = "Light/Switch";
		["id"] = 611;
		["deviceID"] = "";
		["changed"] = false;
		["signalLevel"] = 1992167424;
		["batteryLevel"] = 0;
		["lastLevel"] = 0;
		["lastUpdate"] = "2017-08-04 06:54:53";
		["subType"] = "Switch";
	};
For reference, below is another Fibaro wall plug:

Code: Select all

	[121] = {
		["switchType"] = "On/Off";
		["timedOut"] = false;
		["description"] = "";
		["rawData"] = {
			[1] = "0";
		};
		["name"] = "Alarm Status Indicator";
		["switchTypeValue"] = 0;
		["data"] = {
			["levelVal"] = 0;
			["hardwareID"] = 4;
			["icon"] = "lightbulb";
			["_state"] = "On";
			["protected"] = false;
			["_nValue"] = 1;
			["unit"] = 1;
			["hardwareType"] = "OpenZWave USB";
			["maxDimLevel"] = 100;
			["hardwareTypeValue"] = 21;
			["hardwareName"] = "ZWaveUSB";
			["usedByCamera"] = false;
		};
		["baseType"] = "device";
		["deviceType"] = "Light/Switch";
		["id"] = 454;
		["deviceID"] = "00006201";
		["changed"] = false;
		["signalLevel"] = 12;
		["batteryLevel"] = 255;
		["lastLevel"] = 0;
		["lastUpdate"] = "2017-08-04 06:54:54";
		["subType"] = "Switch";
	};
Strange isn't it?

Re: Wrong battery level for a new device

Posted: Friday 04 August 2017 15:11
by dannybloe
I don't know why this is. The batterylevel comes straight out of the database I think and is then handed to the event system. I do know that when it is 255 it is not-applicable for that device. So in the generic device adapter in dzVents I only create a batteryLevel if it has a value less than or equal to 100 (it's a percentage after all). If it is higher it is nil (not existing).

Re: Wrong battery level for a new device

Posted: Saturday 05 August 2017 10:16
by BakSeeDaa
dannybloe wrote:I don't know why this is. The batterylevel comes straight out of the database I think and is then handed to the event system. I do know that when it is 255 it is not-applicable for that device. So in the generic device adapter in dzVents I only create a batteryLevel if it has a value less than or equal to 100 (it's a percentage after all). If it is higher it is nil (not existing).
Thanks @dannybloe

This is not a battery level issue. The data parameter supplied to the function in the generic device adapters is not complete. For example the data.deviceID is an empty string and the hardwareID 1872875856 is wrong. The device seems to have proper values when looking at it in the Domoticz device manager though. Please let me know if you have any idea about how to debug it further.

Thanks!