mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
Add three gang widgets for controlling three different switches
- Added ThreeGangBody, ThreeGangSwitch, and ThreeGangSwitchesView widgets for controlling three different switches in the UI. - Updated constants file with functions for ThreeGang device type.
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
//ignore_for_file: constant_identifier_names
|
||||
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
||||
|
||||
abstract class Constants {
|
||||
static const String languageCode = "en";
|
||||
|
||||
@ -16,12 +18,99 @@ abstract class Constants {
|
||||
|
||||
enum DeviceType {
|
||||
AC,
|
||||
Lights,
|
||||
LightBulb,
|
||||
DoorLock,
|
||||
Curtain,
|
||||
Blind,
|
||||
ThreeGang,
|
||||
Gateway,
|
||||
Sensors,
|
||||
Gang,
|
||||
CeilingSensor,
|
||||
WallSensor,
|
||||
Other,
|
||||
}
|
||||
|
||||
Map<String, DeviceType> devicesTypesMap = {
|
||||
"AC": DeviceType.AC,
|
||||
"LB": DeviceType.LightBulb,
|
||||
"DL": DeviceType.DoorLock,
|
||||
"WC": DeviceType.Curtain,
|
||||
"WB": DeviceType.Blind,
|
||||
"3G": DeviceType.ThreeGang,
|
||||
"GW": DeviceType.Gateway,
|
||||
"CPS": DeviceType.CeilingSensor,
|
||||
"WPS": DeviceType.WallSensor,
|
||||
"Other": DeviceType.Other,
|
||||
};
|
||||
Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
|
||||
DeviceType.AC: [
|
||||
FunctionModel(code: 'switch', type: 'Boolean', values: '{}'),
|
||||
FunctionModel(
|
||||
code: 'mode', type: 'Enum', values: '{"range":["cold","hot","wind"]}'),
|
||||
FunctionModel(
|
||||
code: 'temp_set',
|
||||
type: 'Integer',
|
||||
values: '{"unit":"℃","min":200,"max":300,"scale":1,"step":5}'),
|
||||
FunctionModel(
|
||||
code: 'level',
|
||||
type: 'Enum',
|
||||
values: '{"range":["low","middle","high","auto"]}'),
|
||||
FunctionModel(code: 'child_lock', type: 'Boolean', values: '{}'),
|
||||
],
|
||||
DeviceType.Gateway: [
|
||||
FunctionModel(code: 'switch_alarm_sound', type: 'Boolean', values: '{}'),
|
||||
FunctionModel(
|
||||
code: 'master_state',
|
||||
type: 'Enum',
|
||||
values: '{"range":["normal","alarm"]}'),
|
||||
FunctionModel(code: 'factory_reset', type: 'Boolean', values: '{}'),
|
||||
FunctionModel(
|
||||
code: 'alarm_active', type: 'String', values: '{"maxlen":255}'),
|
||||
],
|
||||
DeviceType.CeilingSensor: [
|
||||
FunctionModel(
|
||||
code: 'sensitivity',
|
||||
type: 'Integer',
|
||||
values: '{"unit":"","min":1,"max":10,"scale":0,"step":1}'),
|
||||
],
|
||||
DeviceType.DoorLock: [
|
||||
FunctionModel(code: 'remote_no_pd_setkey', type: 'Raw', values: '{}'),
|
||||
FunctionModel(code: 'remote_no_dp_key', type: 'Raw', values: '{}'),
|
||||
FunctionModel(code: 'normal_open_switch', type: 'Boolean', values: '{}'),
|
||||
],
|
||||
DeviceType.WallSensor: [
|
||||
FunctionModel(
|
||||
code: 'far_detection',
|
||||
type: 'Integer',
|
||||
values: '{"unit":"cm","min":75,"max":600,"scale":0,"step":75}'),
|
||||
FunctionModel(
|
||||
code: 'presence_time',
|
||||
type: 'Integer',
|
||||
values: '{"unit":"Min","min":0,"max":65535,"scale":0,"step":1}'),
|
||||
FunctionModel(
|
||||
code: 'motion_sensitivity_value',
|
||||
type: 'Integer',
|
||||
values: '{"unit":"","min":1,"max":5,"scale":0,"step":1}'),
|
||||
FunctionModel(
|
||||
code: 'motionless_sensitivity',
|
||||
type: 'Integer',
|
||||
values: '{"unit":"","min":1,"max":5,"scale":0,"step":1}'),
|
||||
FunctionModel(code: 'indicator', type: 'Boolean', values: '{}'),
|
||||
],
|
||||
DeviceType.ThreeGang: [
|
||||
FunctionModel(code: 'switch_1', type: 'Boolean', values: '{}'),
|
||||
FunctionModel(code: 'switch_2', type: 'Boolean', values: '{}'),
|
||||
FunctionModel(code: 'switch_3', type: 'Boolean', values: '{}'),
|
||||
FunctionModel(
|
||||
code: 'countdown_1',
|
||||
type: 'Integer',
|
||||
values: '{"unit":"s","min":0,"max":43200,"scale":0,"step":1}'),
|
||||
FunctionModel(
|
||||
code: 'countdown_2',
|
||||
type: 'Integer',
|
||||
values: '{"unit":"s","min":0,"max":43200,"scale":0,"step":1}'),
|
||||
FunctionModel(
|
||||
code: 'countdown_3',
|
||||
type: 'Integer',
|
||||
values: '{"unit":"s","min":0,"max":43200,"scale":0,"step":1}'),
|
||||
],
|
||||
};
|
||||
|
Reference in New Issue
Block a user