mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-31 05:06:38 +00:00
Removed toast (entities turn on/off and OK service calls) (#2822)
* Removed toast when entities turn on/off and services are SUCCESSFULLY called. Still will show on service error. * Removed unused import * Removed translations
This commit is contained in:
parent
c7500a504d
commit
dede819a12
@ -15,7 +15,6 @@ import { getState } from "../../util/ha-pref-storage";
|
||||
import { getActiveTranslation } from "../../util/hass-translation";
|
||||
import { fetchWithAuth } from "../../util/fetch-with-auth";
|
||||
import hassCallApi from "../../util/hass-call-api";
|
||||
import computeStateName from "../../common/entity/compute_state_name";
|
||||
import { subscribePanels } from "../../data/ws-panels";
|
||||
|
||||
export default (superClass) =>
|
||||
@ -65,44 +64,6 @@ export default (superClass) =>
|
||||
}
|
||||
try {
|
||||
await callService(conn, domain, service, serviceData);
|
||||
|
||||
const entityIds = Array.isArray(serviceData.entity_id)
|
||||
? serviceData.entity_id
|
||||
: [serviceData.entity_id];
|
||||
|
||||
const names = [];
|
||||
for (const entityId of entityIds) {
|
||||
const stateObj = this.hass.states[entityId];
|
||||
if (stateObj) {
|
||||
names.push(computeStateName(stateObj));
|
||||
}
|
||||
}
|
||||
if (names.length === 0) {
|
||||
names.push(entityIds[0]);
|
||||
}
|
||||
|
||||
let message;
|
||||
const name = names.join(", ");
|
||||
if (service === "turn_on" && serviceData.entity_id) {
|
||||
message = this.hass.localize(
|
||||
"ui.notification_toast.entity_turned_on",
|
||||
"entity",
|
||||
name
|
||||
);
|
||||
} else if (service === "turn_off" && serviceData.entity_id) {
|
||||
message = this.hass.localize(
|
||||
"ui.notification_toast.entity_turned_off",
|
||||
"entity",
|
||||
name
|
||||
);
|
||||
} else {
|
||||
message = this.hass.localize(
|
||||
"ui.notification_toast.service_called",
|
||||
"service",
|
||||
`${domain}/${service}`
|
||||
);
|
||||
}
|
||||
this.fire("hass-notification", { message });
|
||||
} catch (err) {
|
||||
if (__DEV__) {
|
||||
// eslint-disable-next-line
|
||||
|
@ -528,9 +528,6 @@
|
||||
"title": "Notifications"
|
||||
},
|
||||
"notification_toast": {
|
||||
"entity_turned_on": "Turned on {entity}.",
|
||||
"entity_turned_off": "Turned off {entity}.",
|
||||
"service_called": "Service {service} called.",
|
||||
"service_call_failed": "Failed to call service {service}.",
|
||||
"connection_lost": "Connection lost. Reconnecting…"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user