Forward browser_id in service calls from frontend
This commit is contained in:
parent
23cbdaef2d
commit
8dbd00aa0f
@ -1015,10 +1015,14 @@ const ServicesMixin = (SuperClass) => {
|
|||||||
}
|
}
|
||||||
async _service_action({ service, data }) {
|
async _service_action({ service, data }) {
|
||||||
let _service = service;
|
let _service = service;
|
||||||
if (!_service.startsWith("browser_mod.") && _service.includes(".")) {
|
if ((!_service.startsWith("browser_mod.") && _service.includes(".")) ||
|
||||||
|
data.browser_id !== undefined) {
|
||||||
|
const d = Object.assign({}, data);
|
||||||
|
if (d.browser_id === "THIS")
|
||||||
|
d.browser_id = this.browserID;
|
||||||
// CALL HOME ASSISTANT SERVICE
|
// CALL HOME ASSISTANT SERVICE
|
||||||
const [domain, srv] = _service.split(".");
|
const [domain, srv] = _service.split(".");
|
||||||
return this.hass.callService(domain, srv, data);
|
return this.hass.callService(domain, srv, d);
|
||||||
}
|
}
|
||||||
if (_service.startsWith("browser_mod.")) {
|
if (_service.startsWith("browser_mod.")) {
|
||||||
_service = _service.substring(12);
|
_service = _service.substring(12);
|
||||||
@ -2101,8 +2105,8 @@ const BrowserIDMixin = (SuperClass) => {
|
|||||||
x Information about interaction requirement
|
x Information about interaction requirement
|
||||||
x Information about fullykiosk
|
x Information about fullykiosk
|
||||||
- Commands
|
- Commands
|
||||||
- Change targets from the frontend
|
x Change targets from the frontend
|
||||||
- Send browser ID to the backend in service calls?
|
x Send browser ID to the backend in service calls?
|
||||||
x Rename browser_mod commands to browser_mod services
|
x Rename browser_mod commands to browser_mod services
|
||||||
x Framework
|
x Framework
|
||||||
x ll-custom handling
|
x ll-custom handling
|
||||||
|
@ -32,8 +32,8 @@ import { BrowserIDMixin } from "./browserID";
|
|||||||
x Information about interaction requirement
|
x Information about interaction requirement
|
||||||
x Information about fullykiosk
|
x Information about fullykiosk
|
||||||
- Commands
|
- Commands
|
||||||
- Change targets from the frontend
|
x Change targets from the frontend
|
||||||
- Send browser ID to the backend in service calls?
|
x Send browser ID to the backend in service calls?
|
||||||
x Rename browser_mod commands to browser_mod services
|
x Rename browser_mod commands to browser_mod services
|
||||||
x Framework
|
x Framework
|
||||||
x ll-custom handling
|
x ll-custom handling
|
||||||
|
@ -95,10 +95,15 @@ export const ServicesMixin = (SuperClass) => {
|
|||||||
|
|
||||||
async _service_action({ service, data }) {
|
async _service_action({ service, data }) {
|
||||||
let _service: String = service;
|
let _service: String = service;
|
||||||
if (!_service.startsWith("browser_mod.") && _service.includes(".")) {
|
if (
|
||||||
|
(!_service.startsWith("browser_mod.") && _service.includes(".")) ||
|
||||||
|
data.browser_id !== undefined
|
||||||
|
) {
|
||||||
|
const d = { ...data };
|
||||||
|
if (d.browser_id === "THIS") d.browser_id = this.browserID;
|
||||||
// CALL HOME ASSISTANT SERVICE
|
// CALL HOME ASSISTANT SERVICE
|
||||||
const [domain, srv] = _service.split(".");
|
const [domain, srv] = _service.split(".");
|
||||||
return this.hass.callService(domain, srv, data);
|
return this.hass.callService(domain, srv, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_service.startsWith("browser_mod.")) {
|
if (_service.startsWith("browser_mod.")) {
|
||||||
|
@ -52,3 +52,8 @@ script:
|
|||||||
cm_debug:
|
cm_debug:
|
||||||
sequence:
|
sequence:
|
||||||
- service: browser_mod.debug
|
- service: browser_mod.debug
|
||||||
|
print_id:
|
||||||
|
sequence:
|
||||||
|
- service: system_log.write
|
||||||
|
data:
|
||||||
|
message: "Button was clicked in {{browser_id}}."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user