mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
push automation function add conditions
This commit is contained in:
@ -231,6 +231,105 @@ mixin SceneOperationsDataHelper {
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'unlock_fingerprint':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsFingerprintUnlock,
|
||||
'Fingerprint Unlock',
|
||||
OperationDialogType.integerSteps,
|
||||
_createFingerprintUnlockOptions(),
|
||||
isAutomation);
|
||||
case 'unlock_password':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsPasswordUnlock,
|
||||
'Password Unlock',
|
||||
OperationDialogType.integerSteps,
|
||||
_createPasswordUnlockOptions(),
|
||||
isAutomation);
|
||||
case 'unlock_card':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsCardUnlock,
|
||||
'Card Unlock',
|
||||
OperationDialogType.integerSteps,
|
||||
_createCardUnlockOptions(),
|
||||
isAutomation);
|
||||
case 'alarm_lock':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsLockAlarm,
|
||||
'Lock Alarm',
|
||||
OperationDialogType.listOfOptions,
|
||||
_createLockAlarmOptions(),
|
||||
isAutomation);
|
||||
case 'unlock_request':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsRemoteUnlockReq,
|
||||
'Remote Unlock Request',
|
||||
OperationDialogType.integerSteps,
|
||||
_createUnlockRequestOptions(),
|
||||
isAutomation);
|
||||
case 'residual_electricity':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsResidualElectricity,
|
||||
'Residual Electricity',
|
||||
OperationDialogType.integerSteps,
|
||||
_createResidualElectricityOptions(),
|
||||
isAutomation);
|
||||
case 'reverse_lock':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsDoubleLock,
|
||||
'Double Lock',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'unlock_app':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsRemoteUnlockViaApp,
|
||||
'Remote Unlock Via App',
|
||||
OperationDialogType.integerSteps,
|
||||
_createUnlockAppOptions(),
|
||||
isAutomation);
|
||||
case 'hijack':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsHijackAlarm,
|
||||
'Hijack Alarm',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'doorbell':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsDoorlockNormalOpen,
|
||||
'Doorbell',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'unlock_temporary':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
Assets.assetsTempPasswordUnlock,
|
||||
'Temporary Password Unlock',
|
||||
OperationDialogType.integerSteps,
|
||||
_createTemporaryPasswordUnlockOptions(),
|
||||
isAutomation);
|
||||
case 'far_detection':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
@ -276,86 +375,41 @@ mixin SceneOperationsDataHelper {
|
||||
OperationDialogType.countdown,
|
||||
_createCountdownOptions(),
|
||||
isAutomation);
|
||||
case 'switch_alarm_sound':
|
||||
case 'presence_state':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Multi-Mode Gateway Z-W-B',
|
||||
Assets.assetsSwitchAlarmSound,
|
||||
'Switch Alarm Sound',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'master_state':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Multi-Mode Gateway Z-W-B',
|
||||
Assets.assetsMasterState,
|
||||
'Master State',
|
||||
'Human Presence Sensor',
|
||||
Assets.assetsPresenceState,
|
||||
'Presence State',
|
||||
OperationDialogType.listOfOptions,
|
||||
_createMasterStateOptions(),
|
||||
_createPresenceStateOptions(),
|
||||
isAutomation);
|
||||
case 'factory_reset':
|
||||
case 'dis_current':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Multi-Mode Gateway Z-W-B',
|
||||
Assets.assetsFactoryReset,
|
||||
'Reset Factory',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
'Human Presence Sensor',
|
||||
Assets.assetsIconsPresenceSensorAssetsDistance,
|
||||
'Current Distance',
|
||||
OperationDialogType.integerSteps,
|
||||
_createCurrentDistanceOptions(),
|
||||
isAutomation);
|
||||
case 'switch_1':
|
||||
case 'illuminance_value':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsAcPower,
|
||||
'Light 1 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
'Human Presence Sensor',
|
||||
Assets.assetsIconsPresenceSensorAssetsIlluminanceValue,
|
||||
'Illuminance Value',
|
||||
OperationDialogType.integerSteps,
|
||||
_createIlluminanceValueOptions(),
|
||||
isAutomation);
|
||||
case 'switch_2':
|
||||
case 'checking_result':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsAcPower,
|
||||
'Light 2 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'switch_3':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsAcPower,
|
||||
'Light 3 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'countdown_1':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsLightCountdown,
|
||||
'Light 1 CountDown',
|
||||
OperationDialogType.countdown,
|
||||
_createCountdownOptions(),
|
||||
isAutomation);
|
||||
case 'countdown_2':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsLightCountdown,
|
||||
'Light 2 CountDown',
|
||||
OperationDialogType.countdown,
|
||||
_createCountdownOptions(),
|
||||
isAutomation);
|
||||
case 'countdown_3':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsLightCountdown,
|
||||
'Light 3 CountDown',
|
||||
OperationDialogType.countdown,
|
||||
_createCountdownOptions(),
|
||||
'Human Presence Sensor',
|
||||
Assets.assetsSelfTestResult,
|
||||
'Self-Test Result',
|
||||
OperationDialogType.listOfOptions,
|
||||
_createSelfTestResultOptions(),
|
||||
isAutomation);
|
||||
case 'switch':
|
||||
return _createSceneFunction(
|
||||
@ -406,12 +460,258 @@ mixin SceneOperationsDataHelper {
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'switch_1':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsIconsLightSwitchOn,
|
||||
'Light 1 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'switch_2':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsIconsLightSwitchOn,
|
||||
'Light 2 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'switch_3':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsIconsLightSwitchOn,
|
||||
'Light 3 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
|
||||
case 'countdown_1':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsLightCountdown,
|
||||
'Light 1 CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation);
|
||||
case 'countdown_2':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsLightCountdown,
|
||||
'Light 2 CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation);
|
||||
case 'countdown_3':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsLightCountdown,
|
||||
'Light 3 CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation);
|
||||
case 'switch_alarm_sound':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Gateway',
|
||||
Assets.assetsSwitchAlarmSound,
|
||||
'Switch Alarm Sound',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
case 'master_state':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Gateway',
|
||||
Assets.assetsMasterState,
|
||||
'Master State',
|
||||
OperationDialogType.listOfOptions,
|
||||
_createMasterStateOptions(),
|
||||
isAutomation);
|
||||
case 'factory_reset':
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Gateway',
|
||||
Assets.assetsFactoryReset,
|
||||
'Factory Reset',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation);
|
||||
default:
|
||||
throw ArgumentError(
|
||||
'Unsupported function code: ${executorProperty.functionCode}');
|
||||
}
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createFingerprintUnlockOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "",
|
||||
value: 0.0,
|
||||
minValue: 0.0,
|
||||
maxValue: 999,
|
||||
stepValue: 1.0,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createPasswordUnlockOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "",
|
||||
value: 0.0,
|
||||
minValue: 0.0,
|
||||
maxValue: 999,
|
||||
stepValue: 1.0,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createCardUnlockOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "",
|
||||
value: 0.0,
|
||||
minValue: 0.0,
|
||||
maxValue: 999,
|
||||
stepValue: 1.0,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createLockAlarmOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsFingerprintUnlock,
|
||||
description: "Fingerprint Mismatch",
|
||||
value: 0,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createUnlockRequestOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 90,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createResidualElectricityOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 100,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createUnlockAppOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 999,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createTemporaryPasswordUnlockOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 999,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createPresenceStateOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsIconsPresenceSensorAssetsEmpty,
|
||||
value: 'none',
|
||||
description: 'None',
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsPresence,
|
||||
value: 'presence',
|
||||
description: 'Presence',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createCurrentDistanceOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
value: 0.0,
|
||||
description: "CM",
|
||||
minValue: 1,
|
||||
maxValue: 600,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createIlluminanceValueOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
value: 0.0,
|
||||
description: "Lux",
|
||||
minValue: 0,
|
||||
maxValue: 10000,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createSelfTestResultOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSelfTestResult,
|
||||
value: 'check_success',
|
||||
description: 'Self Testing Success',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<SceneOperationalValue> _createAutomationTemperatureOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
@ -436,6 +736,19 @@ mixin SceneOperationsDataHelper {
|
||||
];
|
||||
}
|
||||
|
||||
_createAutomationCountDownOptions() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
stepValue: 1,
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSceneFunction(
|
||||
Action action,
|
||||
String deviceName,
|
||||
@ -547,8 +860,11 @@ mixin SceneOperationsDataHelper {
|
||||
return [SceneOperationalValue(icon: '', value: 0)];
|
||||
}
|
||||
|
||||
List<SceneStaticFunction> getOperationsForOneFunction(
|
||||
{required String deviceId, required SceneStaticFunction taskItem}) {
|
||||
List<SceneStaticFunction> getOperationsForOneFunction({
|
||||
required String deviceId,
|
||||
required SceneStaticFunction taskItem,
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
if (deviceId.contains('delay')) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
@ -575,7 +891,7 @@ mixin SceneOperationsDataHelper {
|
||||
functionCode: taskItem.code,
|
||||
functionValue: taskItem.functionValue),
|
||||
actionExecutor: ''),
|
||||
false)
|
||||
isAutomation)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user