UNPKG

iobroker.lovelace

Version:

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

1 lines 6.25 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[98231],{81610:function(e,t,a){a.a(e,async function(e,o){try{a.r(t),a.d(t,{HuiWeatherForecastCardEditor:function(){return q}});a(62953);var s=a(40445),r=a(5124),c=a(67576),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;let g,b=e=>e;const v="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",C=(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 q extends r.WF{setConfig(e){if((0,l.vA)(e,C),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:Object.assign(Object.assign({},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:Object.assign(Object.assign({},e),{},{forecast_type:t})})}}get _stateObj(){if(this.hass&&this._config)return this.hass.states[this._config.entity]}get _hasForecast(){const e=this._stateObj;var t;if(e&&e.state!==u.Hh)return!!(null!==(t=e.attributes.forecast)&&void 0!==t&&t.length||e.attributes.supported_features)}_forecastSupported(e){const t=this._stateObj;var a;return"legacy"===e?!(null===(a=t.attributes.forecast)||void 0===a||!a.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=Object.assign({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",(0,r.qy)(g||(g=b` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> `),this.hass,t,e,this._computeLabelCallback,this._valueChanged)}_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:v,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})],q.prototype,"hass",void 0),(0,s.Cg)([(0,c.wk)()],q.prototype,"_config",void 0),q=(0,s.Cg)([(0,c.EM)("hui-weather-forecast-card-editor")],q),o()}catch(g){o(g)}})},84698:function(e,t,a){a.d(t,{H:function(){return 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)())})}}]);