@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
3
3
import { Device , DeviceState } from '../../types' ;
4
4
import style from './style.module.css' ;
5
5
import { powerSourceTypeToTranslationKey } from './powerSourceTypeToTranslationKey' ;
6
+ import type { PowerSource } from '../../types' ;
6
7
7
8
interface PowerSourceProps {
8
9
device ?: Device ;
@@ -12,7 +13,7 @@ interface PowerSourceProps {
12
13
13
14
const PowerSource : FunctionComponent < PowerSourceProps > = ( { device, deviceState, showLevel, ...rest } ) => {
14
15
const { t } = useTranslation ( 'zigbee' ) ;
15
- let source : string | undefined = undefined ;
16
+ let source : PowerSource | undefined = undefined ;
16
17
17
18
if ( device !== undefined ) {
18
19
source = device . power_source ;
@@ -94,8 +95,8 @@ const PowerSource: FunctionComponent<PowerSourceProps> = ({ device, deviceState,
94
95
< i className = { `fa ${ batteryClass } ` } title = { title } { ...rest } />
95
96
</ Fragment >
96
97
) ;
97
-
98
98
case 'Mains (single phase)' :
99
+ case 'Mains (3 phase)' :
99
100
case 'DC Source' :
100
101
return (
101
102
< i
@@ -104,7 +105,20 @@ const PowerSource: FunctionComponent<PowerSourceProps> = ({ device, deviceState,
104
105
{ ...rest }
105
106
/>
106
107
) ;
108
+ case 'Emergency mains and transfer switch' :
109
+ case 'Emergency mains constantly powered' :
110
+ return (
111
+ < i
112
+ className = { `fa fa-plug-circle-exclamation ${ style . plug } ` }
113
+ title = { t ( powerSourceTypeToTranslationKey ( source ) ) }
114
+ { ...rest }
115
+ />
116
+ ) ;
107
117
default :
118
+ if ( device ?. type === 'GreenPower' ) {
119
+ return < i className = { `fa fa-leaf` } title = { `Green` } { ...rest } /> ;
120
+ }
121
+
108
122
return < i className = { `fa fa-question` } title = { source } { ...rest } /> ;
109
123
}
110
124
} ;
0 commit comments