mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Additional device classes for binary sensors (#749)
* Add additional device classes for binary sensor * Minor updates * Travis fixes * Update per comments * Update per comments
This commit is contained in:
parent
cf4d867fa1
commit
4379df0d5c
@ -83,14 +83,30 @@
|
|||||||
"off": "Normal",
|
"off": "Normal",
|
||||||
"on": "Low"
|
"on": "Low"
|
||||||
},
|
},
|
||||||
|
"cold": {
|
||||||
|
"off": "[%key:state::binary_sensor::battery::off%]",
|
||||||
|
"on": "Cold"
|
||||||
|
},
|
||||||
"connectivity": {
|
"connectivity": {
|
||||||
"off": "Disconnected",
|
"off": "Disconnected",
|
||||||
"on": "Connected"
|
"on": "Connected"
|
||||||
},
|
},
|
||||||
|
"door": {
|
||||||
|
"off": "[%key:state::binary_sensor::opening::off%]",
|
||||||
|
"on": "[%key:state::binary_sensor::opening::on%]"
|
||||||
|
},
|
||||||
|
"garage_door": {
|
||||||
|
"off": "[%key:state::binary_sensor::opening::off%]",
|
||||||
|
"on": "[%key:state::binary_sensor::opening::on%]"
|
||||||
|
},
|
||||||
"gas": {
|
"gas": {
|
||||||
"off": "Clear",
|
"off": "Clear",
|
||||||
"on": "Detected"
|
"on": "Detected"
|
||||||
},
|
},
|
||||||
|
"heat": {
|
||||||
|
"off": "[%key:state::binary_sensor::battery::off%]",
|
||||||
|
"on": "Hot"
|
||||||
|
},
|
||||||
"moisture": {
|
"moisture": {
|
||||||
"off": "Dry",
|
"off": "Dry",
|
||||||
"on": "Wet"
|
"on": "Wet"
|
||||||
@ -130,6 +146,10 @@
|
|||||||
"vibration": {
|
"vibration": {
|
||||||
"off": "[%key:state::binary_sensor::gas::off%]",
|
"off": "[%key:state::binary_sensor::gas::off%]",
|
||||||
"on": "[%key:state::binary_sensor::gas::on%]"
|
"on": "[%key:state::binary_sensor::gas::on%]"
|
||||||
|
},
|
||||||
|
"window": {
|
||||||
|
"off": "[%key:state::binary_sensor::opening::off%]",
|
||||||
|
"on": "[%key:state::binary_sensor::opening::on%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"calendar": {
|
"calendar": {
|
||||||
|
@ -3,9 +3,29 @@ window.hassAttributeUtil = window.hassAttributeUtil || {};
|
|||||||
|
|
||||||
window.hassAttributeUtil.DOMAIN_DEVICE_CLASS = {
|
window.hassAttributeUtil.DOMAIN_DEVICE_CLASS = {
|
||||||
binary_sensor: [
|
binary_sensor: [
|
||||||
'battery', 'cold', 'connectivity', 'gas', 'heat', 'light', 'moisture',
|
'battery',
|
||||||
'motion', 'moving', 'occupancy', 'opening', 'plug', 'power', 'presence',
|
'cold',
|
||||||
'safety', 'smoke', 'sound', 'vibration'],
|
'connectivity',
|
||||||
|
'door',
|
||||||
|
'garage_door',
|
||||||
|
'gas',
|
||||||
|
'heat',
|
||||||
|
'light',
|
||||||
|
'moisture',
|
||||||
|
'motion',
|
||||||
|
'moving',
|
||||||
|
'occupancy',
|
||||||
|
'opening',
|
||||||
|
'plug',
|
||||||
|
'power',
|
||||||
|
'presence',
|
||||||
|
'problem',
|
||||||
|
'safety',
|
||||||
|
'smoke',
|
||||||
|
'sound',
|
||||||
|
'vibration',
|
||||||
|
'window'
|
||||||
|
],
|
||||||
cover: ['garage'],
|
cover: ['garage'],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -207,8 +207,22 @@ window.hassUtil.binarySensorIcon = function (state) {
|
|||||||
switch (state.attributes.device_class) {
|
switch (state.attributes.device_class) {
|
||||||
case 'battery':
|
case 'battery':
|
||||||
return activated ? 'mdi:battery' : 'mdi:battery-outline';
|
return activated ? 'mdi:battery' : 'mdi:battery-outline';
|
||||||
|
case 'cold':
|
||||||
|
return activated ? 'mdi:thermometer' : 'mdi:snowflake';
|
||||||
case 'connectivity':
|
case 'connectivity':
|
||||||
return activated ? 'mdi:server-network-off' : 'mdi:server-network';
|
return activated ? 'mdi:server-network-off' : 'mdi:server-network';
|
||||||
|
case 'door':
|
||||||
|
return activated ? 'mdi:door-closed' : 'mdi:door-open';
|
||||||
|
case 'garage_door':
|
||||||
|
return activated ? 'mdi:garage' : 'mdi:garage-open';
|
||||||
|
case 'gas':
|
||||||
|
case 'power':
|
||||||
|
case 'problem':
|
||||||
|
case 'safety':
|
||||||
|
case 'smoke':
|
||||||
|
return activated ? 'mdi:verified' : 'mdi:alert';
|
||||||
|
case 'heat':
|
||||||
|
return activated ? 'mdi:thermometer' : 'mdi:fire';
|
||||||
case 'light':
|
case 'light':
|
||||||
return activated ? 'mdi:brightness-5' : 'mdi:brightness-7';
|
return activated ? 'mdi:brightness-5' : 'mdi:brightness-7';
|
||||||
case 'moisture':
|
case 'moisture':
|
||||||
@ -218,21 +232,17 @@ window.hassUtil.binarySensorIcon = function (state) {
|
|||||||
case 'occupancy':
|
case 'occupancy':
|
||||||
return activated ? 'mdi:home' : 'mdi:home-outline';
|
return activated ? 'mdi:home' : 'mdi:home-outline';
|
||||||
case 'opening':
|
case 'opening':
|
||||||
return activated ? 'mdi:door-closed' : 'mdi:door-open';
|
return activated ? 'mdi:square' : 'mdi:square-outline';
|
||||||
case 'sound':
|
|
||||||
return activated ? 'mdi:music-note-off' : 'mdi:music-note';
|
|
||||||
case 'vibration':
|
|
||||||
return activated ? 'mdi:crop-portrait' : 'mdi:vibrate';
|
|
||||||
case 'gas':
|
|
||||||
case 'power':
|
|
||||||
case 'problem':
|
|
||||||
case 'safety':
|
|
||||||
case 'smoke':
|
|
||||||
return activated ? 'mdi:verified' : 'mdi:alert';
|
|
||||||
case 'plug':
|
case 'plug':
|
||||||
return activated ? 'mdi:power-plug-off' : 'mdi:power-plug';
|
return activated ? 'mdi:power-plug-off' : 'mdi:power-plug';
|
||||||
case 'presence':
|
case 'presence':
|
||||||
return activated ? 'mdi:home-outline' : 'mdi:home';
|
return activated ? 'mdi:home-outline' : 'mdi:home';
|
||||||
|
case 'sound':
|
||||||
|
return activated ? 'mdi:music-note-off' : 'mdi:music-note';
|
||||||
|
case 'vibration':
|
||||||
|
return activated ? 'mdi:crop-portrait' : 'mdi:vibrate';
|
||||||
|
case 'window':
|
||||||
|
return activated ? 'mdi:window-closed' : 'mdi:window-open';
|
||||||
default:
|
default:
|
||||||
return activated ? 'mdi:radiobox-blank' : 'mdi:checkbox-marked-circle';
|
return activated ? 'mdi:radiobox-blank' : 'mdi:checkbox-marked-circle';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user