diff --git a/src/cards/compact-card.ts b/src/cards/compact-card.ts index 68c0ff3d..3e4e23fc 100644 --- a/src/cards/compact-card.ts +++ b/src/cards/compact-card.ts @@ -567,6 +567,96 @@ export const compactCard = (config: sunsynkPowerFlowCardConfig, inverterImg: str ${data.batteryStateMsg} + + Utils.handlePopup(e, config.entities.battery_voltage_183)}> + + ${data.batteryVoltage} ${UnitOfElectricPotential.VOLT} + + + Utils.handlePopup(e, config.entities.battery_current_191)}> + + ${config.battery.show_absolute ? Math.abs(data.stateBatteryCurrent.toNum(1)) : data.stateBatteryCurrent.toNum(1)} + ${UnitOfElectricalCurrent.AMPERE} + + + Utils.handlePopup(e, config.entities.battery_power_190)}> + + ${config.battery.auto_scale + ? `${config.battery.show_absolute + ? `${Math.abs(parseFloat(Utils.convertValue(data.batteryPower, data.decimalPlaces)))} ${Utils.convertValue(data.batteryPower, data.decimalPlaces).split(' ')[1]}` + : Utils.convertValue(data.batteryPower, data.decimalPlaces) || '0'}` + : `${config.battery.show_absolute + ? `${Math.abs(data.batteryPower)} ${UnitOfPower.WATT}` + : `${data.batteryPower || 0} ${UnitOfPower.WATT}` + }` + } + + + + ${Utils.toNum((data.batteryEnergy * (data.stateBatterySoc.toNum(2) / 100) / 1000), 2)} + ${UnitOfEnergy.KILO_WATT_HOUR} + + + + Utils.handlePopup(e, config.entities.battery2_voltage_183)}> + + ${data.battery2Voltage} ${UnitOfElectricPotential.VOLT} + + + Utils.handlePopup(e, config.entities.battery2_current_191)}> + + ${config.battery2.show_absolute ? Math.abs(data.stateBattery2Current.toNum(1)) : data.stateBattery2Current.toNum(1)} + ${UnitOfElectricalCurrent.AMPERE} + + + Utils.handlePopup(e, config.entities.battery2_power_190)}> + + ${config.battery2.auto_scale + ? `${config.battery2.show_absolute + ? `${Math.abs(parseFloat(Utils.convertValue(data.battery2Power, data.decimalPlaces)))} ${Utils.convertValue(data.battery2Power, data.decimalPlaces).split(' ')[1]}` + : Utils.convertValue(data.battery2Power, data.decimalPlaces) || '0'}` + : `${config.battery2.show_absolute + ? `${Math.abs(data.battery2Power)} ${UnitOfPower.WATT}` + : `${data.battery2Power || 0} ${UnitOfPower.WATT}` + }` + } + + + + ${Utils.toNum((data.battery2Energy * (data.stateBattery2Soc.toNum(2) / 100) / 1000), 2)} + ${UnitOfEnergy.KILO_WATT_HOUR} + + @@ -694,6 +784,145 @@ export const compactCard = (config: sunsynkPowerFlowCardConfig, inverterImg: str + + + ${data.batteryDuration} + + + ${localize('common.runtime_to')} ${data.batteryCapacity}% @${data.formattedResultTime} + + + ${localize('common.to')} ${data.batteryCapacity}% ${localize('common.charge')} + @${data.formattedResultTime} + + + ${localize('common.battery_floating')} + + + ${data.batteryShutdown}% + + + ${data.shutdownOffGrid}% + + Utils.handlePopup(e, config.entities.battery_soc_184)}> + + ${data.stateBatterySoc.toNum(0)}% + + + Utils.handlePopup(e, config.entities.battery_soc_184)}> + + | ${data.inverterProg.capacity || 0}% + + + Utils.handlePopup(e, config.entities.battery_soc_184)}> + + | ${data.batteryShutdown || 0}% + + + Utils.handlePopup(e, config.entities.battery_soc_184)}> + + | + + + + + + ${data.batteryDuration2} + + + ${localize('common.runtime_to')} ${data.battery2Capacity}% @${data.formattedResultTime2} + + + ${localize('common.to')} ${data.battery2Capacity}% ${localize('common.charge')} + @${data.formattedResultTime2} + + + ${localize('common.battery_floating')} + + + ${data.batteryShutdown2}% + + + ${data.shutdownOffGrid2}% + + Utils.handlePopup(e, config.entities.battery2_soc_184)}> + + ${data.stateBattery2Soc.toNum(0)}% + + + Utils.handlePopup(e, config.entities.battery2_soc_184)}> + + | ${data.inverterProg.capacity || 0}% + + + Utils.handlePopup(e, config.entities.battery2_soc_184)}> + + | ${data.batteryShutdown2 || 0}% + + + Utils.handlePopup(e, config.entities.battery2_soc_184)}> + + | + + + @@ -939,7 +1168,7 @@ export const compactCard = (config: sunsynkPowerFlowCardConfig, inverterImg: str r="3.5" display="${config.entities?.battery2_status === 'none' || !config.entities?.battery2_status || (data.compactMode && data.batteryCount === 2) ? 'none' : ''}" fill="${data.battery2StateColour}"/> - ${config.battery.navigate + ${config.battery2.navigate ? svg` Utils.handleNavigation(e, config.battery2.navigate)}> + fill="${data.batteryShowDaily !== true ? 'transparent' : `${data.batteryColour}`}"> ${localize('common.daily_charge')} Utils.handlePopup(e, config.entities.day_battery_charge_70)}> ${data.stateDayBatteryCharge?.toPowerString(true, data.decimalPlacesEnergy)} @@ -1045,13 +1274,13 @@ export const compactCard = (config: sunsynkPowerFlowCardConfig, inverterImg: str + fill="${data.batteryShowDaily !== true ? 'transparent' : `${data.batteryColour}`}"> ${localize('common.daily_discharge')} Utils.handlePopup(e, config.entities.day_battery_discharge_71)}> ${data.stateDayBatteryDischarge?.toPowerString(true, data.decimalPlacesEnergy)} diff --git a/src/defaults.ts b/src/defaults.ts index 6c18144d..a522d223 100644 --- a/src/defaults.ts +++ b/src/defaults.ts @@ -54,8 +54,6 @@ export default { hide_soc: false, colour: 'pink', show_remaining_energy: true, - animation_speed: 6, - max_power: 4500, show_absolute: false, auto_scale: true, dynamic_colour: true, diff --git a/src/editor.ts b/src/editor.ts index 1a3a23f3..15be47ef 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -186,6 +186,8 @@ export class SunSynkCardEditor extends LitElement implements LovelaceCardEditor schema: [ {name: 'count', selector: {number: {mode: 'box', min: 1, max: 2}}}, {name: 'show_daily', selector: {boolean: {}}}, + {name: 'animation_speed', selector: {number: {}}}, + {name: 'max_power', selector: {number: {}}}, ] }, { @@ -213,8 +215,6 @@ export class SunSynkCardEditor extends LitElement implements LovelaceCardEditor {name: 'animate', selector: {boolean: {}}}, {name: 'hide_soc', selector: {boolean: {}}}, {name: 'show_remaining_energy', selector: {boolean: {}}}, - {name: 'animation_speed', selector: {number: {}}}, - {name: 'max_power', selector: {number: {}}}, {name: 'path_threshold', selector: {number: {}}}, {name: 'navigate', selector: {text: {}}}, {name: 'invert_flow', selector: {boolean: {}}}, @@ -264,8 +264,6 @@ export class SunSynkCardEditor extends LitElement implements LovelaceCardEditor {name: 'animate', selector: {boolean: {}}}, {name: 'hide_soc', selector: {boolean: {}}}, {name: 'show_remaining_energy', selector: {boolean: {}}}, - {name: 'animation_speed', selector: {number: {}}}, - {name: 'max_power', selector: {number: {}}}, {name: 'path_threshold', selector: {number: {}}}, {name: 'navigate', selector: {text: {}}}, ], @@ -282,7 +280,6 @@ export class SunSynkCardEditor extends LitElement implements LovelaceCardEditor {name: 'shutdown_soc', selector: {entity: {}}}, {name: 'shutdown_soc_offgrid', selector: {entity: {}}}, {name: 'soc_end_of_charge', selector: {entity: {}}}, - {name: 'max_power', selector: {entity: {}}}, ], }, ], diff --git a/src/types.ts b/src/types.ts index ecc458b4..2d8c40fb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -102,8 +102,6 @@ export interface sunsynkPowerFlowCardConfig extends LovelaceCardConfig { invert_power: boolean; colour: string; charge_colour: string; - animation_speed: number; - max_power: any; full_capacity: number; empty_capacity: number; show_absolute: boolean;