UNPKG

zigbee2mqtt-windfront

Version:

[![Version](https://img.shields.io/npm/v/zigbee2mqtt-windfront.svg)](https://npmjs.org/package/zigbee2mqtt-windfront) [![CI](https://github.com/Nerivec/zigbee2mqtt-windfront/actions/workflows/ci.yml/badge.svg)](https://github.com/Nerivec/zigbee2mqtt-windf

2 lines (1 loc) 1.21 kB
import{r as j,b as g,j as a,F as c,b9 as B,b7 as E,ba as P,bb as k,bc as u,bd as v,be as x,bf as F,bg as p}from"./index-Cg_dwqpD.js";import{s as w}from"./snakeCase-CrKq36vi.js";const Q=j.memo(d=>{const{device:b,batteryPercent:s,batteryState:m,batteryLow:f,showLevel:h,...l}=d,{t:n}=g("zigbee");let r;switch(b?.power_source&&(r=b.power_source),r){case"Battery":{let t=n(y=>y.battery),i="",e=u,o=!1;if(s!=null)i=`${s}%`,s>=85?e=u:s>=65?e=v:s>=40?e=x:s>=20?e=F:(e=p,o=!0);else if(m!=null)switch(i=m,m){case"high":e=u;break;case"medium":e=x;break;case"low":e=p,o=!0;break}else f!=null&&(i=f?"low":"ok",e=f?p:u);return f===!0&&(o=!0),i!==""&&(t+=`, ${n(y=>y.power_level)}: ${i}`),a.jsxs("span",{className:o?"text-error":"",children:[a.jsx(c,{icon:e,fade:o,title:t,...l}),h&&a.jsx("span",{className:"ps-2",children:i})]})}case"Mains (single phase)":case"Mains (3 phase)":case"DC Source":return a.jsx(c,{icon:k,title:n(t=>t[w(r)]),...l});case"Emergency mains and transfer switch":case"Emergency mains constantly powered":return a.jsx(c,{icon:P,title:n(t=>t[w(r)]),...l});default:return b?.type==="GreenPower"?a.jsx(c,{icon:B,title:"Green",...l}):a.jsx(c,{icon:E,title:r?n(t=>t[w(r)]):void 0,...l})}});export{Q as P};