mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 12:57:55 +00:00
Add status model and fetch device statuses
Added a new StatusModel class to represent device statuses and implemented functionality to fetch and update device statuses in the DevicesCubit and DeviceModel classes. Also updated UI components to display device status information.
This commit is contained in:
@@ -17,6 +17,8 @@ abstract class ApiEndpoints {
|
||||
// Devices
|
||||
static const String control = '$baseUrl/device/control';
|
||||
static const String devicesByRoom = '$baseUrl/device/room';
|
||||
// static const String deviceStatus = '$baseUrl/device/status/';
|
||||
static const String deviceStatus = '$baseUrl/device/';
|
||||
|
||||
//groups
|
||||
static const String groups = '$baseUrl/group';
|
||||
|
||||
@@ -34,4 +34,15 @@ class DevicesAPI {
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> getDeviceStatus(String deviceId) async {
|
||||
final response = await _httpService.get(
|
||||
path: '${ApiEndpoints.deviceStatus}/$deviceId/functions/status',
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user