@@ -172,8 +172,8 @@ class ChartsCard extends LitElement {
172172 let updated = false ;
173173 this . _config . series . forEach ( ( serie , index ) => {
174174 const entityState = ( hass && hass . states [ serie . entity ] ) || undefined ;
175+ this . _entities [ index ] = entityState ;
175176 if ( entityState && this . _entities [ index ] !== entityState ) {
176- this . _entities [ index ] = entityState ;
177177 updated = true ;
178178 if ( this . _graphs && this . _graphs [ index ] ) {
179179 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -186,6 +186,7 @@ class ChartsCard extends LitElement {
186186 return ;
187187 } else if ( this . _warning ) {
188188 this . _warning = false ;
189+ this . _reset ( ) ;
189190 }
190191 if ( updated ) {
191192 this . _entities = [ ...this . _entities ] ;
@@ -203,6 +204,19 @@ class ChartsCard extends LitElement {
203204 }
204205 }
205206
207+ private _reset ( ) {
208+ if ( this . _apexChart ) {
209+ this . _apexChart . destroy ( ) ;
210+ this . _apexChart = undefined ;
211+ this . _loaded = false ;
212+ this . _dataLoaded = false ;
213+ this . _updating = false ;
214+ }
215+ if ( this . _config && this . _hass && ! this . _loaded ) {
216+ this . _initialLoad ( ) ;
217+ }
218+ }
219+
206220 public setConfig ( config : ChartCardExternalConfig ) {
207221 const configDup = JSON . parse ( JSON . stringify ( config ) ) ;
208222 if ( configDup . entities ) {
@@ -292,17 +306,8 @@ class ChartsCard extends LitElement {
292306 return undefined ;
293307 } ) ;
294308 }
295- // Reset only happens in editor mode
296- if ( this . _apexChart ) {
297- this . _apexChart . destroy ( ) ;
298- this . _apexChart = undefined ;
299- this . _loaded = false ;
300- this . _dataLoaded = false ;
301- this . _updating = false ;
302- }
303- if ( this . _config && this . _hass && ! this . _loaded ) {
304- this . _initialLoad ( ) ;
305- }
309+ // Full reset only happens in editor mode
310+ this . _reset ( ) ;
306311 }
307312
308313 static get styles ( ) : CSSResult {
0 commit comments