mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-17 14:26:35 +00:00
Add device class for low battery (#696)
* Add device class for low battery * Fix per comments * Update per comments * Update per comments Sorting and revert back to “Normal” for state description * Fix Travis error
This commit is contained in:
parent
a061a58494
commit
13f5e33087
@ -37,14 +37,18 @@
|
||||
"off": "[%key:state::default::off%]",
|
||||
"on": "[%key:state::default::on%]"
|
||||
},
|
||||
"moisture": {
|
||||
"off": "Dry",
|
||||
"on": "Wet"
|
||||
"battery": {
|
||||
"off": "Normal",
|
||||
"on": "Low"
|
||||
},
|
||||
"gas": {
|
||||
"off": "Clear",
|
||||
"on": "Detected"
|
||||
},
|
||||
"moisture": {
|
||||
"off": "Dry",
|
||||
"on": "Wet"
|
||||
},
|
||||
"motion": {
|
||||
"off": "[%key:state::binary_sensor::gas::off%]",
|
||||
"on": "[%key:state::binary_sensor::gas::on%]"
|
||||
@ -53,18 +57,6 @@
|
||||
"off": "[%key:state::binary_sensor::gas::off%]",
|
||||
"on": "[%key:state::binary_sensor::gas::on%]"
|
||||
},
|
||||
"smoke": {
|
||||
"off": "[%key:state::binary_sensor::gas::off%]",
|
||||
"on": "[%key:state::binary_sensor::gas::on%]"
|
||||
},
|
||||
"sound": {
|
||||
"off": "[%key:state::binary_sensor::gas::off%]",
|
||||
"on": "[%key:state::binary_sensor::gas::on%]"
|
||||
},
|
||||
"vibration": {
|
||||
"off": "[%key:state::binary_sensor::gas::off%]",
|
||||
"on": "[%key:state::binary_sensor::gas::on%]"
|
||||
},
|
||||
"opening": {
|
||||
"off": "Closed",
|
||||
"on": "Open"
|
||||
@ -76,6 +68,18 @@
|
||||
"safety": {
|
||||
"off": "Safe",
|
||||
"on": "Unsafe"
|
||||
},
|
||||
"smoke": {
|
||||
"off": "[%key:state::binary_sensor::gas::off%]",
|
||||
"on": "[%key:state::binary_sensor::gas::on%]"
|
||||
},
|
||||
"sound": {
|
||||
"off": "[%key:state::binary_sensor::gas::off%]",
|
||||
"on": "[%key:state::binary_sensor::gas::on%]"
|
||||
},
|
||||
"vibration": {
|
||||
"off": "[%key:state::binary_sensor::gas::off%]",
|
||||
"on": "[%key:state::binary_sensor::gas::on%]"
|
||||
}
|
||||
},
|
||||
"calendar": {
|
||||
|
@ -3,9 +3,9 @@ window.hassAttributeUtil = window.hassAttributeUtil || {};
|
||||
|
||||
window.hassAttributeUtil.DOMAIN_DEVICE_CLASS = {
|
||||
binary_sensor: [
|
||||
'connectivity', 'light', 'moisture', 'motion', 'occupancy', 'opening',
|
||||
'sound', 'vibration', 'gas', 'power', 'safety', 'smoke', 'cold', 'heat',
|
||||
'moving', 'plug', 'presence'],
|
||||
'battery', 'cold', 'connectivity', 'gas', 'heat', 'light', 'moisture',
|
||||
'motion', 'moving', 'occupancy', 'opening', 'plug', 'power', 'presence',
|
||||
'safety', 'smoke', 'sound', 'vibration'],
|
||||
cover: ['garage'],
|
||||
};
|
||||
|
||||
|
@ -205,6 +205,8 @@ window.hassUtil.domainIcon = function (domain, state) {
|
||||
window.hassUtil.binarySensorIcon = function (state) {
|
||||
var activated = state.state && state.state === 'off';
|
||||
switch (state.attributes.device_class) {
|
||||
case 'battery':
|
||||
return activated ? 'mdi:battery' : 'mdi:battery-outline';
|
||||
case 'connectivity':
|
||||
return activated ? 'mdi:server-network-off' : 'mdi:server-network';
|
||||
case 'light':
|
||||
|
Loading…
x
Reference in New Issue
Block a user