66 lines
1.3 KiB
HTML
66 lines
1.3 KiB
HTML
<link rel="import" href="../bower_components/polymer/polymer-element.html">
|
|
|
|
<script>
|
|
class HassioData extends Polymer.Element {
|
|
static get is() { return 'hassio-data'; }
|
|
|
|
static get properties() {
|
|
return {
|
|
supervisor: {
|
|
type: Object,
|
|
value: {},
|
|
notify: true,
|
|
},
|
|
|
|
host: {
|
|
type: Object,
|
|
value: {},
|
|
notify: true,
|
|
},
|
|
|
|
homeassistant: {
|
|
type: Object,
|
|
value: {},
|
|
notify: true,
|
|
},
|
|
};
|
|
}
|
|
|
|
connectedCallback() {
|
|
super.connectedCallback();
|
|
this.refresh();
|
|
}
|
|
|
|
refresh() {
|
|
return Promise.all([
|
|
this.fetchSupervisorInfo(),
|
|
this.fetchHostInfo(),
|
|
this.fetchHassInfo(),
|
|
]);
|
|
}
|
|
|
|
fetchSupervisorInfo() {
|
|
return this.hass.callApi('get', 'hassio/supervisor/info')
|
|
.then(function (info) {
|
|
this.supervisor = info.data;
|
|
}.bind(this));
|
|
}
|
|
|
|
fetchHostInfo() {
|
|
return this.hass.callApi('get', 'hassio/host/info')
|
|
.then(function (info) {
|
|
this.host = info.data;
|
|
}.bind(this));
|
|
}
|
|
|
|
fetchHassInfo() {
|
|
return this.hass.callApi('get', 'hassio/homeassistant/info')
|
|
.then(function (info) {
|
|
this.homeassistant = info.data;
|
|
}.bind(this));
|
|
}
|
|
}
|
|
|
|
customElements.define(HassioData.is, HassioData);
|
|
</script>
|