Update zwave to use new state values (#584)

* Update zwave to use new state values

* Support for zwave initializing state

* Show query stage on card for zwave entities

* Move logic to compteStateState
This commit is contained in:
Adam Mills 2017-11-07 10:14:01 -05:00 committed by GitHub
parent 4f4224953f
commit 11f4f3b3c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,11 +347,16 @@ window.hassUtil.domainIcon = function (domain, state) {
return 'mdi:open-in-new';
case 'zwave':
if (state) {
if (state.indexOf('Dead') !== -1) return 'mdi:emoticon-dead';
if (state.indexOf('Sleeping') !== -1) return 'mdi:sleep';
switch (state) {
case 'dead':
return 'mdi:emoticon-dead';
case 'sleeping':
return 'mdi:sleep';
case 'initializing':
return 'mdi:timer-sand';
default:
return 'mdi:nfc';
}
return 'mdi:nfc';
default:
/* eslint-disable no-console */
@ -526,6 +531,11 @@ window.hassUtil.computeStateState = function (stateObj) {
);
stateObj._stateDisplay = window.hassUtil.formatDateTime(date);
}
} else if (domain === 'zwave') {
if (['initializing', 'dead'].includes(stateObj.state) && stateObj.attributes && 'query_stage' in stateObj.attributes) {
return stateObj._stateDisplay + ' (' + stateObj.attributes.query_stage + ')';
}
return stateObj._stateDisplay;
}
}