diff --git a/public_html/admin/index.php b/public_html/admin/index.php
index 327df95..09c0819 100644
--- a/public_html/admin/index.php
+++ b/public_html/admin/index.php
@@ -572,6 +572,8 @@ select.filter-sel:focus{border-color:var(--cyan)}
DOMAIN:
+
+
@@ -1132,9 +1134,22 @@ async function loadHA() {
renderHATable(_haEntities);
}
+let _haOnlyOn = false;
+
+function setHAOnlyOn(onlyOn, btn) {
+ _haOnlyOn = onlyOn;
+ document.getElementById('ha-all-btn').classList.toggle('active', !onlyOn);
+ document.getElementById('ha-on-btn').classList.toggle('active', onlyOn);
+ filterHATable();
+}
+
function filterHATable() {
const q = document.getElementById('ha-search')?.value.toLowerCase() || '';
- renderHATable(q ? _haEntities.filter(e => (e.name||'').toLowerCase().includes(q)||(e.entity_id||'').toLowerCase().includes(q)) : _haEntities);
+ const ON_STATES = ['on','home','open','playing','mowing','active','idle'];
+ let list = _haEntities;
+ if (_haOnlyOn) list = list.filter(e => ON_STATES.includes(e.state));
+ if (q) list = list.filter(e => (e.name||'').toLowerCase().includes(q)||(e.entity_id||'').toLowerCase().includes(q));
+ renderHATable(list);
}
function renderHATable(entities) {