Closed Pho3niX90 closed 3 months ago
Nice improvements. Working through it. Thanks
Note to check logic when autoscale is false as it shows units in kWh
When true it shows W
It should default to the unit of measurement provided by the entity
pv1_power_186: sensor.sunsynk_pv1_power
${data.statePV1Power?.toPowerString(config.solar.auto_scale, data.decimalPlaces)}
toPowerString: (scale?: boolean, decimals?: number, invert?: boolean) =>
scale ?
Utils.convertValueNew(entity?.state, entity?.attributes?.unit_of_measurement, decimals || 1) :
`${Utils.toNum(entity?.state, decimals, invert)} ${UnitOfEnergy.KILO_WATT_HOUR}`,
Change to
toPowerString: (scale?: boolean, decimals?: number, invert?: boolean) =>
scale ?
Utils.convertValueNew(entity?.state, entity?.attributes?.unit_of_measurement, decimals || 1) :
`${Utils.toNum(entity?.state, decimals, invert)} ${entity?.attributes?.unit_of_measurement}`,
Have applied changes and checked both full and compact cards. Please can you also confirm everything working on your end.
Soz just seeing everything now, will quickly test on my end
Okay all seems good my side as well
This commit improves the handling of custom entities, particularly focusing on ensuring the state is not null, undefined, or unknown. It also adds various system features such as conversion from a state to power and auto conversion from a state to kilowatts. In addition, units of electrical current, energy, and power were added to provide spatial and time recognizability context to the measures. This enhancement results in a more detailed and accurate representation of data. It also includes adjustments in energy conversion for better precision and clarity.
possibly fixes: #299