diff --git a/src/entrypoints/app.js b/src/entrypoints/app.js index 3aaf3fac62..8f64cd4a46 100644 --- a/src/entrypoints/app.js +++ b/src/entrypoints/app.js @@ -173,6 +173,8 @@ class HomeAssistant extends LocalizeMixin(PolymerElement) { moreInfoEntityId: null, callService: null, callApi: null, + sendWS: null, + callWS: null, }); return; } @@ -243,6 +245,29 @@ class HomeAssistant extends LocalizeMixin(PolymerElement) { return await hassCallApi(host, auth, method, path, parameters); } }, + // For messages that do not get a response + sendWS: (msg) => { + // eslint-disable-next-line + if (__DEV__) console.log('Sending', msg); + conn.sendMessage(msg); + }, + // For messages that expect a response + callWS: (msg) => { + /* eslint-disable no-console */ + if (__DEV__) console.log('Sending', msg); + + const resp = conn.sendMessagePromise(msg); + + if (__DEV__) { + resp.then( + result => console.log('Received', result), + err => console.log('Error', err), + ); + } + // In the future we'll do this as a breaking change + // inside home-assistant-js-websocket + return resp.then(result => result.result); + }, }, this.$.storage.getStoredState()); var reconnected = () => { diff --git a/src/panels/config/dashboard/ha-config-dashboard.js b/src/panels/config/dashboard/ha-config-dashboard.js index 2919d63b5c..e426b89677 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.js +++ b/src/panels/config/dashboard/ha-config-dashboard.js @@ -9,6 +9,7 @@ import '../../../components/ha-menu-button.js'; import '../ha-config-section.js'; import './ha-config-cloud-menu.js'; import './ha-config-entries-menu.js'; +import './ha-config-users-menu.js'; import './ha-config-navigation.js'; import isComponentLoaded from '../../../common/config/is_component_loaded.js'; @@ -39,14 +40,18 @@ class HaConfigDashboard extends LocalizeMixin(PolymerElement) { [[localize('ui.panel.config.header')]] [[localize('ui.panel.config.introduction')]] -