@ledvance/base 1.1.74 → 1.1.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,10 +6,11 @@ import {DevInfo, DpValue} from 'tuya-panel-kit'
|
|
|
6
6
|
import {NativeApi} from '../../api/native'
|
|
7
7
|
import {useDispatch} from 'react-redux'
|
|
8
8
|
import {GlobalParams} from '../GlobalParams'
|
|
9
|
-
import {snakeCase} from 'lodash'
|
|
9
|
+
import {isNumber, snakeCase} from 'lodash'
|
|
10
10
|
|
|
11
11
|
export interface NativeProps {
|
|
12
12
|
familyName: string
|
|
13
|
+
role: 0 | 1 | 2 | 3
|
|
13
14
|
deviceInfo: DeviceInfo
|
|
14
15
|
uaGroupInfo: UAGroupInfo
|
|
15
16
|
timeSchedule?: boolean
|
|
@@ -31,6 +32,7 @@ export interface UAGroupInfo {
|
|
|
31
32
|
|
|
32
33
|
const initialState: NativeProps = {
|
|
33
34
|
familyName: '',
|
|
35
|
+
role: 2,
|
|
34
36
|
deviceInfo: {
|
|
35
37
|
devId: '',
|
|
36
38
|
pId: '',
|
|
@@ -64,6 +66,9 @@ const nativePropsSlice = createSlice({
|
|
|
64
66
|
if (!!action.payload.familyName) {
|
|
65
67
|
state.familyName = action.payload.familyName
|
|
66
68
|
}
|
|
69
|
+
if (isNumber(action.payload.role)) {
|
|
70
|
+
state.role = action.payload.role
|
|
71
|
+
}
|
|
67
72
|
if (!!action.payload.deviceInfo.pId) {
|
|
68
73
|
state.deviceInfo.pId = action.payload.deviceInfo.pId
|
|
69
74
|
}
|
|
@@ -145,6 +150,10 @@ const useFamilyName: () => string = () => {
|
|
|
145
150
|
return useSelector(store => store.ldvModules.familyName)
|
|
146
151
|
}
|
|
147
152
|
|
|
153
|
+
const useRole: () => 0 | 1 | 2 | 3 = () => {
|
|
154
|
+
return useSelector(store => store.ldvModules.role)
|
|
155
|
+
}
|
|
156
|
+
|
|
148
157
|
function useDp<T, R extends any>(dp: string): [T, (value: T) => Promise<Result<R>>] {
|
|
149
158
|
const deviceId = useDeviceId()
|
|
150
159
|
const dispatch = useDispatch()
|
|
@@ -281,6 +290,7 @@ export {
|
|
|
281
290
|
useScaledDp,
|
|
282
291
|
useDps,
|
|
283
292
|
useFamilyName,
|
|
293
|
+
useRole,
|
|
284
294
|
useTimeSchedule,
|
|
285
295
|
useEnergieverbrauch,
|
|
286
296
|
}
|