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