Added row entity for climate entities. (#1494)

* Added row entity for climate entities.

* Revert to old climate state style.

* Added climate entity to entities-card in gallery.
This commit is contained in:
Jerad Meisner 2018-07-25 01:40:21 -07:00 committed by Paulus Schoutsen
parent 72390aaadc
commit 690252a6ba
3 changed files with 68 additions and 0 deletions

View File

@ -38,6 +38,24 @@ const ENTITIES = [
battery: 71,
friendly_name: 'Paulus'
}),
getEntity('climate', 'ecobee', 'auto', {
current_temperature: 73,
min_temp: 45,
max_temp: 95,
temperature: null,
target_temp_high: 75,
target_temp_low: 70,
fan_mode: 'Auto Low',
fan_list: ['On Low', 'On High', 'Auto Low', 'Auto High', 'Off'],
operation_mode: 'auto',
operation_list: ['heat', 'cool', 'auto', 'off'],
hold_mode: 'home',
swing_mode: 'Auto',
swing_list: ['Auto', '1', '2', '3', 'Off'],
unit_of_measurement: '°F',
friendly_name: 'Ecobee',
supported_features: 1014
})
];
const CONFIGS = [
@ -53,6 +71,7 @@ const CONFIGS = [
- lock.kitchen_door
- light.bed_light
- light.non_existing
- climate.ecobee
`
},
{
@ -66,6 +85,7 @@ const CONFIGS = [
- group.kitchen
- lock.kitchen_door
- light.bed_light
- climate.ecobee
title: Random group
`
},
@ -80,6 +100,7 @@ const CONFIGS = [
- group.kitchen
- lock.kitchen_door
- light.bed_light
- climate.ecobee
title: Random group
show_header_toggle: false
`
@ -108,6 +129,7 @@ const CONFIGS = [
icon: mdi:home-assistant
- lock.kitchen_door
- light.bed_light
- climate.ecobee
title: Random group
show_header_toggle: false
`

View File

@ -1,5 +1,6 @@
import fireEvent from '../../../common/dom/fire_event.js';
import '../entity-rows/hui-climate-entity-row.js';
import '../entity-rows/hui-cover-entity-row.js';
import '../entity-rows/hui-group-entity-row.js';
import '../entity-rows/hui-input-number-entity-row.js';
@ -26,6 +27,7 @@ const SPECIAL_TYPES = new Set([
]);
const DOMAIN_TO_ELEMENT_TYPE = {
automation: 'toggle',
climate: 'climate',
cover: 'cover',
fan: 'toggle',
group: 'group',

View File

@ -0,0 +1,44 @@
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
import '../../../components/ha-climate-state.js';
import '../components/hui-generic-entity-row.js';
class HuiClimateEntityRow extends PolymerElement {
static get template() {
return html`
<hui-generic-entity-row
hass="[[hass]]"
config="[[_config]]"
>
<ha-climate-state
hass="[[hass]]"
state-obj="[[_stateObj]]"
></ha-climate-state>
</hui-generic-entity-row>
`;
}
static get properties() {
return {
hass: Object,
_config: Object,
_stateObj: {
type: Object,
computed: '_computeStateObj(hass.states, _config.entity)'
}
};
}
_computeStateObj(states, entityId) {
return states && entityId in states ? states[entityId] : null;
}
setConfig(config) {
if (!config || !config.entity) {
throw new Error('Entity not configured.');
}
this._config = config;
}
}
customElements.define('hui-climate-entity-row', HuiClimateEntityRow);