diff --git a/src/filter.js b/src/filter.js index 7b858ac..7bc65d3 100644 --- a/src/filter.js +++ b/src/filter.js @@ -123,4 +123,4 @@ export function entity_filter(hass, filter) { } return true; } - } \ No newline at end of file + } diff --git a/src/main.js b/src/main.js index d5d0336..628ef63 100644 --- a/src/main.js +++ b/src/main.js @@ -169,4 +169,4 @@ class AutoEntities extends LitElement { } customElements.define('auto-entities', AutoEntities); -fireEvent('ll-rebuild', {}); \ No newline at end of file +fireEvent('ll-rebuild', {}); diff --git a/src/sort.js b/src/sort.js index d93a599..3bce6c9 100644 --- a/src/sort.js +++ b/src/sort.js @@ -25,42 +25,42 @@ export function entity_sorter(hass, method) { } switch(method.method) { case "domain": - return compare( + return compare( entityA.entity_id.split(".")[0], entityB.entity_id.split(".")[0] ); - case "entity_id": + case "entity_id": return compare( entityA.entity_id, entityB.entity_id ); - case "friendly_name": - case "name": - return compare( - entityA.attributes.friendly_name || entityA.entity_id.split(".")[1], - entityB.attributes.friendly_name || entityB.entity_id.split(".")[1] - ); - case "state": - return compare( - entityA.state, - entityB.state - ); - case "attribute": - let _a = entityA.attributes; - let _b = entityB.attributes; - let attr = method.attribute; - while(attr) { - let k; - [k, attr] = attr.split(":"); - _a = _a[k]; - _b = _b[k]; - if(_a === undefined && _b === undefined) return 0; - if(_a === undefined) return lt; - if(_b === undefined) return gt; - } - return compare(_a, _b); - default: - return 0; - } - } - } \ No newline at end of file + case "friendly_name": + case "name": + return compare( + entityA.attributes.friendly_name || entityA.entity_id.split(".")[1], + entityB.attributes.friendly_name || entityB.entity_id.split(".")[1] + ); + case "state": + return compare( + entityA.state, + entityB.state + ); + case "attribute": + let _a = entityA.attributes; + let _b = entityB.attributes; + let attr = method.attribute; + while(attr) { + let k; + [k, attr] = attr.split(":"); + _a = _a[k]; + _b = _b[k]; + if(_a === undefined && _b === undefined) return 0; + if(_a === undefined) return lt; + if(_b === undefined) return gt; + } + return compare(_a, _b); + default: + return 0; + } + } +}