diff --git a/devices/generic/items/state_power_divisor_item.json b/devices/generic/items/state_power_divisor_item.json new file mode 100644 index 0000000000..e01d5116d6 --- /dev/null +++ b/devices/generic/items/state_power_divisor_item.json @@ -0,0 +1,22 @@ +{ + "schema": "resourceitem1.schema.json", + "id": "state/power_divisor", + "datatype": "UInt16", + "access": "R", + "public": false, + "description": "AC Power Divisor to be divided against the Instantaneous Power and Active Power attributes.", + "read": { + "at": "0x0605", + "cl": "0x0b04", + "ep": 0, + "fn": "zcl:attr" + }, + "parse": { + "at": "0x0605", + "cl": "0x0b04", + "ep": 0, + "eval": "if (Attr.val > 0) { Item.val = Attr.val; }" + }, + "refresh.interval": 300, + "default": 1 +} diff --git a/devices/generic/items/state_power_item.json b/devices/generic/items/state_power_item.json index a1924b19b5..56a410505e 100644 --- a/devices/generic/items/state_power_item.json +++ b/devices/generic/items/state_power_item.json @@ -2,9 +2,9 @@ "schema": "resourceitem1.schema.json", "id": "state/power", "datatype": "Int16", - "access": "RW", + "access": "R", "public": true, - "description": "The measured power (in W).", + "description": "Active Power (in Watts). Positive values indicate power delivered, negative values indicate power received.", "read": { "at": "0x050b", "cl": "0x0b04", @@ -15,7 +15,7 @@ "at": "0x050b", "cl": "0x0b04", "ep": 0, - "eval": "if (Attr.val != -32768 && Attr.val != 32768) { Item.val = Attr.val; }" + "eval": "if (Attr.val != -32768 && Attr.val != 32768) { Item.val = Attr.val * R.item('state/power_multiplier').val / R.item('state/power_divisor').val; }" }, "refresh.interval": 300, "default": 0 diff --git a/devices/generic/items/state_power_multiplier_item.json b/devices/generic/items/state_power_multiplier_item.json new file mode 100644 index 0000000000..7359ff5089 --- /dev/null +++ b/devices/generic/items/state_power_multiplier_item.json @@ -0,0 +1,22 @@ +{ + "schema": "resourceitem1.schema.json", + "id": "state/power_multiplier", + "datatype": "UInt16", + "access": "R", + "public": false, + "description": "AC Power Divisor to be divided against the Instantaneous Power and Active Power attributes.", + "read": { + "at": "0x0604", + "cl": "0x0b04", + "ep": 0, + "fn": "zcl:attr" + }, + "parse": { + "at": "0x0604", + "cl": "0x0b04", + "ep": 0, + "eval": "if (Attr.val > 0) { Item.val = Attr.val; }" + }, + "refresh.interval": 300, + "default": 1 +}