mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 16:56:35 +00:00
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:
parent
72390aaadc
commit
690252a6ba
@ -38,6 +38,24 @@ const ENTITIES = [
|
|||||||
battery: 71,
|
battery: 71,
|
||||||
friendly_name: 'Paulus'
|
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 = [
|
const CONFIGS = [
|
||||||
@ -53,6 +71,7 @@ const CONFIGS = [
|
|||||||
- lock.kitchen_door
|
- lock.kitchen_door
|
||||||
- light.bed_light
|
- light.bed_light
|
||||||
- light.non_existing
|
- light.non_existing
|
||||||
|
- climate.ecobee
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -66,6 +85,7 @@ const CONFIGS = [
|
|||||||
- group.kitchen
|
- group.kitchen
|
||||||
- lock.kitchen_door
|
- lock.kitchen_door
|
||||||
- light.bed_light
|
- light.bed_light
|
||||||
|
- climate.ecobee
|
||||||
title: Random group
|
title: Random group
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
@ -80,6 +100,7 @@ const CONFIGS = [
|
|||||||
- group.kitchen
|
- group.kitchen
|
||||||
- lock.kitchen_door
|
- lock.kitchen_door
|
||||||
- light.bed_light
|
- light.bed_light
|
||||||
|
- climate.ecobee
|
||||||
title: Random group
|
title: Random group
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
`
|
`
|
||||||
@ -108,6 +129,7 @@ const CONFIGS = [
|
|||||||
icon: mdi:home-assistant
|
icon: mdi:home-assistant
|
||||||
- lock.kitchen_door
|
- lock.kitchen_door
|
||||||
- light.bed_light
|
- light.bed_light
|
||||||
|
- climate.ecobee
|
||||||
title: Random group
|
title: Random group
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
`
|
`
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import fireEvent from '../../../common/dom/fire_event.js';
|
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-cover-entity-row.js';
|
||||||
import '../entity-rows/hui-group-entity-row.js';
|
import '../entity-rows/hui-group-entity-row.js';
|
||||||
import '../entity-rows/hui-input-number-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 = {
|
const DOMAIN_TO_ELEMENT_TYPE = {
|
||||||
automation: 'toggle',
|
automation: 'toggle',
|
||||||
|
climate: 'climate',
|
||||||
cover: 'cover',
|
cover: 'cover',
|
||||||
fan: 'toggle',
|
fan: 'toggle',
|
||||||
group: 'group',
|
group: 'group',
|
||||||
|
44
src/panels/lovelace/entity-rows/hui-climate-entity-row.js
Normal file
44
src/panels/lovelace/entity-rows/hui-climate-entity-row.js
Normal 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);
|
Loading…
x
Reference in New Issue
Block a user