Add presence device_class for binary_sensor (#659)

* Add presence device_class

* Added translations

* Update en.json
This commit is contained in:
Alok Saboo 2017-11-21 00:45:08 -05:00 committed by Paulus Schoutsen
parent cb5c9b3f3f
commit 7e77a7c32c
3 changed files with 7 additions and 1 deletions

View File

@ -68,6 +68,10 @@
"off": "Closed",
"on": "Open"
},
"presence": {
"off": "[%key:state::device_tracker::not_home%]",
"on": "[%key:state::device_tracker::home%]"
},
"safety": {
"off": "Safe",
"on": "Unsafe"

View File

@ -5,7 +5,7 @@ window.hassAttributeUtil.DOMAIN_DEVICE_CLASS = {
binary_sensor: [
'connectivity', 'light', 'moisture', 'motion', 'occupancy', 'opening',
'sound', 'vibration', 'gas', 'power', 'safety', 'smoke', 'cold', 'heat',
'moving', 'plug'],
'moving', 'plug', 'presence'],
cover: ['garage'],
};

View File

@ -389,6 +389,8 @@ window.hassUtil.binarySensorIcon = function (state) {
return activated ? 'mdi:verified' : 'mdi:alert';
case 'plug':
return activated ? 'mdi:power-plug-off' : 'mdi:power-plug';
case 'presence':
return activated ? 'mdi:home' : 'mdi:home-outline';
default:
return activated ? 'mdi:radiobox-blank' : 'mdi:checkbox-marked-circle';
}