Merge branch 'dev'

This commit is contained in:
Bram Kragten 2023-07-05 17:08:21 +02:00
commit c60a235ad2
No known key found for this signature in database
GPG Key ID: FBE2DFDB363EF55B
4 changed files with 23 additions and 6 deletions

View File

@ -64,7 +64,7 @@ gulp.task("convert-backend-translations", function () {
return gulp return gulp
.src([`${inDirBackend}/*.json`]) .src([`${inDirBackend}/*.json`])
.pipe(transform((data, file) => convertBackendTranslations(data, file))) .pipe(transform((data, file) => convertBackendTranslations(data, file)))
.pipe(gulp.dest(inDirBackend)); .pipe(gulp.dest(`${inDirBackend}/converted`));
}); });
gulp.task("check-translations-html", function () { gulp.task("check-translations-html", function () {

View File

@ -10,5 +10,15 @@ export const callExecuteScript = (
sequence, sequence,
}); });
export const serviceCallWillDisconnect = (domain: string, service: string) => export const serviceCallWillDisconnect = (
domain === "homeassistant" && ["restart", "stop"].includes(service); domain: string,
service: string,
serviceData?: Record<string, any>
) =>
(domain === "homeassistant" && ["restart", "stop"].includes(service)) ||
(domain === "update" &&
service === "install" &&
[
"update.home_assistant_core_update",
"update.home_assistant_operating_system_update",
].includes(serviceData?.entity_id));

View File

@ -152,7 +152,9 @@ export class HaServiceAction extends LitElement implements ActionElement {
.required=${!this.hass.services[domain][service].response! .required=${!this.hass.services[domain][service].response!
.optional} .optional}
.disabled=${this.disabled || .disabled=${this.disabled ||
(!this._action.response_variable && !this._responseChecked)} (this.hass.services[domain][service].response!.optional &&
!this._action.response_variable &&
!this._responseChecked)}
@change=${this._responseVariableChanged} @change=${this._responseVariableChanged}
></ha-textfield> ></ha-textfield>
</ha-settings-row>` </ha-settings-row>`

View File

@ -100,7 +100,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
} catch (err: any) { } catch (err: any) {
if ( if (
err.error?.code === ERR_CONNECTION_LOST && err.error?.code === ERR_CONNECTION_LOST &&
serviceCallWillDisconnect(domain, service) serviceCallWillDisconnect(domain, service, serviceData)
) { ) {
return { context: { id: "" } }; return { context: { id: "" } };
} }
@ -121,7 +121,12 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
"ui.notification_toast.service_call_failed", "ui.notification_toast.service_call_failed",
"service", "service",
`${domain}/${service}` `${domain}/${service}`
) + ` ${err.message}`; ) +
` ${
err.message || err.error?.code === ERR_CONNECTION_LOST
? "connection lost"
: "unknown error"
}`;
fireEvent(this as any, "hass-notification", { message }); fireEvent(this as any, "hass-notification", { message });
throw err; throw err;
} }