@@ -3542,18 +3542,26 @@ class CompactPowerCard extends CompactPowerCardBase {
35423542 const numeric = isUnavailable ? 0 : this . _getNumericMaybe ( entity , attribute ) ;
35433543 const unit = st ?. attributes ?. unit_of_measurement || "" ;
35443544 const decimals = this . _getDecimalPlaces ( src ) ;
3545- const numericW = isUnavailable ? 0 : this . _toWatts ( numeric , unit , true ) ;
3546- const hasNumeric = isUnavailable ? true : Number . isFinite ( numericW ) ;
3545+ const numericW = isPowerDevice
3546+ ? isUnavailable
3547+ ? 0
3548+ : this . _toWatts ( numeric , unit , true )
3549+ : null ;
3550+ const hasPowerNumeric = isPowerDevice && ( isUnavailable ? true : Number . isFinite ( numericW ) ) ;
35473551 const unitOverride = this . _getUnitOverride ( src ) ;
3548- let val = hasNumeric
3552+ let val = hasPowerNumeric
35493553 ? this . _formatPowerWithOverride ( numericW , decimals , "W" , unitOverride ?? null )
35503554 : this . _formatEntity ( entity , decimals , attribute , unitOverride ) ;
35513555 const color = src . color || homeColor ;
3552- const threshold = this . _toWatts ( this . _parseThreshold ( src . threshold ) , "W" , true ) ;
3553- const opacity = hasNumeric ? this . _opacityFor ( numericW , threshold ) : 1 ;
3556+ const threshold = isPowerDevice
3557+ ? this . _toWatts ( this . _parseThreshold ( src . threshold ) , "W" , true )
3558+ : null ;
3559+ const opacity = hasPowerNumeric ? this . _opacityFor ( numericW , threshold ) : 1 ;
35543560 const hidden =
3555- ( hasNumeric && this . _isBelowThreshold ( numericW , threshold ) ) ||
3556- ( this . _coerceBoolean ( src . force_hide_under_threshold , false ) && numericW === 0 ) ;
3561+ ( hasPowerNumeric && this . _isBelowThreshold ( numericW , threshold ) ) ||
3562+ ( isPowerDevice &&
3563+ this . _coerceBoolean ( src . force_hide_under_threshold , false ) &&
3564+ numericW === 0 ) ;
35573565 const forceHideUnderThreshold = this . _coerceBoolean ( src . force_hide_under_threshold , false ) ;
35583566 let switchOn = false ;
35593567 if ( isPowerDevice && switchEntity ) {
@@ -3571,7 +3579,7 @@ class CompactPowerCard extends CompactPowerCardBase {
35713579 color,
35723580 opacity,
35733581 hidden,
3574- numeric : hasNumeric ? numericW : 0 ,
3582+ numeric : hasPowerNumeric ? numericW : numeric ?? 0 ,
35753583 isPowerDevice,
35763584 threshold,
35773585 forceHideUnderThreshold,
0 commit comments