File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,31 @@ class DualGaugeCard extends HTMLElement {
5959 }
6060
6161 _update ( ) {
62+ if ( this . _hass . states [ this . config [ 'inner' ] . entity ] == undefined ||
63+ this . _hass . states [ this . config [ 'outer' ] . entity ] == undefined ) {
64+ console . warn ( "Undefined entity" ) ;
65+ if ( this . card ) {
66+ this . card . remove ( ) ;
67+ }
68+
69+ this . card = document . createElement ( 'ha-card' ) ;
70+ if ( this . config . header ) {
71+ this . card . header = this . config . header ;
72+ }
73+
74+ const content = document . createElement ( 'p' ) ;
75+ content . style . background = "#e8e87a" ;
76+ content . style . padding = "8px" ;
77+ content . innerHTML = "Error finding these entities:<br>- " +
78+ this . config [ 'inner' ] . entity +
79+ "<br>- " + this . config [ 'outer' ] . entity ;
80+ this . card . appendChild ( content ) ;
81+
82+ this . appendChild ( this . card ) ;
83+ return ;
84+ } else if ( this . card && this . card . firstElementChild . tagName . toLowerCase ( ) == "p" ) {
85+ this . _createCard ( ) ;
86+ }
6287 this . _updateGauge ( 'inner' ) ;
6388 this . _updateGauge ( 'outer' ) ;
6489 }
You can’t perform that action at this time.
0 commit comments