File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1019,6 +1019,14 @@ export default class HomeAssistant extends Extension {
1019
1019
if ( firstExpose . unit && [ 'Wh' , 'kWh' ] . includes ( firstExpose . unit ) ) {
1020
1020
Object . assign ( extraAttrs , { device_class : 'energy' , state_class : 'total_increasing' } ) ;
1021
1021
}
1022
+ // If a variable includes A or mA, mark it as current
1023
+ else if ( firstExpose . unit && [ 'A' , 'mA' ] . includes ( firstExpose . unit ) ) {
1024
+ Object . assign ( extraAttrs , { device_class : 'current' , state_class : 'measurement' } ) ;
1025
+ }
1026
+ // If a variable includes mW, W, kW mark it as power
1027
+ else if ( firstExpose . unit && [ 'mW' , 'W' , 'kW' ] . includes ( firstExpose . unit ) ) {
1028
+ Object . assign ( extraAttrs , { device_class : 'power' , state_class : 'measurement' } ) ;
1029
+ }
1022
1030
1023
1031
let key = firstExpose . name ;
1024
1032
You can’t perform that action at this time.
0 commit comments