Compare commits

...

2 Commits

Author SHA1 Message Date
Ludeeus
70063031c5 spesific 2021-05-04 20:09:00 +00:00
Ludeeus
41934320c0 Expect the connection to be lost 2021-05-04 19:16:51 +00:00

View File

@@ -69,10 +69,21 @@ class HaCallServiceButton extends EventsMixin(PolymerElement) {
el.$.progress.actionSuccess();
eventData.success = true;
},
function () {
function (err) {
if (
el.domain === "homeassistant" &&
["restart", "stop"].includes(el.service) &&
err?.error?.message &&
err.error.message === "Connection lost"
) {
// We expect the service call to fail with 'Connection lost' when we restart or stop
el.$.progress.actionSuccess();
eventData.success = true;
} else {
el.$.progress.actionError();
eventData.success = false;
}
el.progress = false;
el.$.progress.actionError();
eventData.success = false;
}
)
.then(function () {