File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,31 @@ class DualGaugeCard extends HTMLElement {
59
59
}
60
60
61
61
_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
+ }
62
87
this . _updateGauge ( 'inner' ) ;
63
88
this . _updateGauge ( 'outer' ) ;
64
89
}
You can’t perform that action at this time.
0 commit comments