diff --git a/app.json b/app.json index 9ba0b12..d0ebe8d 100644 --- a/app.json +++ b/app.json @@ -2483,6 +2483,42 @@ "en": "Surplus tariff 2", "nl": "Teruglevering tarief 2" } + }, + "measure_power.received_l1": { + "title": { + "en": "Usage phase L1", + "nl": "Verbruik fase L1" + } + }, + "measure_power.received_l2": { + "title": { + "en": "Usage phase L2", + "nl": "Verbruik fase L2" + } + }, + "measure_power.received_l3": { + "title": { + "en": "Usage phase L3", + "nl": "Verbruik fase L3" + } + }, + "measure_power.delivered_l1": { + "title": { + "en": "Surplus phase L1", + "nl": "Teruglevering fase L1" + } + }, + "measure_power.delivered_l2": { + "title": { + "en": "Surplus phase L2", + "nl": "Teruglevering fase L2" + } + }, + "measure_power.delivered_l3": { + "title": { + "en": "Surplus phase L3", + "nl": "Teruglevering fase L3" + } } }, "energy": { diff --git a/drivers/p1/device.js b/drivers/p1/device.js index 411a186..44ac812 100644 --- a/drivers/p1/device.js +++ b/drivers/p1/device.js @@ -190,16 +190,25 @@ module.exports = class P1_Device extends GeneralDevice { }); } - // Power usage + // Total power usage this.setValue("measure_power", dg.electricity.received.actual.reading * 1000); this.setValue("meter_power.received1", dg.electricity.received.tariff1.reading); this.setValue("meter_power.received2", dg.electricity.received.tariff2.reading); - // Power surplus + // Total power surplus this.setValue("measure_power.delivery", 0 - dg.electricity.delivered.actual * 1000); this.setValue("meter_power.delivered1", dg.electricity.delivered.tariff1.reading); this.setValue("meter_power.delivered2", dg.electricity.delivered.tariff2.reading); + // Power usage per phase + // Only if phase 2 is not null + if (dg.electricity.instantaneous.power.positive.L2.reading) { + for (let i = 1; i < 4; i++) { + this.setValue('measure_power.received_l' + i, dg.electricity.instantaneous.power.positive['L' + i].reading * 1000); + this.setValue('measure_power.delivered_l' + i, dg.electricity.instantaneous.power.negative['L' + i].reading * 1000); + } + } + // Active tariff if (dg.electricity.tariffIndicator) { this.setValue("alarm_active_tariff", dg.electricity.tariffIndicator.toString()); diff --git a/drivers/p1/driver.compose.json b/drivers/p1/driver.compose.json index 60a9202..2495e17 100644 --- a/drivers/p1/driver.compose.json +++ b/drivers/p1/driver.compose.json @@ -43,6 +43,42 @@ "en": "Surplus tariff 2", "nl": "Teruglevering tarief 2" } + }, + "measure_power.received_l1": { + "title": { + "en": "Usage phase L1", + "nl": "Verbruik fase L1" + } + }, + "measure_power.received_l2": { + "title": { + "en": "Usage phase L2", + "nl": "Verbruik fase L2" + } + }, + "measure_power.received_l3": { + "title": { + "en": "Usage phase L3", + "nl": "Verbruik fase L3" + } + }, + "measure_power.delivered_l1": { + "title": { + "en": "Surplus phase L1", + "nl": "Teruglevering fase L1" + } + }, + "measure_power.delivered_l2": { + "title": { + "en": "Surplus phase L2", + "nl": "Teruglevering fase L2" + } + }, + "measure_power.delivered_l3": { + "title": { + "en": "Surplus phase L3", + "nl": "Teruglevering fase L3" + } } }, "energy": {