@@ -114,8 +114,6 @@ class MiniGraphCard extends LitElement {
114
114
hours : this . config . hours_to_show ,
115
115
points : this . config . points_per_hour ,
116
116
aggregateFuncName : entity . aggregate_func || this . config . aggregate_func ,
117
- valueFactor : entity . valueFactor || this . config . valueFactor ,
118
- valueMultiplier : entity . valueMultiplier || this . config . valueMultiplier ,
119
117
groupBy : this . config . group_by ,
120
118
smoothing : getFirstDefinedItem (
121
119
entity . smoothing ,
@@ -294,7 +292,7 @@ class MiniGraphCard extends LitElement {
294
292
style =${ entityConfig . state_adaptive_color ? `color: ${ this . computeColor ( state , id ) } ;` : '' } >
295
293
${ entityConfig . show_indicator ? this . renderIndicator ( state , id ) : '' }
296
294
< span class ="state__value ellipsis ">
297
- ${ this . computeState ( isPrimary && tooltipValue || state ) }
295
+ ${ this . computeState ( isPrimary && tooltipValue || state , entityConfig . value_multipler ) }
298
296
</ span >
299
297
< span class ="state__uom ellipsis ">
300
298
${ this . computeUom ( isPrimary && entity || id ) }
@@ -579,7 +577,7 @@ class MiniGraphCard extends LitElement {
579
577
< div class ="info__item ">
580
578
< span class ="info__item__type "> ${ entry . type } </ span >
581
579
< span class ="info__item__value ">
582
- ${ this . computeState ( entry . state ) } ${ this . computeUom ( 0 ) }
580
+ ${ this . computeState ( entry . state , entry . value_multipler ) } ${ this . computeUom ( 0 ) }
583
581
</ span >
584
582
< span class ="info__item__time ">
585
583
${ entry . type !== 'avg' ? getTime ( new Date ( entry . last_changed ) , this . config . format , this . _hass . language ) : '' }
@@ -681,7 +679,7 @@ class MiniGraphCard extends LitElement {
681
679
) ;
682
680
}
683
681
684
- computeState ( inState ) {
682
+ computeState ( inState , default_multiplier ) {
685
683
if ( this . config . state_map . length > 0 ) {
686
684
const stateMap = Number . isInteger ( inState )
687
685
? this . config . state_map [ inState ]
@@ -702,15 +700,16 @@ class MiniGraphCard extends LitElement {
702
700
}
703
701
const dec = this . config . decimals ;
704
702
const value_factor = 10 ** this . config . value_factor ;
705
- const value_multipler = this . config . value_multipler || 1 ;
703
+ const value_multipler = this . config . value_multipler || default_multiplier || 1 ;
706
704
707
705
if ( dec === undefined || Number . isNaN ( dec ) || Number . isNaN ( state ) ) {
708
- return this . numberFormat ( Math . round ( state * value_factor * value_multiplier * 100 ) / 100 ) , this . _hass . language ) ;
706
+ return this . numberFormat ( ( Math . round ( state * value_factor * value_multipler * 100 ) / 100 ) ,
707
+ this . _hass . language ) ;
709
708
}
710
709
711
710
const x = 10 ** dec ;
712
711
return this . numberFormat (
713
- ( Math . round ( state * value_factor * x * value_multiplier ) / x ) . toFixed ( dec ) ,
712
+ ( Math . round ( state * value_factor * x * value_multipler ) / x ) . toFixed ( dec ) ,
714
713
this . _hass . language , dec ,
715
714
) ;
716
715
}
@@ -943,7 +942,7 @@ class MiniGraphCard extends LitElement {
943
942
if ( stateHistory . length === 0 ) return ;
944
943
945
944
if ( this . entity [ 0 ] && entity . entity_id === this . entity [ 0 ] . entity_id ) {
946
- this . updateExtrema ( stateHistory ) ;
945
+ this . updateExtrema ( stateHistory , this . config . entities [ index ] . value_multipler || 1 ) ;
947
946
}
948
947
949
948
if ( this . config . entities [ index ] . fixed_value === true ) {
@@ -965,19 +964,22 @@ class MiniGraphCard extends LitElement {
965
964
return this . _hass . callApi ( 'GET' , url ) ;
966
965
}
967
966
968
- updateExtrema ( history ) {
967
+ updateExtrema ( history , value_multipler ) {
969
968
const { extrema, average } = this . config . show ;
970
969
this . abs = [
971
970
...( extrema ? [ {
972
971
type : 'min' ,
972
+ value_multipler,
973
973
...getMin ( history , 'state' ) ,
974
974
} ] : [ ] ) ,
975
975
...( average ? [ {
976
976
type : 'avg' ,
977
+ value_multipler,
977
978
state : getAvg ( history , 'state' ) ,
978
979
} ] : [ ] ) ,
979
980
...( extrema ? [ {
980
981
type : 'max' ,
982
+ value_multipler,
981
983
...getMax ( history , 'state' ) ,
982
984
} ] : [ ] ) ,
983
985
] ;
0 commit comments