Compare commits

..

6 Commits

5 changed files with 27 additions and 21 deletions

View File

@ -77,7 +77,7 @@ class DeviceInfoModel {
uuid: json['uuid'],
productUuid: json['productUuid'],
productType: json['productType'],
permissionType: json['permissionType'],
permissionType: json['permissionType'] ?? '',
macAddress: json['macAddress'],
subspace: Subspace.fromJson(json['subspace']),
);

View File

@ -841,7 +841,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.assetsIcons3GangSwitch,
'Light 1 Switch',
'L - Light Switch',
OperationDialogType.onOff,
_createOnOffOptions(),
isAutomation,
@ -853,7 +853,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.twoGang,
'Light 1 Switch',
'L - Light Switch',
OperationDialogType.onOff,
_createOnOffOptions(),
isAutomation,
@ -865,7 +865,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.oneGang,
'Light 1 Switch',
'Light Switch',
OperationDialogType.onOff,
_createOnOffOptions(),
isAutomation,
@ -895,7 +895,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.assetsIcons3GangSwitch,
'Light 2 Switch',
'M - Light Switch',
OperationDialogType.onOff,
_createOnOffOptions(),
isAutomation,
@ -907,7 +907,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.twoGang,
'Light 2 Switch',
'R - Light Switch',
OperationDialogType.onOff,
_createOnOffOptions(),
isAutomation,
@ -935,7 +935,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.assetsIcons3GangSwitch,
'Light 3 Switch',
'R - Light Switch',
OperationDialogType.onOff,
_createOnOffOptions(),
isAutomation,
@ -952,7 +952,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.assetsIcons3GangSwitch,
'Light 1 CountDown',
'L - Light CountDown',
isAutomation
? OperationDialogType.integerSteps
: OperationDialogType.countdown,
@ -968,7 +968,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.twoGang,
'Light 1 CountDown',
'L - Light CountDown',
isAutomation
? OperationDialogType.integerSteps
: OperationDialogType.countdown,
@ -1006,7 +1006,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.assetsIcons3GangSwitch,
'Light 2 CountDown',
'M - Light CountDown',
isAutomation
? OperationDialogType.integerSteps
: OperationDialogType.countdown,
@ -1022,7 +1022,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.twoGang,
'Light 2 CountDown',
'R - Light CountDown',
isAutomation
? OperationDialogType.integerSteps
: OperationDialogType.countdown,
@ -1058,7 +1058,7 @@ mixin SceneOperationsDataHelper {
action,
action.deviceName,
Assets.assetsIcons3GangSwitch,
'Light 3 CountDown',
'R - Light CountDown',
isAutomation
? OperationDialogType.integerSteps
: OperationDialogType.countdown,

View File

@ -82,6 +82,7 @@ class RoutinesView extends StatelessWidget {
routines: state.scenes,
loadingStates: state.loadingStates,
loadingSceneId: state.loadingSceneId,
disablePlayButton: false,
),
RoutinesExpansionTile(
title: 'Automation',
@ -90,6 +91,7 @@ class RoutinesView extends StatelessWidget {
routines: state.automationList,
loadingStates: state.loadingStates,
loadingSceneId: state.loadingSceneId,
disablePlayButton: true,
),
const SizedBox(height: 15),
],

View File

@ -11,6 +11,7 @@ class RoutinesExpansionTile extends StatelessWidget {
required this.emptyRoutinesMessage,
required this.routines,
required this.loadingStates,
required this.disablePlayButton,
this.loadingSceneId,
});
final String title;
@ -18,6 +19,7 @@ class RoutinesExpansionTile extends StatelessWidget {
final List<ScenesModel> routines;
final Map<String, bool> loadingStates;
final String? loadingSceneId;
final bool disablePlayButton;
@override
Widget build(BuildContext context) {
@ -43,7 +45,7 @@ class RoutinesExpansionTile extends StatelessWidget {
child: SceneGrid(
scenes: routines,
loadingSceneId: loadingSceneId,
disablePlayButton: false,
disablePlayButton: disablePlayButton,
loadingStates: loadingStates,
),
),

View File

@ -102,7 +102,8 @@ class DevicesAPI {
static Future<Map<String, dynamic>> getPowerClampStatus(
String deviceId) async {
final response = await _httpService.get(
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{deviceUuid}', deviceId),
path: ApiEndpoints.deviceFunctionsStatus
.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json;
@ -144,7 +145,7 @@ class DevicesAPI {
path: ApiEndpoints.deviceScene.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json;
return json['data'];
});
return response;
}
@ -189,7 +190,7 @@ class DevicesAPI {
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json['data'];
return json['data'] as Map<String, dynamic>;
});
return response;
}
@ -592,11 +593,12 @@ class DevicesAPI {
return <DeviceModel>[];
}
final result = <DeviceModel>[];
for (final device in data) {
final mappedDevice = DeviceModel.fromJson(device);
if (mappedDevice.productType?.name != DeviceType.FlushMountedSensor.name) {
result.add(mappedDevice);
}
for (final device in data) {
final mappedDevice = DeviceModel.fromJson(device);
if (mappedDevice.productType?.name !=
DeviceType.FlushMountedSensor.name) {
result.add(mappedDevice);
}
}
return result;
},