@ledvance/ui-biz-bundle 1.0.13 → 1.0.15
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 +1 -1
- package/src/modules/scene/SceneAction.d.ts +2 -2
- package/src/modules/scene/SceneAction.ts +21 -12
- package/src/modules/scene/SceneInfo.d.ts +2 -2
- package/src/modules/scene/SceneInfo.ts +2 -2
- package/src/modules/timeSchedule/DeviceState.d.ts +7 -2
- package/src/modules/timeSchedule/DeviceState.tsx +53 -19
- package/src/modules/timeSchedule/LdvScheduleItem.tsx +2 -1
- package/src/modules/timeSchedule/ManualSetting.d.ts +6 -2
- package/src/modules/timeSchedule/ManualSetting.tsx +27 -4
- package/src/modules/timeSchedule/MoodSetting.d.ts +2 -1
- package/src/modules/timeSchedule/MoodSetting.tsx +31 -35
- package/src/modules/timeSchedule/ScheduleScene.tsx +2 -1
- package/src/modules/timeSchedule/SingleLightView.d.ts +4 -2
- package/src/modules/timeSchedule/SingleLightView.tsx +56 -179
- package/src/modules/timeSchedule/TimeScheduleBean.d.ts +14 -0
- package/src/modules/timeSchedule/TimeScheduleBean.ts +14 -0
- package/src/modules/timeSchedule/TimeScheduleEditpage.tsx +249 -28
- package/src/modules/timeSchedule/TimeSchedulePage.d.ts +6 -0
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +11 -10
- package/src/modules/timeSchedule/mix/MixLightActions.d.ts +3 -0
- package/src/modules/timeSchedule/mix/MixLightActions.ts +50 -0
- package/src/modules/timeSchedule/mix/MixLightView.d.ts +2 -1
- package/src/modules/timeSchedule/mix/MixLightView.tsx +16 -20
package/package.json
CHANGED
|
@@ -4,10 +4,10 @@ type GetRemoteSceneListType = (deviceId: string, dpCodes: Record<string, string>
|
|
|
4
4
|
type SetRemoteSceneListType = (deviceId: string, remoteSceneList: RemoteSceneInfo[]) => Promise<Result<any>>;
|
|
5
5
|
export declare const setRemoteSceneList: SetRemoteSceneListType;
|
|
6
6
|
export declare const getRemoteSceneList: GetRemoteSceneListType;
|
|
7
|
-
export declare function dp2Obj(dp: string): SceneInfo;
|
|
7
|
+
export declare function dp2Obj(dp: string, isFan?: boolean): SceneInfo;
|
|
8
8
|
type UseSceneType = (dpCodes: Record<string, string>) => [number, SetSceneType];
|
|
9
9
|
type SetSceneType = (deviceId: string, scene: SceneInfo, dpCodes: Record<string, string>) => Promise<Result<any>>;
|
|
10
10
|
export declare const useScene: UseSceneType;
|
|
11
|
-
export declare function obj2Dp(scene: SceneInfo): string;
|
|
11
|
+
export declare function obj2Dp(scene: SceneInfo, isFan?: boolean): string;
|
|
12
12
|
export declare function saveScene(deviceId: string, scene: SceneUIState, transitionMode: SceneNodeTransitionMode, transitionTime: number, scenes: SceneUIState[]): Promise<Result<any>>;
|
|
13
13
|
export {};
|
|
@@ -15,6 +15,7 @@ import { Dispatch, useState } from 'react';
|
|
|
15
15
|
import { useUpdateEffect } from 'ahooks';
|
|
16
16
|
import { useDispatch } from 'react-redux';
|
|
17
17
|
import res from '@ledvance/base/src/res';
|
|
18
|
+
import { isFanLamp } from '@ledvance/base/src/utils/Support';
|
|
18
19
|
|
|
19
20
|
type GetRemoteSceneListType = (deviceId: string, dpCodes: Record<string, string>) => Promise<Result<SceneUIState[]>>;
|
|
20
21
|
type SetRemoteSceneListType = (
|
|
@@ -49,15 +50,16 @@ export const getRemoteSceneList: GetRemoteSceneListType = async (deviceId: strin
|
|
|
49
50
|
}
|
|
50
51
|
return {
|
|
51
52
|
success: true,
|
|
52
|
-
data: res.data.map((item, index) => remoteSceneInfo2SceneUIState(item, index)),
|
|
53
|
+
data: res.data.map((item, index) => remoteSceneInfo2SceneUIState(item, index, dpCodes)),
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
function remoteSceneInfo2SceneUIState(
|
|
57
58
|
remoteSceneInfo: RemoteSceneInfo,
|
|
58
59
|
index: number,
|
|
60
|
+
dpCodes: Record<string, any>
|
|
59
61
|
): SceneUIState {
|
|
60
|
-
const sceneInfo = dp2Obj(remoteSceneInfo.i);
|
|
62
|
+
const sceneInfo = dp2Obj(remoteSceneInfo.i, isFanLamp(dpCodes));
|
|
61
63
|
return {
|
|
62
64
|
id: sceneInfo.id,
|
|
63
65
|
fanEnable: sceneInfo.fanEnable,
|
|
@@ -68,15 +70,18 @@ function remoteSceneInfo2SceneUIState(
|
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
export function dp2Obj(dp: string): SceneInfo {
|
|
73
|
+
export function dp2Obj(dp: string, isFan:boolean = false): SceneInfo {
|
|
72
74
|
let dpCopy = dp;
|
|
73
|
-
|
|
75
|
+
let fanEnable = false
|
|
76
|
+
let fanSpeed = 0
|
|
74
77
|
const id = hex2Int(dpCopy.slice(0, 2));
|
|
75
78
|
dpCopy = dpCopy.slice(2);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
if(isFan){
|
|
80
|
+
fanEnable = hex2Int(dpCopy.slice(0, 2)) === 1
|
|
81
|
+
dpCopy = dpCopy.slice(2)
|
|
82
|
+
fanSpeed = hex2Int(dpCopy.slice(0, 2))
|
|
83
|
+
dpCopy = dpCopy.slice(2)
|
|
84
|
+
}
|
|
80
85
|
const nodes: SceneNodeInfo[] = spliceByStep(dpCopy, 26).map(nodeHex => {
|
|
81
86
|
let hex = nodeHex;
|
|
82
87
|
const switchingInterval = hex2Int(hex.slice(0, 2));
|
|
@@ -107,7 +112,7 @@ export function dp2Obj(dp: string): SceneInfo {
|
|
|
107
112
|
isColorNode: s !== 0, // 色相/饱和度 不为0就是颜色节点
|
|
108
113
|
};
|
|
109
114
|
});
|
|
110
|
-
return { id,fanEnable, fanSpeed, nodes }
|
|
115
|
+
return isFan ? { id,fanEnable, fanSpeed, nodes } : { id, nodes }
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
function getSceneImage(index: number): string {
|
|
@@ -162,10 +167,14 @@ const setScene = (dispatch: Dispatch<any>) => (deviceId, scene, dpCodes) =>
|
|
|
162
167
|
});
|
|
163
168
|
|
|
164
169
|
|
|
165
|
-
export function obj2Dp(scene: SceneInfo): string {
|
|
170
|
+
export function obj2Dp(scene: SceneInfo, isFan: boolean = false): string {
|
|
171
|
+
let fanEnableHex = ''
|
|
172
|
+
let fanSpeedHex = ''
|
|
166
173
|
const idHex = scene.id.toString(16).padStart(2, '0')
|
|
167
|
-
|
|
168
|
-
|
|
174
|
+
if(isFan){
|
|
175
|
+
fanEnableHex = (scene.fanEnable ? 1 : 0).toString(16).padStart(2, '0')
|
|
176
|
+
fanSpeedHex = (scene.fanSpeed || 1).toString(16).padStart(2, '0')
|
|
177
|
+
}
|
|
169
178
|
return idHex + fanEnableHex + fanSpeedHex + scene.nodes.map(node => {
|
|
170
179
|
const switchingIntervalHex = node.switchingInterval.toString(16).padStart(2, '0')
|
|
171
180
|
const transitionTimeHex = node.transitionTime.toString(16).padStart(2, '0')
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
2
|
-
|
|
2
|
+
import { JudgeTimeScheduleProps } from "./TimeScheduleBean";
|
|
3
|
+
interface DeviceStateProps extends JudgeTimeScheduleProps {
|
|
4
|
+
singleActions: any;
|
|
5
|
+
mixActions: any;
|
|
6
|
+
actionScene: any;
|
|
3
7
|
scheduleItem: any;
|
|
4
8
|
dps: ScheduleItemDp[];
|
|
9
|
+
selectedDps: ScheduleItemDp[];
|
|
5
10
|
dpCodes: Record<string, string>;
|
|
6
11
|
isManual: boolean;
|
|
7
12
|
setIsManual?: (isManual: boolean) => void;
|
|
8
|
-
setSendDps: (
|
|
13
|
+
setSendDps: (actions: any, type: string) => void;
|
|
9
14
|
changeSkillEnable: (dpId: string, enable: boolean) => void;
|
|
10
15
|
}
|
|
11
16
|
declare const DeviceState: (props: DeviceStateProps) => any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Utils as lampUtils } from "@tuya/tuya-panel-lamp-sdk"
|
|
3
|
-
import { View } from "react-native";
|
|
3
|
+
import { View, Text, Image } from "react-native";
|
|
4
4
|
import { Utils } from 'tuya-panel-kit'
|
|
5
5
|
import SegmentControl from "@ledvance/base/src/components/segmentControl";
|
|
6
6
|
import I18n from "@ledvance/base/src/i18n";
|
|
@@ -8,46 +8,80 @@ import ManualSetting from "./ManualSetting";
|
|
|
8
8
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
9
9
|
import MoodSetting from "./MoodSetting";
|
|
10
10
|
import { isPlug } from "@ledvance/base/src/utils/Support";
|
|
11
|
+
import { JudgeTimeScheduleProps } from "./TimeScheduleBean";
|
|
12
|
+
import res from "@ledvance/base/src/res";
|
|
11
13
|
const { convertX: cx } = Utils.RatioUtils
|
|
12
14
|
const { isSupportScene } = lampUtils.SupportUtils
|
|
13
|
-
interface DeviceStateProps{
|
|
15
|
+
interface DeviceStateProps extends JudgeTimeScheduleProps {
|
|
16
|
+
singleActions: any
|
|
17
|
+
mixActions:any
|
|
18
|
+
actionScene:any
|
|
14
19
|
scheduleItem: any
|
|
15
20
|
dps: ScheduleItemDp[]
|
|
16
|
-
|
|
21
|
+
selectedDps: ScheduleItemDp[]
|
|
22
|
+
dpCodes: Record<string, string>
|
|
17
23
|
isManual: boolean
|
|
18
24
|
setIsManual?: (isManual: boolean) => void
|
|
19
|
-
setSendDps: (
|
|
20
|
-
changeSkillEnable: (dpId:string, enable: boolean) => void
|
|
25
|
+
setSendDps: (actions:any, type:string) => void
|
|
26
|
+
changeSkillEnable: (dpId: string, enable: boolean) => void
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
const DeviceState = (props: DeviceStateProps) =>{
|
|
24
|
-
const showSegmentControl = () =>{
|
|
25
|
-
return !!(isSupportScene() && !isPlug(props.dpCodes) && props.
|
|
29
|
+
const DeviceState = (props: DeviceStateProps) => {
|
|
30
|
+
const showSegmentControl = () => {
|
|
31
|
+
return !!(isSupportScene() && !isPlug(props.dpCodes) && props.selectedDps.length)
|
|
26
32
|
}
|
|
27
|
-
|
|
33
|
+
|
|
34
|
+
const showErrorText = () => {
|
|
35
|
+
return !!props.dps.length
|
|
36
|
+
}
|
|
37
|
+
return (
|
|
28
38
|
<View>
|
|
29
39
|
{showSegmentControl() && <SegmentControl
|
|
30
40
|
title1={I18n.getLang('timeschedule_add_schedule_switch_tab_manual_text')}
|
|
31
41
|
title2={I18n.getLang('timeschedule_add_schedule_switch_tab_mood_text')}
|
|
32
42
|
isFirst={props.isManual}
|
|
33
43
|
setIsFirst={(v: boolean) => props.setIsManual && props.setIsManual(v)}
|
|
34
|
-
style={{marginHorizontal: cx(0)}}
|
|
44
|
+
style={{ marginHorizontal: cx(0) }}
|
|
35
45
|
/>}
|
|
36
46
|
{props.isManual ?
|
|
37
|
-
<ManualSetting
|
|
47
|
+
<ManualSetting
|
|
48
|
+
singleActions ={props.singleActions}
|
|
49
|
+
mixActions = {props.mixActions}
|
|
38
50
|
dpCodes={props.dpCodes}
|
|
39
|
-
dps={props.
|
|
51
|
+
dps={props.selectedDps}
|
|
40
52
|
scheduleItem={props.scheduleItem}
|
|
41
53
|
setSendDps={props.setSendDps}
|
|
42
54
|
changeSkillEnable={props.changeSkillEnable}
|
|
55
|
+
isDIMLamp={props.isDIMLamp}
|
|
56
|
+
isGARDOT={props.isGARDOT}
|
|
57
|
+
isGlassRGBWLamp={props.isGlassRGBWLamp}
|
|
58
|
+
isOnlyRGBLamp={props.isOnlyRGBLamp}
|
|
59
|
+
isRGBLamp={props.isRGBLamp}
|
|
60
|
+
isRGBWLamp={props.isRGBWLamp}
|
|
61
|
+
isMixRGBWLamp={props.isMixRGBWLamp}
|
|
62
|
+
isTWLamp={props.isTWLamp}
|
|
63
|
+
isFanLamp={props.isFanLamp}
|
|
64
|
+
isSupportMode={props.isSupportMode}
|
|
65
|
+
isSupportBrightness={props.isSupportBrightness}
|
|
66
|
+
isSupportTemperature={props.isSupportTemperature}
|
|
43
67
|
/> :
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
68
|
+
<View>
|
|
69
|
+
{
|
|
70
|
+
showErrorText() ?
|
|
71
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
72
|
+
<Image style={{ width: cx(16), height: cx(16), tintColor: '#FF9500' }} source={res.ic_warning_amber} />
|
|
73
|
+
<Text style={{ color: '#FF9500', marginLeft: cx(5) }}>{I18n.getLang('timeschedule_add_schedule_no_device_warning_text')}</Text>
|
|
74
|
+
</View> :
|
|
75
|
+
<MoodSetting
|
|
76
|
+
actionScene={props.actionScene}
|
|
77
|
+
dpCodes={props.dpCodes}
|
|
78
|
+
dps={props.dps}
|
|
79
|
+
scheduleItem={props.scheduleItem}
|
|
80
|
+
setSendDps={props.setSendDps}
|
|
81
|
+
changeSkillEnable={props.changeSkillEnable}
|
|
82
|
+
/>
|
|
83
|
+
}
|
|
84
|
+
</View>
|
|
51
85
|
}
|
|
52
86
|
</View>
|
|
53
87
|
)
|
|
@@ -40,7 +40,8 @@ const LdvScheduleItem = (props: LdvScheduleItemProps) => {
|
|
|
40
40
|
onPress(item);
|
|
41
41
|
}}
|
|
42
42
|
onLongPress={() => {
|
|
43
|
-
|
|
43
|
+
onPress(item);
|
|
44
|
+
// onLongPress(item);
|
|
44
45
|
}}>
|
|
45
46
|
<View style={styles.infoContainer}>
|
|
46
47
|
<Text style={styles.time}>{item.time}</Text>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
2
|
-
|
|
2
|
+
import { JudgeTimeScheduleProps } from "./TimeScheduleBean";
|
|
3
|
+
interface ManualSettingProps extends JudgeTimeScheduleProps {
|
|
4
|
+
singleActions: any;
|
|
5
|
+
mixActions: any;
|
|
3
6
|
scheduleItem: any;
|
|
4
7
|
dps: ScheduleItemDp[];
|
|
5
8
|
dpCodes: Record<string, string>;
|
|
6
|
-
|
|
9
|
+
isMixRGBWLamp?: boolean;
|
|
10
|
+
setSendDps: (actions: any, type: string) => void;
|
|
7
11
|
changeSkillEnable: (dpId: string, enable: boolean) => void;
|
|
8
12
|
}
|
|
9
13
|
declare const ManualSetting: (props: ManualSettingProps) => any;
|
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { isMixRGBWLamp } from '@ledvance/base/src/utils/Support'
|
|
4
3
|
import SingleLightView from "./SingleLightView";
|
|
5
4
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
6
5
|
import MixLightView from "./mix/MixLightView";
|
|
6
|
+
import { JudgeTimeScheduleProps } from "./TimeScheduleBean";
|
|
7
|
+
import { useReactive } from "ahooks";
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
interface ManualSettingProps {
|
|
10
|
+
interface ManualSettingProps extends JudgeTimeScheduleProps{
|
|
11
|
+
singleActions: any
|
|
12
|
+
mixActions:any
|
|
10
13
|
scheduleItem: any
|
|
11
14
|
dps: ScheduleItemDp[]
|
|
12
15
|
dpCodes: Record<string, string>
|
|
13
|
-
|
|
16
|
+
isMixRGBWLamp?: boolean
|
|
17
|
+
setSendDps: (actions: any, type:string) => void
|
|
14
18
|
changeSkillEnable: (dpId:string, enable: boolean) => void
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
const ManualSetting = (props: ManualSettingProps) => {
|
|
22
|
+
const state = useReactive({
|
|
23
|
+
singleActions: props.singleActions,
|
|
24
|
+
mixActions: props.mixActions,
|
|
25
|
+
flag: Symbol()
|
|
26
|
+
})
|
|
27
|
+
|
|
18
28
|
|
|
19
29
|
const renderContent = () => {
|
|
20
|
-
if (
|
|
30
|
+
if (props.isMixRGBWLamp) {
|
|
21
31
|
return (
|
|
22
32
|
<MixLightView
|
|
33
|
+
mixActions={state.mixActions}
|
|
23
34
|
dpCodes={props.dpCodes}
|
|
24
35
|
setSendDps={props.setSendDps}
|
|
25
36
|
scheduleItem={props.scheduleItem}
|
|
@@ -30,11 +41,23 @@ const ManualSetting = (props: ManualSettingProps) => {
|
|
|
30
41
|
props.dps.map((item) => (
|
|
31
42
|
<View key={item.dpId}>
|
|
32
43
|
<SingleLightView
|
|
44
|
+
singleActions={state.singleActions}
|
|
33
45
|
dp={item}
|
|
34
46
|
dpCodes={props.dpCodes}
|
|
35
47
|
scheduleItem={props.scheduleItem}
|
|
36
48
|
setSendDps={props.setSendDps}
|
|
37
49
|
setEnable={props.changeSkillEnable}
|
|
50
|
+
isDIMLamp={props.isDIMLamp}
|
|
51
|
+
isGARDOT={props.isGARDOT}
|
|
52
|
+
isGlassRGBWLamp={props.isGlassRGBWLamp}
|
|
53
|
+
isOnlyRGBLamp={props.isOnlyRGBLamp}
|
|
54
|
+
isRGBLamp={props.isRGBLamp}
|
|
55
|
+
isRGBWLamp={props.isRGBWLamp}
|
|
56
|
+
isTWLamp={props.isTWLamp}
|
|
57
|
+
isFanLamp={props.isFanLamp}
|
|
58
|
+
isSupportMode={props.isSupportMode}
|
|
59
|
+
isSupportBrightness={props.isSupportBrightness}
|
|
60
|
+
isSupportTemperature={props.isSupportTemperature}
|
|
38
61
|
/>
|
|
39
62
|
</View>
|
|
40
63
|
))
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
2
2
|
interface MoodSettingProps {
|
|
3
|
+
actionScene: any;
|
|
3
4
|
scheduleItem: any;
|
|
4
5
|
dps: ScheduleItemDp[];
|
|
5
6
|
dpCodes: Record<string, string>;
|
|
6
|
-
setSendDps: (
|
|
7
|
+
setSendDps: (actions: any, type: string) => void;
|
|
7
8
|
changeSkillEnable: (dpId: string, enable: boolean) => void;
|
|
8
9
|
}
|
|
9
10
|
declare const MoodSetting: (props: MoodSettingProps) => any;
|
|
@@ -1,59 +1,55 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
2
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
3
|
-
import { isMixRGBWLamp } from '@ledvance/base/src/utils/Support';
|
|
4
|
-
import { obj2Dp as senceObj2Dp, dp2Obj as sencePp2Obj } from "../scene/SceneAction";
|
|
5
3
|
import ScheduleScene from "./ScheduleScene";
|
|
6
4
|
// import MixMoodScene from "../mood/MixScene";
|
|
7
5
|
import { useReactive } from 'ahooks'
|
|
8
|
-
import { Buffer } from 'buffer';
|
|
9
|
-
import { SCENE } from "../../hooks/DeviceDpStateHooks";
|
|
10
6
|
|
|
11
7
|
interface MoodSettingProps{
|
|
8
|
+
actionScene:any
|
|
12
9
|
scheduleItem: any
|
|
13
10
|
dps: ScheduleItemDp[]
|
|
14
11
|
dpCodes: Record<string, string>
|
|
15
|
-
setSendDps: (
|
|
12
|
+
setSendDps: (actions:any, type:string) => void
|
|
16
13
|
changeSkillEnable: (dpId:string, enable: boolean) => void
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
const MoodSetting = (props: MoodSettingProps) =>{
|
|
20
|
-
const {
|
|
17
|
+
const { dpCodes, setSendDps} = props
|
|
21
18
|
const state = useReactive({
|
|
22
|
-
actionScene:
|
|
19
|
+
actionScene: props.actionScene,
|
|
23
20
|
})
|
|
24
21
|
|
|
25
|
-
useEffect(() =>{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, [])
|
|
22
|
+
// useEffect(() =>{
|
|
23
|
+
// if(scheduleItem){
|
|
24
|
+
// if(scheduleItem.dps[dpCodes.scene_data] !== undefined){
|
|
25
|
+
// state.actionScene = sencePp2Obj(scheduleItem.dps[dpCodes.scene_data])
|
|
26
|
+
// }
|
|
27
|
+
// if (scheduleItem.dps[dpCodes.mix_light_scene] !== undefined) {
|
|
28
|
+
// const sceneDp = scheduleItem.dps[dpCodes.mix_light_scene]
|
|
29
|
+
// state.actionScene = Buffer.from(sceneDp, 'base64').toString('hex')
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
// }, [])
|
|
36
33
|
|
|
37
34
|
useEffect(() =>{
|
|
38
|
-
|
|
39
|
-
setSendDps('scene',dp)
|
|
35
|
+
setSendDps(state.actionScene, 'actionScene')
|
|
40
36
|
}, [state.actionScene])
|
|
41
37
|
|
|
42
|
-
const getSendDps = () =>{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
38
|
+
// const getSendDps = () =>{
|
|
39
|
+
// if (isMixRGBWLamp(dpCodes)) {
|
|
40
|
+
// return {
|
|
41
|
+
// [dpCodes.mix_light_scene]: Buffer.from(state.actionScene?.value, 'hex').toString('base64'),
|
|
42
|
+
// [dpCodes.switch_led]: true,
|
|
43
|
+
// [dpCodes.work_mode]: SCENE
|
|
44
|
+
// }
|
|
45
|
+
// } else {
|
|
46
|
+
// return {
|
|
47
|
+
// [dpCodes.switch_led]: true,
|
|
48
|
+
// [dpCodes.scene_data]: senceObj2Dp({ id: Number(state?.actionScene?.id), nodes: state?.actionScene?.nodes, fanEnable: state.actionScene.fanEnable, fanSpeed: state.actionScene.fanSpeed }),
|
|
49
|
+
// [dpCodes.work_mode]: SCENE,
|
|
50
|
+
// };
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
57
53
|
|
|
58
54
|
return (
|
|
59
55
|
// isMixRGBWLamp(dpCodes) ?
|
|
@@ -12,6 +12,7 @@ import { Utils } from 'tuya-panel-kit'
|
|
|
12
12
|
import InfoText from '@ledvance/base/src/components/InfoText'
|
|
13
13
|
import MoodItem from '../mood/MoodItem'
|
|
14
14
|
import { SCENE, useWorkMode } from '../../hooks/DeviceDpStateHooks'
|
|
15
|
+
import { isEmpty } from 'lodash'
|
|
15
16
|
|
|
16
17
|
const cx = Utils.RatioUtils.convertX
|
|
17
18
|
|
|
@@ -40,7 +41,7 @@ const ScheduleScene = ({ scene, setScene, dpCodes }) => {
|
|
|
40
41
|
const res = await getRemoteSceneList(deviceInfo.devId, dpCodes)
|
|
41
42
|
if (res.success) {
|
|
42
43
|
state.scenes = res.data || []
|
|
43
|
-
state.currentScene = scene
|
|
44
|
+
state.currentScene = isEmpty(scene) ? state.scenes[0] : scene
|
|
44
45
|
setScene(state.currentScene)
|
|
45
46
|
}
|
|
46
47
|
}, [])
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ScheduleItemDp } from './TimeScheduleEditpage';
|
|
2
|
-
|
|
2
|
+
import { JudgeTimeScheduleProps } from './TimeScheduleBean';
|
|
3
|
+
interface SingleLightViewProps extends JudgeTimeScheduleProps {
|
|
4
|
+
singleActions: any;
|
|
3
5
|
scheduleItem: any;
|
|
4
6
|
dpCodes: Record<string, string>;
|
|
5
7
|
dp: ScheduleItemDp;
|
|
6
|
-
setSendDps: (
|
|
8
|
+
setSendDps: (actions: any, type: string) => void;
|
|
7
9
|
setEnable: (dpId: string, enable: boolean) => void;
|
|
8
10
|
}
|
|
9
11
|
export default function SingleLightView(props: SingleLightViewProps): any;
|