mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-09 10:26:35 +00:00
Fix bugs in service picker and service dev tool (#687)
This commit is contained in:
parent
48ecfe07a2
commit
bc94dce8f7
@ -294,7 +294,7 @@
|
|||||||
alert(`Error parsing JSON: ${this.serviceData}`);
|
alert(`Error parsing JSON: ${this.serviceData}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hass.callService(this.domain, this.service, this.parsedJSON);
|
this.hass.callService(this._domain, this._service, this.parsedJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
_entityPicked(ev) {
|
_entityPicked(ev) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<vaadin-combo-box-light
|
<vaadin-combo-box-light
|
||||||
items='[[items]]'
|
items='[[_items]]'
|
||||||
item-value-path='[[itemValuePath]]'
|
item-value-path='[[itemValuePath]]'
|
||||||
item-label-path='[[itemLabelPath]]'
|
item-label-path='[[itemLabelPath]]'
|
||||||
value='{{value}}'
|
value='{{value}}'
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<ha-combo-box
|
<ha-combo-box
|
||||||
label='Service'
|
label='Service'
|
||||||
items='[[_computeServices(hass)]]'
|
items='[[_services]]'
|
||||||
value='{{value}}'
|
value='{{value}}'
|
||||||
allow-custom-value
|
allow-custom-value
|
||||||
></ha-combo-box>
|
></ha-combo-box>
|
||||||
@ -19,7 +19,11 @@ class HaServicePicker extends Polymer.Element {
|
|||||||
|
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: {
|
||||||
|
type: Object,
|
||||||
|
observer: '_hassChanged',
|
||||||
|
},
|
||||||
|
_services: Array,
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
notify: true,
|
notify: true,
|
||||||
@ -27,11 +31,14 @@ class HaServicePicker extends Polymer.Element {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_computeServices(hass) {
|
_hassChanged(hass, oldHass) {
|
||||||
|
if (!hass) {
|
||||||
|
this._services = [];
|
||||||
|
} else if (oldHass && hass.config.services === oldHass.config.services) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
if (!hass) return result;
|
|
||||||
|
|
||||||
Object.keys(hass.config.services).sort().forEach((domain) => {
|
Object.keys(hass.config.services).sort().forEach((domain) => {
|
||||||
const services = Object.keys(hass.config.services[domain]).sort();
|
const services = Object.keys(hass.config.services[domain]).sort();
|
||||||
|
|
||||||
@ -40,7 +47,7 @@ class HaServicePicker extends Polymer.Element {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
this._services = result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user