haSensorDisplay-CSo8Nw_c.js 2.7 KB

1
  1. import{t as e}from"./createLucideIcon-Yo2YoYjm.js";import{t}from"./gauge-xO5PdXj0.js";import{t as n}from"./lock-C288ZvMI.js";import{n as r,t as i}from"./wind-CsHQYbhI.js";import{t as a}from"./triangle-alert-gIik0G2C.js";var o=e(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),s=e(`battery`,[[`path`,{d:`M 22 14 L 22 10`,key:`nqc4tb`}],[`rect`,{x:`2`,y:`6`,width:`16`,height:`12`,rx:`2`,key:`13zb55`}]]),c=e(`door-closed`,[[`path`,{d:`M10 12h.01`,key:`1kxr2c`}],[`path`,{d:`M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14`,key:`36qu9e`}],[`path`,{d:`M2 20h20`,key:`owomy5`}]]),l=e(`door-open`,[[`path`,{d:`M11 20H2`,key:`nlcfvz`}],[`path`,{d:`M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z`,key:`au4z13`}],[`path`,{d:`M11 4H8a2 2 0 0 0-2 2v14`,key:`74r1mk`}],[`path`,{d:`M14 12h.01`,key:`1jfl7z`}],[`path`,{d:`M22 20h-3`,key:`vhrsz`}]]),u=e(`droplets`,[[`path`,{d:`M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z`,key:`1ptgy4`}],[`path`,{d:`M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97`,key:`1sl1rz`}]]),d=e(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),f=e(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),p={door:{on:`open`,off:`closed`},garage_door:{on:`open`,off:`closed`},window:{on:`open`,off:`closed`},opening:{on:`open`,off:`closed`},lock:{on:`unlocked`,off:`locked`},motion:{on:`detected`,off:`clear`},occupancy:{on:`detected`,off:`clear`},presence:{on:`detected`,off:`clear`},smoke:{on:`detected`,off:`clear`},gas:{on:`detected`,off:`clear`},moisture:{on:`wet`,off:`dry`},problem:{on:`problem`,off:`ok`},safety:{on:`problem`,off:`ok`},running:{on:`running`,off:`stopped`}},m={door:l,garage_door:l,window:l,opening:l,lock:d,temperature:r,humidity:u,moisture:u,battery:s,motion:o,occupancy:o,presence:o,smoke:a,gas:a,problem:a,safety:a,running:i};function h(e,t,n){if(!e.reachable||e.state===null)return t(`haSensors.unavailable`);if(e.kind===`numeric`){if(e.value===null)return e.state;let t=n?.decimals===void 0?String(e.value):e.value.toFixed(n.decimals);return e.unit?`${t} ${e.unit}`:t}let r=p[e.device_class??``],i=r?r[e.state===`on`?`on`:`off`]:e.state;return t(`haSensors.states.${i}`,{defaultValue:i})}function g(e){let r=e.device_class??``;if(e.state===`off`){if(m[r]===l)return c;if(m[r]===d)return n}return m[r]??(e.kind===`numeric`?t:o)}export{d as a,c,f as i,s as l,h as n,u as o,g as r,l as s,p as t,o as u};