From dede819a12010bd96434b23d8106d1a54b8cb220 Mon Sep 17 00:00:00 2001 From: yosilevy <37745463+yosilevy@users.noreply.github.com> Date: Sat, 23 Feb 2019 19:28:31 +0200 Subject: [PATCH] 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 --- src/layouts/app/connection-mixin.js | 39 ----------------------------- src/translations/en.json | 3 --- 2 files changed, 42 deletions(-) diff --git a/src/layouts/app/connection-mixin.js b/src/layouts/app/connection-mixin.js index d90a711a75..120c0d03b3 100644 --- a/src/layouts/app/connection-mixin.js +++ b/src/layouts/app/connection-mixin.js @@ -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 diff --git a/src/translations/en.json b/src/translations/en.json index 2cd29adff0..2d89fa64ca 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -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…" },