diff --git a/app.json b/app.json index acd59bce..c790dcf5 100644 --- a/app.json +++ b/app.json @@ -1430,6 +1430,47 @@ ] } ] + }, + { + "type": "group", + "label": { + "en": "Show/hide phases" + }, + "children": [ + { + "id": "show_phase_current_L1", + "type": "checkbox", + "label": { + "en": "Show current phase 1" + }, + "value": true, + "hint": { + "en": "Show phase 1 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + }, + { + "id": "show_phase_current_L2", + "type": "checkbox", + "label": { + "en": "Show current phase 2" + }, + "value": true, + "hint": { + "en": "Show phase 2 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + }, + { + "id": "show_phase_current_L3", + "type": "checkbox", + "label": { + "en": "Show current phase 3" + }, + "value": true, + "hint": { + "en": "Show phase 3 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + } + ] } ], "id": "pulse" @@ -1673,6 +1714,47 @@ ] } ] + }, + { + "type": "group", + "label": { + "en": "Show/hide phases" + }, + "children": [ + { + "id": "show_phase_current_L1", + "type": "checkbox", + "label": { + "en": "Show current phase 1" + }, + "value": true, + "hint": { + "en": "Show phase 1 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + }, + { + "id": "show_phase_current_L2", + "type": "checkbox", + "label": { + "en": "Show current phase 2" + }, + "value": true, + "hint": { + "en": "Show phase 2 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + }, + { + "id": "show_phase_current_L3", + "type": "checkbox", + "label": { + "en": "Show current phase 3" + }, + "value": true, + "hint": { + "en": "Show phase 3 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + } + ] } ], "id": "watty" diff --git a/drivers/pulse/device.ts b/drivers/pulse/device.ts index 85f6df41..aa850629 100644 --- a/drivers/pulse/device.ts +++ b/drivers/pulse/device.ts @@ -107,6 +107,28 @@ class PulseDevice extends Device { this.#area = newSettings.pulse_area; this.#cachedNordPoolPrice = null; } + // Handle phase current visibility settings + const phases = ['L1', 'L2', 'L3']; + for (const phase of phases) { + const settingKey = `show_phase_current_${phase}`; + if (changedKeys.includes(settingKey)) { + this.log(`Updated show phase current ${phase} value: `, Boolean(newSettings[settingKey])); + const showPhase = Boolean(newSettings[settingKey]); + + if (showPhase) { + this.log(`Adding measure_current.${phase} capability to dashboard`); + await this.setCapabilityOptions(`measure_current.${phase}`, { + uiComponent: 'sensor' + }); + } else { + this.log(`Removing measure_current.${phase} capability from dashboard`); + await this.setCapabilityOptions(`measure_current.${phase}`, { + uiComponent: 'none' + }); + } + + } + } } async #subscribeToLive() { diff --git a/drivers/pulse/driver.compose.json b/drivers/pulse/driver.compose.json index 08d6b685..da127efb 100644 --- a/drivers/pulse/driver.compose.json +++ b/drivers/pulse/driver.compose.json @@ -232,6 +232,47 @@ ] } ] + }, + { + "type": "group", + "label": { + "en": "Show/hide phases" + }, + "children": [ + { + "id": "show_phase_current_L1", + "type": "checkbox", + "label": { + "en": "Show current phase 1" + }, + "value": true, + "hint": { + "en": "Show phase 1 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + }, + { + "id": "show_phase_current_L2", + "type": "checkbox", + "label": { + "en": "Show current phase 2" + }, + "value": true, + "hint": { + "en": "Show phase 2 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + }, + { + "id": "show_phase_current_L3", + "type": "checkbox", + "label": { + "en": "Show current phase 3" + }, + "value": true, + "hint": { + "en": "Show phase 3 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + } + ] } ] } diff --git a/drivers/watty/device.ts b/drivers/watty/device.ts index a1ea5def..2350bb42 100644 --- a/drivers/watty/device.ts +++ b/drivers/watty/device.ts @@ -106,6 +106,28 @@ class WattyDevice extends Device { this.#area = newSettings.pulse_area; this.#cachedNordPoolPrice = null; } + // Handle phase current visibility settings + const phases = ['L1', 'L2', 'L3']; + for (const phase of phases) { + const settingKey = `show_phase_current_${phase}`; + if (changedKeys.includes(settingKey)) { + this.log(`Updated show phase current ${phase} value: `, Boolean(newSettings[settingKey])); + const showPhase = Boolean(newSettings[settingKey]); + + if (showPhase) { + this.log(`Adding measure_current.${phase} capability to dashboard`); + await this.setCapabilityOptions(`measure_current.${phase}`, { + uiComponent: 'sensor' + }); + } else { + this.log(`Removing measure_current.${phase} capability from dashboard`); + await this.setCapabilityOptions(`measure_current.${phase}`, { + uiComponent: 'none' + }); + } + + } + } } async #subscribeToLive() { diff --git a/drivers/watty/driver.compose.json b/drivers/watty/driver.compose.json index a1d74ea8..f52484a9 100644 --- a/drivers/watty/driver.compose.json +++ b/drivers/watty/driver.compose.json @@ -231,7 +231,48 @@ } ] } - ] + ] + }, + { + "type": "group", + "label": { + "en": "Show/hide phases" + }, + "children": [ + { + "id": "show_phase_current_L1", + "type": "checkbox", + "label": { + "en": "Show current phase 1" + }, + "value": true, + "hint": { + "en": "Show phase 1 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + }, + { + "id": "show_phase_current_L2", + "type": "checkbox", + "label": { + "en": "Show current phase 2" + }, + "value": true, + "hint": { + "en": "Show phase 2 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + }, + { + "id": "show_phase_current_L3", + "type": "checkbox", + "label": { + "en": "Show current phase 3" + }, + "value": true, + "hint": { + "en": "Show phase 3 current\nDisable to hide value from dashboard\n\nRemoves relevant flow cards and tokens\nDefault: true" + } + } + ] } ] }