Skip to content

Attributes too big - #302

Merged
Giga77 merged 4 commits into
mainfrom
113-homework---attributes-to-big
Sep 27, 2026
Merged

Giga77 merged 4 commits into
mainfrom
113-homework---attributes-to-big

Conversation

@Giga77

@Giga77 Giga77 commented Sep 27, 2026

Copy link
Copy Markdown
Member

No description provided.

…113)

- Persist oversized homework and timetable attributes using Home Assistant Store
  in EDDataUpdateCoordinator instead of truncating with an error message
- Register websocket command `ecole_directe/get_stored_data` to serve stored attributes
- Update Lovelace devoirs and timetable cards to fetch stored attributes asynchronously
- Improve error handling when parsing homework data in EDClient
- Bump ecoledirecte library to 0.3.2
@Giga77 Giga77 linked an issue Sep 27, 2026 that may be closed by this pull request
4 tasks done
\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,ve=/>/g,x=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),be=/'/g,$e=/"/g,Ee=/^(?:script|style|textarea|title)$/i,Q=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),dt=Q(1),ct=Q(2),ht=Q(3),C=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),we=new WeakMap,A=E.createTreeWalker(E,129);function Ce(r,e){if(!K(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return fe!==void 0?fe.createHTML(e):e}var Ye=(r,e)=>{let t=r.length-1,i=[],a,s=e===2?"<svg>":e===3?"<math>":"",n=L;for(let o=0;o<t;o++){let l=r[o],c,h,d=-1,p=0;for(;p<l.length&&(n.lastIndex=p,h=n.exec(l),h!==null);)p=n.lastIndex,n===L?h[1]==="!--"?n=ye:h[1]!==void 0?n=ve:h[2]!==void 0?(Ee.test(h[2])&&(a=RegExp("</"+h[2],"g")),n=x):h[3]!==void 0&&(n=x):n===x?h[0]===">"?(n=a??L,d=-1):h[1]===void 0?d=-2:(d=n.lastIndex-h[2].length,c=h[1],n=h[3]===void 0?x:h[3]==='"'?$e:be):n===$e||n===be?n=x:n===ye||n===ve?n=L:(n=x,a=void 0);let y=n===x&&r[o+1].startsWith("/>")?" ":"";s+=n===L?l+qe:d>=0?(i.push(c),l.slice(0,d)+xe+l.slice(d)+v+y):l+v+(d===-2?o:y)}return[Ce(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]},O=class r{constructor({strings:e,_$litType$:t},i){let a;this.parts=[];let s=0,n=0,o=e.length-1,l=this.parts,[c,h]=Ye(e,t);if(this.el=r.createElement(c,i),A.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(a=A.nextNode())!==null&&l.length<o;){if(a.nodeType===1){if(a.hasAttributes())for(let d of a.getAttributeNames())if(d.endsWith(xe)){let p=h[n++],y=a.getAttribute(d).split(v),w=/([.?@])?(.*)/.exec(p);l.push({type:1,index:s,name:w[2],strings:y,ctor:w[1]==="."?G:w[1]==="?"?X:w[1]==="@"?Z:F}),a.removeAttribute(d)}else d.startsWith(v)&&(l.push({type:6,index:s}),a.removeAttribute(d));if(Ee.test(a.tagName)){let d=a.textContent.split(v),p=d.length-1;if(p>0){a.textContent=N?N.emptyScript:"";for(let y=0;y<p;y++)a.append(d[y],B()),A.nextNode(),l.push({type:2,index:++s});a.append(d[p],B())}}}else if(a.nodeType===8)if(a.data===Ae)l.push({type:2,index:s});else{let d=-1;for(;(d=a.data.indexOf(v,d+1))!==-1;)l.push({type:7,index:s}),d+=v.length-1}s++}}static createElement(e,t){let i=E.createElement("template");return i.innerHTML=e,i}};function k(r,e,t=r,i){if(e===C)return e;let a=i!==void 0?t._$Co?.[i]:t._$Cl,s=H(e)?void 0:e._$litDirective$;return a?.constructor!==s&&(a?._$AO?.(!1),s===void 0?a=void 0:(a=new s(r),a._$AT(r,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=a:t._$Cl=a),a!==void 0&&(e=k(r,a._$AS(r,e.values),a,i)),e}var Y=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:i}=this._$AD,a=(e?.creationScope??E).importNode(t,!0);A.currentNode=a;let s=A.nextNode(),n=0,o=0,l=i[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new I(s,s.nextSibling,this,e):l.type===1?c=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(c=new J(s,this,e)),this._$AV.push(c),l=i[++o]}n!==l?.index&&(s=A.nextNode(),n++)}return A.currentNode=E,a}p(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},I=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,a){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=k(this,e,t),H(e)?e===u||e==null||e===""?(this._$AH!==u&&this._$AR(),this._$AH=u):e!==this._$AH&&e!==C&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):We(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==u&&H(this._$AH)?this._$AA.nextSibling.data=e:this.T(E.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:i}=e,a=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=O.createElement(Ce(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===a)this._$AH.p(t);else{let s=new Y(a,this),n=s.u(this.options);s.p(t),this.T(n),this._$AH=s}}_$AC(e){let t=we.get(e.strings);return t===void 0&&we.set(e.strings,t=new O(e)),t}k(e){K(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,a=0;for(let s of e)a===t.length?t.push(i=new r(this.O(B()),this.O(B()),this,this.options)):i=t[a],i._$AI(s),a++;a<t.length&&(this._$AR(i&&i._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let i=_e(e).nextSibling;_e(e).remove(),e=i}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},F=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,a,s){this.type=1,this._$AH=u,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=s,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=u}_$AI(e,t=this,i,a){let s=this.strings,n=!1;if(s===void 0)e=k(this,e,t,0),n=!H(e)||e!==this._$AH&&e!==C,n&&(this._$AH=e);else{let o=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=k(this,o[i+l],t,l),c===C&&(c=this._$AH[l]),n||(n=!H(c)||c!==this._$AH[l]),c===u?e=u:e!==u&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}n&&!a&&this.j(e)}j(e){e===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},G=class extends F{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===u?void 0:e}},X=class extends F{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==u)}},Z=class extends F{constructor(e,t,i,a,s){super(e,t,i,a,s),this.type=5}_$AI(e,t=this){if((e=k(this,e,t,0)??u)===C)return;let i=this._$AH,a=e===u&&i!==u||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,s=e!==u&&(i===u||a);a&&this.element.removeEventListener(this.name,this,i),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},J=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){k(this,e)}};var Ge=T.litHtmlPolyfillSupport;Ge?.(O,I),(T.litHtmlVersions??(T.litHtmlVersions=[])).push("3.3.2");var De={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ke=r=>(...e)=>({_$litDirective$:r,values:e}),z=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var j=class extends z{constructor(e){if(super(e),this.it=u,e.type!==De.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===u||e==null)return this._t=void 0,this.it=e;if(e===C)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};j.directiveName="unsafeHTML",j.resultType=1;var Fe=ke(j);var Se=Object.getPrototypeOf(customElements.get("ha-panel-lovelace")),m=Se.prototype.html,Xe=Se.prototype.css;Date.prototype.getWeekNumber=function(){var r=new Date(+this);return r.setHours(0,0,0,0),r.setDate(r.getDate()+4-(r.getDay()||7)),Math.ceil(((r-new Date(r.getFullYear(),0,1))/864e5+1)/7)};var ee=class extends _{constructor(){super(...arguments);this.lunchBreakRendered=!1}initCard(){}getFormattedDate(t){return new Date(t).toLocaleDateString("fr-FR",{weekday:"long",day:"2-digit",month:"2-digit"}).replace(/^(.)/,i=>i.toUpperCase())}getDayHeader(t,i){return m`<div class="ed-devoir-header">
`}static getStubConfig(){return{display_header:!0,display_lunch_break:!0,display_classroom:!0,display_teacher:!0,display_day_hours:!0,dim_ended_lessons:!0,enable_slider:!1,display_free_time_slots:!0,switch_to_next_day:!1}}static getConfigElement(){return document.createElement("ecole_directe-emploi_temps-card-editor")}};customElements.define("ecole_directe-emploi_temps-card",q);window.customCards=window.customCards||[];window.customCards.push({type:"ecole_directe-emploi_temps-card",name:"Carte de l'emploi du temps pour Ecole Directe",description:"Affiche l'emploi du temps pour Ecole Directe",documentationURL:"https://github.com/hacf-fr/EcoleDirecteHACards?tab=readme-ov-file#emploi_temps"});var T=globalThis,_e=n=>n,N=T.trustedTypes,fe=N?N.createPolicy("lit-html",{createHTML:n=>n}):void 0,xe="$lit$",v=`lit$${Math.random().toFixed(9).slice(2)}$`,Ae="?"+v,qe=`<${Ae}>`,E=document,B=()=>E.createComment(""),H=n=>n===null||typeof n!="object"&&typeof n!="function",J=Array.isArray,Ke=n=>J(n)||typeof n?.[Symbol.iterator]=="function",K=`[
\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,ve=/>/g,x=RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
@Giga77 Giga77 changed the title 113 homework attributes to big Attributes too big Sep 27, 2026
…113)

- Persist oversized timetable attributes using Home Assistant Store
  in EDDataUpdateCoordinator instead of truncating with an error message
- Update Lovelace timetable card to fetch stored attributes asynchronously
@Giga77
Giga77 merged commit fa93add into main Sep 27, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Homework - Attributes to big

2 participants