diff --git a/src/state-summary/state-card-binary_sensor.html b/src/state-summary/state-card-binary_sensor.html deleted file mode 100644 index a349485241..0000000000 --- a/src/state-summary/state-card-binary_sensor.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - diff --git a/src/state-summary/state-card-content.html b/src/state-summary/state-card-content.html index 18cee7d2e1..8c011bfcff 100644 --- a/src/state-summary/state-card-content.html +++ b/src/state-summary/state-card-content.html @@ -1,6 +1,5 @@ - diff --git a/src/util/hass-util.html b/src/util/hass-util.html index d14a112e28..b6915ce3bd 100644 --- a/src/util/hass-util.html +++ b/src/util/hass-util.html @@ -11,7 +11,6 @@ window.hassUtil.DEFAULT_ICON = 'mdi:bookmark'; window.hassUtil.OFF_STATES = ['off', 'closed', 'unlocked']; window.hassUtil.DOMAINS_WITH_CARD = [ - 'binary_sensor', 'climate', 'cover', 'configurator', @@ -433,6 +432,34 @@ window.hassUtil.computeStateState = function (stateObj) { if (stateObj.attributes.unit_of_measurement) { stateObj._stateDisplay += ' ' + stateObj.attributes.unit_of_measurement; } + if (window.hassUtil.computeDomain(stateObj) === 'binary_sensor') { + switch (stateObj.attributes.device_class) { + case 'moisture': + stateObj._stateDisplay = (stateObj._stateDisplay === 'off') ? 'dry' : 'wet'; + break; + case 'gas': + case 'motion': + case 'occupancy': + case 'smoke': + case 'sound': + case 'vibration': + stateObj._stateDisplay = (stateObj._stateDisplay === 'off') ? 'clear' : 'detected'; + break; + case 'opening': + stateObj._stateDisplay = (stateObj._stateDisplay === 'off') ? 'closed' : 'open'; + break; + case 'safety': + stateObj._stateDisplay = (stateObj._stateDisplay === 'off') ? 'safe' : 'unsafe'; + break; + case 'cold': + case 'connectivity': + case 'heat': + case 'light': + case 'moving': + case 'power': + default: + } + } } return stateObj._stateDisplay;