mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-24 12:49:19 +00:00
22 lines
624 B
TypeScript
22 lines
624 B
TypeScript
import { atLeastVersion } from "../../common/config/version";
|
|
import { HomeAssistant } from "../../types";
|
|
import { HassioResponse } from "../hassio/common";
|
|
|
|
export const restartCore = async (hass: HomeAssistant) => {
|
|
await hass.callService("homeassistant", "restart");
|
|
};
|
|
|
|
export const updateCore = async (hass: HomeAssistant) => {
|
|
if (atLeastVersion(hass.config.version, 2021, 2, 4)) {
|
|
await hass.callWS({
|
|
type: "supervisor/api",
|
|
endpoint: "/core/update",
|
|
method: "post",
|
|
timeout: null,
|
|
});
|
|
return;
|
|
}
|
|
|
|
await hass.callApi<HassioResponse<void>>("POST", `hassio/core/update`);
|
|
};
|