Files
houseplan-card/dist/houseplan-assets/zigbee-topology-CYx1516f.js
T
Sergey Matyunin 775e55f0ed build: prepare v1.72.0-beta.1 candidate
Issue: #54
Issue: #152
Issue: #447
User-Visible: yes
2026-09-04 16:01:33 +03:00

2 lines
12 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="7acb1b9d3bb384bc1a0c70fb01347386c157ae88b12b00ccd876b7658fc84a1c";import{s as e,y as n}from"./houseplan-card-CUGUKK_i.js";var t={title:"Zigbee links",toggle:"Show Zigbee links when hovering over a device",hint:"Shows observed direct neighbours only. Nothing is fetched while you hover.",admin_only:"Topology data is available to Home Assistant administrators only.",save_first:"Save this setting before loading topology data.",zha:"ZHA",zha_read:"Read ZHA data",zha_hint:"Reads ZHA's cached topology; it does not start a radio scan.",z2m:"Zigbee2MQTT",z2m_topics:"Base topics (one per line)",z2m_update:"Update map",z2m_warning:"A network-map scan can take 10 seconds to 2 minutes and may temporarily reduce Zigbee responsiveness.",status_idle:"Data not loaded",status_loading:"Loading…",status_ready:"Received {time}",status_stale:"Received {time} · stale",status_partial:"Received {time} · some nodes were omitted",status_no_links:"Received {time} · no observed links found",error_permission:"Administrator permission is required.",error_unsupported:"This provider or Home Assistant API is unavailable.",error_timeout:"The provider did not respond in time.",error_invalid_topic:"Check the Zigbee2MQTT base topic.",error_invalid_payload:"The provider returned unsupported topology data.",error_provider:"Topology data could not be loaded.",remote_count:"+{n} in other spaces"};const i={en:t,ru:{title:"Связи Zigbee",toggle:"Показывать связи Zigbee при наведении на устройство",hint:"Показываются только наблюдаемые прямые соседи. Наведение ничего не запрашивает.",admin_only:"Данные топологии доступны только администраторам Home Assistant.",save_first:"Сохраните настройку перед загрузкой данных топологии.",zha:"ZHA",zha_read:"Прочитать данные ZHA",zha_hint:"Читает сохранённую топологию ZHA и не запускает радио-сканирование.",z2m:"Zigbee2MQTT",z2m_topics:"Базовые топики (по одному в строке)",z2m_update:"Обновить карту",z2m_warning:"Сканирование карты сети занимает от 10 секунд до 2 минут и временно может снизить отзывчивость Zigbee.",status_idle:"Данные не загружены",status_loading:"Загрузка…",status_ready:"Получено: {time}",status_stale:"Получено: {time} · данные устарели",status_partial:"Получено: {time} · часть узлов не показана",status_no_links:"Получено: {time} · наблюдаемые связи не найдены",error_permission:"Нужны права администратора.",error_unsupported:"Провайдер или API Home Assistant недоступен.",error_timeout:"Провайдер не ответил вовремя.",error_invalid_topic:"Проверьте базовый топик Zigbee2MQTT.",error_invalid_payload:"Провайдер вернул неподдерживаемые данные топологии.",error_provider:"Не удалось загрузить данные топологии.",remote_count:"+{n} в других пространствах"},de:{title:"Zigbee-Verbindungen",toggle:"Zigbee-Verbindungen beim Darüberfahren über ein Gerät anzeigen",hint:"Es werden nur beobachtete direkte Nachbarn angezeigt. Beim Darüberfahren werden keine Daten abgerufen.",admin_only:"Topologiedaten sind nur für Home-Assistant-Administratoren verfügbar.",save_first:"Speichere diese Einstellung, bevor Topologiedaten geladen werden.",zha:"ZHA",zha_read:"ZHA-Daten lesen",zha_hint:"Liest den ZHA-Topologiecache; es wird kein Funkscan gestartet.",z2m:"Zigbee2MQTT",z2m_topics:"Basistopics (eines pro Zeile)",z2m_update:"Karte aktualisieren",z2m_warning:"Ein Netzwerkscan kann 10 Sekunden bis 2 Minuten dauern und Zigbee vorübergehend verlangsamen.",status_idle:"Daten nicht geladen",status_loading:"Wird geladen…",status_ready:"Empfangen: {time}",status_stale:"Empfangen: {time} · veraltet",status_partial:"Empfangen: {time} · einige Knoten fehlen",status_no_links:"Empfangen: {time} · keine beobachteten Verbindungen gefunden",error_permission:"Administratorrechte sind erforderlich.",error_unsupported:"Dieser Anbieter oder die Home-Assistant-API ist nicht verfügbar.",error_timeout:"Der Anbieter hat nicht rechtzeitig geantwortet.",error_invalid_topic:"Prüfe das Zigbee2MQTT-Basistopic.",error_invalid_payload:"Der Anbieter hat nicht unterstützte Topologiedaten geliefert.",error_provider:"Topologiedaten konnten nicht geladen werden.",remote_count:"+{n} in anderen Bereichen"},fr:{title:"Liens Zigbee",toggle:"Afficher les liens Zigbee au survol d’un appareil",hint:"Seuls les voisins directs observés sont affichés. Le survol ne lance aucune requête.",admin_only:"Les données de topologie sont réservées aux administrateurs Home Assistant.",save_first:"Enregistrez ce réglage avant de charger les données de topologie.",zha:"ZHA",zha_read:"Lire les données ZHA",zha_hint:"Lit la topologie en cache de ZHA sans lancer d’analyse radio.",z2m:"Zigbee2MQTT",z2m_topics:"Topics de base (un par ligne)",z2m_update:"Actualiser la carte",z2m_warning:"L’analyse de la carte réseau peut durer de 10 secondes à 2 minutes et réduire temporairement la réactivité de Zigbee.",status_idle:"Données non chargées",status_loading:"Chargement…",status_ready:"Reçu : {time}",status_stale:"Reçu : {time} · obsolète",status_partial:"Reçu : {time} · certains nœuds sont omis",status_no_links:"Reçu : {time} · aucun lien observé trouvé",error_permission:"Les droits administrateur sont requis.",error_unsupported:"Ce fournisseur ou l’API Home Assistant n’est pas disponible.",error_timeout:"Le fournisseur n’a pas répondu à temps.",error_invalid_topic:"Vérifiez le topic de base Zigbee2MQTT.",error_invalid_payload:"Le fournisseur a renvoyé des données de topologie non prises en charge.",error_provider:"Impossible de charger les données de topologie.",remote_count:"+{n} dans d’autres espaces"}};function r(n,r,o){return e(i[n]?.[r]??t[r]??r,o)}const o=3e5,s=2097152,a=6e3;function d(e){return null!==e&&"object"==typeof e?e:null}function l(e){if("string"!=typeof e&&"number"!=typeof e)return null;let n=String(e).trim().toLowerCase();return n=/^0x[0-9a-f]{16}$/.test(n)?n.slice(2):n.replace(/[:-]/g,""),/^[0-9a-f]{16}$/.test(n)?n:null}function u(e,n,t){return`${e}:${n}:${t}`}function c(e){const n=String(e||"").toLowerCase().replace(/[ _-]/g,"");return n.includes("coordinator")?"coordinator":n.includes("router")?"router":n.includes("enddevice")||"end"===n?"end":"unknown"}function p(e){const n=d(e),t=function(e){const n=Number(e);return Number.isFinite(n)&&n>=0&&n<=255?Math.round(n):void 0}(n?.lqi??n?.linkquality??n?.link_quality),i="string"==typeof n?.relationship?n.relationship.slice(0,40):void 0;return{...void 0===t?{}:{lqi:t},...i?{relationship:i}:{}}}function g(e,n){return Array.isArray(e)&&e.length<=n?e:null}function f(e){if("string"==typeof e)return e.length<=s;try{return JSON.stringify(e).length<=s}catch{return!1}}function _(e,n,t,i,r){if(t===i)return void n.push({code:"self_link",nodeKey:t});const o=t<i,s=o?`${t}|${i}`:`${i}|${t}`,a=e.get(s)||{a:o?t:i,b:o?i:t},d=o?"aToB":"bToA";a[d]?n.push({code:"duplicate_link",nodeKey:t}):a[d]=p(r),e.set(s,a)}function h(e,n=Date.now()){const t=[],i=f(e)?g(e,1e3):null;if(!i)return{provider:"zha",instanceId:"zha",obtainedAt:n,freshness:"provider-cache",nodes:[],links:[],warnings:[{code:"invalid_payload"}]};const r=new Map,o=new Map;for(const e of i){const n=d(e),i=l(n?.ieee??n?.ieee_address);if(!i){t.push({code:"invalid_payload"});continue}const o=u("zha","zha",i);r.set(o,{key:o,ieee:i,..."string"==typeof n?.device_reg_id?{deviceId:n.device_reg_id}:{},role:c(n?.device_type??n?.type),..."boolean"==typeof n?.available?{available:n.available}:{}})}for(const e of i){const n=d(e),i=l(n?.ieee??n?.ieee_address);if(!i)continue;const s=u("zha","zha",i),p=g(n?.neighbors,a);if(p)for(const e of p){if(o.size>=a){t.push({code:"invalid_payload"});break}const n=d(e),i=l(n?.ieee??n?.ieee_address);if(!i){t.push({code:"invalid_payload",nodeKey:s});continue}const p=u("zha","zha",i);r.has(p)||r.set(p,{key:p,ieee:i,role:c(n?.device_type)}),_(o,t,s,p,e)}else null!=n?.neighbors&&t.push({code:"invalid_payload",nodeKey:s})}return{provider:"zha",instanceId:"zha",obtainedAt:n,freshness:"provider-cache",nodes:[...r.values()],links:[...o.values()],warnings:t}}function m(e,n){const t=d(e),i=l(t?.ieee_address??t?.ieee??e);if(i)return i;const r=t?.id??t?.network_address??e;return null==r?null:n.get(String(r))||null}function b(e,t,i=Date.now()){const r=[],o=n(t)||"invalid",p=f(e)?function(e){let n=e;if("string"==typeof n){if(n.length>s)return null;try{n=JSON.parse(n)}catch{return null}}const t=d(n),i=d(t?.data);if(n=i?.value??t?.value??t?.data??n,"string"==typeof n){if(n.length>s)return null;try{n=JSON.parse(n)}catch{return null}}return n}(e):null,h=d(p),b=g(h?.nodes,1e3),v=g(h?.links,a);if(!b||!v)return{provider:"z2m",instanceId:o,obtainedAt:i,freshness:"fresh-scan",nodes:[],links:[],warnings:[{code:"invalid_payload"}]};const y=new Map,k=new Map;for(const e of b){const n=d(e),t=l(n?.ieee_address??n?.ieee);if(!t){r.push({code:"invalid_payload"});continue}const i=u("z2m",o,t);y.set(i,{key:i,ieee:t,role:c(n?.type??n?.device_type),..."boolean"==typeof n?.failed?{available:!n.failed}:{}});for(const e of[n?.id,n?.network_address])null!=e&&k.set(String(e),t)}const z=new Map;for(const e of v){const n=d(e),t=m(n?.source,k),i=m(n?.target,k);if(!t||!i){r.push({code:"invalid_payload"});continue}const s=u("z2m",o,t),a=u("z2m",o,i);y.has(s)||y.set(s,{key:s,ieee:t,role:"unknown"}),y.has(a)||y.set(a,{key:a,ieee:i,role:"unknown"}),_(z,r,s,a,e)}return{provider:"z2m",instanceId:o,obtainedAt:i,freshness:"fresh-scan",nodes:[...y.values()],links:[...z.values()],warnings:r}}function v(e){if("string"!=typeof e)return null;const n=l(e);if(n)return n;const t=e.toLowerCase().match(/^zigbee2mqtt(?:_bridge)?_(.+)$/);return t?l(t[1]):null}function y(e,n){if(e.deviceId&&n.devices[e.deviceId])return[e.deviceId];const t=new Set;for(const[i,r]of Object.entries(n.devices)){const n=d(r);(Array.isArray(n?.identifiers)?n.identifiers:[]).some(n=>Array.isArray(n)&&v(n[1])===e.ieee)&&t.add(i)}if(t.size)return[...t];for(const i of Object.values(n.entities)){const n=d(i);"string"==typeof n?.device_id&&"string"==typeof n.unique_id&&(v(n.unique_id)===e.ieee&&t.add(n.device_id))}return[...t]}function k(e){return!e.hidden&&!e.virtual&&"ha_disabled"!==e.bindingStatus?.kind&&"orphaned"!==e.bindingStatus?.kind&&"unverified"!==e.bindingStatus?.kind}function z(e,n,t){const i=new Map,r=[];for(const o of e.nodes){if(!1===o.available){r.push({code:"provider_scan_failure",nodeKey:o.key});continue}const e=y(o,t);if(1!==e.length){r.push({code:"unmatched_device",nodeKey:o.key});continue}const s=e[0];let a=n.filter(e=>k(e)&&"device"===e.bindingKind&&e.bindingRef===s);a.length||(a=n.filter(e=>k(e)&&"entity"===e.bindingKind&&!!e.bindingRef&&t.entities[e.bindingRef]?.device_id===s)),1===a.length?i.set(o.key,{markerId:a[0].id,space:a[0].space}):r.push({code:a.length>1?"ambiguous_placement":"unmatched_device",nodeKey:o.key})}return{placements:i,warnings:r}}function A(e,n,t){return e.map(e=>({topology:e,placements:z(e,n,t).placements}))}function w(e,n,t){const i=new Map,r=new Set;let o=0;for(const{topology:s,placements:a}of e){const e=new Set([...a].filter(([,e])=>e.markerId===t&&e.space===n).map(([e])=>e));if(e.size)for(const d of s.links){const s=e.has(d.a),l=e.has(d.b);if(!s&&!l)continue;const u=a.get(s?d.b:d.a);if(!u||u.markerId===t){o++;continue}if(u.space!==n){r.add(u.markerId);continue}const c=s?d.aToB:d.bToA,p=i.get(u.markerId);(!p||void 0===p.lqi&&void 0!==c?.lqi)&&i.set(u.markerId,{neighborMarkerId:u.markerId,lqi:c?.lqi})}}return{lines:[...i.values()],remoteCount:r.size,omittedCount:o}}export{o as T,A as a,b,z as m,h as n,w as r,r as t};