mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-04 16:42:58 +01:00
[Back] Add hass status
This commit is contained in:
parent
b87feaa8d9
commit
8db47b5687
@ -24,6 +24,7 @@ import type {
|
||||
SupervisorResponse,
|
||||
} from "../types/services/ha_os_response.js";
|
||||
import { States, type Status } from "../types/status.js";
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
const pipeline = promisify(stream.pipeline);
|
||||
|
||||
@ -113,9 +114,17 @@ function getBackups(): Promise<Response<SupervisorResponse<BackupData>>> {
|
||||
option
|
||||
).then(
|
||||
(result) => {
|
||||
const status = statusTools.getStatus();
|
||||
status.hass.ok = true;
|
||||
status.hass.last_check = DateTime.now();
|
||||
statusTools.setStatus(status);
|
||||
return result;
|
||||
},
|
||||
(error) => {
|
||||
const status = statusTools.getStatus();
|
||||
status.hass.ok = false;
|
||||
status.hass.last_check = DateTime.now();
|
||||
statusTools.setStatus(status);
|
||||
messageManager.error("Fail to fetch Hassio backups", error?.message);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
@ -12,6 +12,10 @@ let status: Status = {
|
||||
folder_created: false,
|
||||
last_check: DateTime.now(),
|
||||
},
|
||||
hass: {
|
||||
ok: false,
|
||||
last_check: DateTime.now(),
|
||||
},
|
||||
};
|
||||
|
||||
export function init() {
|
||||
|
@ -25,4 +25,8 @@ export interface Status {
|
||||
folder_created: boolean;
|
||||
last_check: DateTime;
|
||||
};
|
||||
hass: {
|
||||
ok: boolean;
|
||||
last_check: DateTime;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user