UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 6.01 kB
export const __rspack_esm_id=98231;export const __rspack_esm_ids=[98231];export const __webpack_modules__={81610(e,t,a){a.a(e,async function(e,o){try{a.r(t),a.d(t,{HuiWeatherForecastCardEditor:()=>v});var s=a(62826),r=a(5124),c=a(22441),i=a(22786),l=a(63533),n=a(1087),h=a(82286),_=a(52763),u=a(22675),d=a(43248),f=a(999),p=a(91408),y=a(84698),w=a(44155),m=e([_,f]);[_,f]=m.then?(await m)():m;const b="M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5Z",g=(0,l.kp)(y.H,(0,l.Ik)({entity:(0,l.lq)((0,l.Yj)()),name:(0,l.lq)(w.q),theme:(0,l.lq)((0,l.Yj)()),show_current:(0,l.lq)((0,l.zM)()),show_forecast:(0,l.lq)((0,l.zM)()),forecast_type:(0,l.lq)((0,l.Yj)()),forecast_slots:(0,l.lq)((0,l.ai)()),secondary_info_attribute:(0,l.lq)((0,l.Yj)()),round_temperature:(0,l.lq)((0,l.zM)()),tap_action:(0,l.lq)(p.kn),hold_action:(0,l.lq)(p.kn),double_tap_action:(0,l.lq)(p.kn)}));class v extends r.WF{setConfig(e){if((0,l.vA)(e,g),this._config=e,!1!==e.show_forecast&&!1===this._hasForecast||!1===e.show_current&&!1===e.show_forecast)(0,n.r)(this,"config-changed",{config:{...e,show_current:!0,show_forecast:!1}});else if(!e.forecast_type||"legacy"===e.forecast_type&&this._modernForecastSupported()||!this._forecastSupported(e.forecast_type)){let t;this._forecastSupported("daily")?t="daily":this._forecastSupported("hourly")?t="hourly":this._forecastSupported("twice_daily")?t="twice_daily":this._forecastSupported("legacy")&&(t="legacy"),(0,n.r)(this,"config-changed",{config:{...e,forecast_type:t}})}}get _stateObj(){if(this.hass&&this._config)return this.hass.states[this._config.entity]}get _hasForecast(){const e=this._stateObj;if(e&&e.state!==u.Hh)return!(!e.attributes.forecast?.length&&!e.attributes.supported_features)}_forecastSupported(e){const t=this._stateObj;return"legacy"===e?!!t.attributes.forecast?.length:"daily"===e?(0,h.$)(t,d.Or.FORECAST_DAILY):"hourly"===e?(0,h.$)(t,d.Or.FORECAST_HOURLY):"twice_daily"===e&&(0,h.$)(t,d.Or.FORECAST_TWICE_DAILY)}_modernForecastSupported(){return this._forecastSupported("daily")||this._forecastSupported("hourly")||this._forecastSupported("twice_daily")}render(){if(!this.hass||!this._config)return r.s6;const e=this._schema(this.hass.localize,this._forecastSupported("legacy"),this._forecastSupported("daily"),this._forecastSupported("hourly"),this._forecastSupported("twice_daily")),t={show_current:!0,show_forecast:this._hasForecast,...this._config};return t.forecast=t.show_current&&t.show_forecast?"show_both":t.show_current?"show_current":"show_forecast",r.qy` <ha-form .hass="${this.hass}" .data="${t}" .schema="${e}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(e){const t=e.detail.value;"show_both"===t.forecast?(t.show_current=!0,t.show_forecast=!0):"show_current"===t.forecast?(t.show_current=!0,t.show_forecast=!1):(t.show_current=!1,t.show_forecast=!0),delete t.forecast,(0,n.r)(this,"config-changed",{config:t})}constructor(...e){super(...e),this._schema=(0,i.A)((e,t,a,o,s)=>[{name:"entity",required:!0,selector:{entity:{domain:"weather"}}},{name:"name",selector:{entity_name:{}},context:{entity:"entity"}},{name:"round_temperature",selector:{boolean:{}}},{name:"",type:"grid",schema:[{name:"secondary_info_attribute",selector:{attribute:{}},context:{filter_entity:"entity"}},{name:"theme",selector:{theme:{}}}]},...a||o||s?[{name:"forecast_type",selector:{select:{options:[...a?[{value:"daily",label:e("ui.panel.lovelace.editor.card.weather-forecast.daily")}]:[],...o?[{value:"hourly",label:e("ui.panel.lovelace.editor.card.weather-forecast.hourly")}]:[],...s?[{value:"twice_daily",label:e("ui.panel.lovelace.editor.card.weather-forecast.twice_daily")}]:[]]}}}]:[],...a||o||s||t?[{name:"forecast",default:"show_both",selector:{select:{options:[{value:"show_both",label:e("ui.panel.lovelace.editor.card.weather-forecast.show_both")},{value:"show_current",label:e("ui.panel.lovelace.editor.card.weather-forecast.show_only_current")},{value:"show_forecast",label:e("ui.panel.lovelace.editor.card.weather-forecast.show_only_forecast")}]}}},{name:"forecast_slots",selector:{number:{min:1,max:72}},default:5},{name:"interactions",type:"expandable",flatten:!0,iconPath:b,schema:[{name:"tap_action",selector:{ui_action:{default_action:"more-info"}},context:f.Tq},{name:"",type:"optional_actions",flatten:!0,schema:["hold_action","double_tap_action"].map(e=>({name:e,selector:{ui_action:{default_action:"none"}},context:f.Tq}))}]}]:[]]),this._computeLabelCallback=e=>{switch(e.name){case"entity":return`${this.hass.localize("ui.panel.lovelace.editor.card.generic.entity")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.required")})`;case"theme":return`${this.hass.localize("ui.panel.lovelace.editor.card.generic.theme")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.optional")})`;case"forecast_type":return this.hass.localize("ui.panel.lovelace.editor.card.weather-forecast.forecast_type");case"forecast_slots":return this.hass.localize("ui.panel.lovelace.editor.card.weather-forecast.forecast_slots");case"forecast":return this.hass.localize("ui.panel.lovelace.editor.card.weather-forecast.weather_to_show");default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}}}(0,s.Cg)([(0,c.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,s.Cg)([(0,c.wk)()],v.prototype,"_config",void 0),v=(0,s.Cg)([(0,c.EM)("hui-weather-forecast-card-editor")],v),o()}catch(e){o(e)}})},84698(e,t,a){a.d(t,{H:()=>s});var o=a(63533);const s=(0,o.Ik)({type:(0,o.Yj)(),view_layout:(0,o.bz)(),layout_options:(0,o.bz)(),grid_options:(0,o.bz)(),visibility:(0,o.bz)(),disabled:(0,o.lq)((0,o.zM)())})}};