@@ -13,7 +13,7 @@ class HeatPumpCard extends HTMLElement {
1313 }
1414
1515 setValues ( hass ) {
16- this . changeHeatPumpType ( this . content , this . config . heatingPumpType , this . config . hpRunning , hass ) ;
16+ this . changeHeatPumpRunning ( this . content , this . config . heatingPumpType , this . config . hpRunning , hass ) ;
1717 this . content . querySelector ( "#textG2WWaterTempIn" ) . innerHTML = this . formatNum ( hass , this . config . temperatureGroundWaterIn ) ;
1818 this . content . querySelector ( "#textG2WWaterTempOut" ) . innerHTML = this . formatNum ( hass , this . config . temperatureGroundWaterOut ) ;
1919
@@ -51,37 +51,33 @@ class HeatPumpCard extends HTMLElement {
5151
5252 this . switchRotateAttribute ( "#animationCompressor" , hass , this . config . compressorRunning ) ;
5353 if ( this . config . heatingCircuitPumpRunning ) {
54- this . content . querySelector ( "#gHeatingCircuitPump" ) . style . display = 'inline' ;
5554 this . switchRotateAttribute ( "#animationHeatingCircuitPumpBladeWheel" , hass , this . config . heatingCircuitPumpRunning ) ;
56- } else {
57- this . content . querySelector ( "#gHeatingCircuitPump" ) . style . display = 'none' ;
55+ }
56+ if ( this . config . heatingCircuitPumpRunning2 ) {
57+ this . switchRotateAttribute ( "#animationHeatingCircuitPumpBladeWheel2" , hass , this . config . heatingCircuitPumpRunning2 ) ;
58+ }
59+ if ( this . config . heatingCircuitPumpRunning3 ) {
60+ this . switchRotateAttribute ( "#animationHeatingCircuitPumpBladeWheel3" , hass , this . config . heatingCircuitPumpRunning3 ) ;
5861 }
5962 if ( this . config . circulatingPumpRunning ) {
60- this . content . querySelector ( "#gCirculatingPump" ) . style . display = 'inline' ;
6163 this . switchRotateAttribute ( "#animationCirculatingPumpBladeWheel" , hass , this . config . circulatingPumpRunning ) ;
62- } else {
63- this . content . querySelector ( "#gCirculatingPump" ) . style . display = 'none' ;
6464 }
6565
6666 const heaterRodWW = this . formatBinary ( hass , this . config . heaterRodWW ) ;
6767
6868 if ( this . config . tankHP ) {
6969 const tankTempHPUp = this . readState ( hass , this . config . tankTempHPUp ) ;
70- this . content . querySelector ( "#gTankHP" ) . style . display = 'inline' ;
7170 this . content . querySelector ( "#textTankTempHPUp" ) . innerHTML = this . formatNumValue ( tankTempHPUp ) ;
7271 const tankTempHPMiddle = this . readState ( hass , this . config . tankTempHPMiddle ) ;
7372 this . content . querySelector ( "#textTankTempHPMiddle" ) . innerHTML = this . formatNumValue ( tankTempHPMiddle ) ;
7473 const tankTempHPDown = this . readState ( hass , this . config . tankTempHPDown ) ;
7574 this . content . querySelector ( "#textTankTempHPDown" ) . innerHTML = this . formatNumValue ( tankTempHPDown ) ;
7675 this . tankColors ( this . content , tankTempHPUp , tankTempHPMiddle , tankTempHPDown , "#stop3020" , "#stop3040" , "#stop3030" ) ;
7776
78- this . content . querySelector ( "#pathHeaterRodHP" ) . style . display = this . formatBinary ( hass , this . config . heaterRodHP ) ? 'block' : 'none' ;
79- } else {
80- this . content . querySelector ( "#gTankHP" ) . style . display = 'none' ;
77+ this . content . querySelector ( "#pathHeaterRodHP" ) . style . display = this . formatBinary ( hass , this . config . heaterRodHP ) ? 'block' : 'none' ;
8178 }
8279
8380 if ( this . config . tankWW ) {
84- this . content . querySelector ( "#gWW" ) . style . display = 'inline' ;
8581 const tankTempWWUp = this . readState ( hass , this . config . tankTempWWUp ) ;
8682 this . content . querySelector ( "#textTankTempWWUp" ) . innerHTML = this . formatNumValue ( tankTempWWUp ) ;
8783 const tankTempWWMiddle = this . readState ( hass , this . config . tankTempWWMiddle ) ;
@@ -92,22 +88,11 @@ class HeatPumpCard extends HTMLElement {
9288
9389 this . content . querySelector ( "#gWWHeatingValve" ) . setAttribute ( 'transform' , 'rotate(' + ( this . formatBinary ( hass , this . config . wwHeatingValve ) ? '90' : '0' ) + ', 620, 487)' ) ;
9490 this . content . querySelector ( "#pathHeaterRodWW" ) . style . display = heaterRodWW ? 'block' : 'none' ;
95- } else {
96- this . content . querySelector ( "#gWW" ) . style . display = 'none' ;
9791 }
9892
99- if ( ! this . config . supplyTemperatureHeating && ! this . config . refluxTemperatureHeating && ! this . config . tankTempHPUp && ! this . config . tankTempWWUp && ! this . config . heatingCircuitPumpRunning && this . config . circulatingPumpRunning ) {
100- this . content . querySelector ( "#gPipe" ) . style . display = 'none' ;
101- this . content . querySelector ( "#gHP" ) . setAttribute ( "transform" , "translate(460 -300)" ) ;
102- this . content . querySelector ( "#gSettings" ) . setAttribute ( "transform" , "translate(-25)" ) ;
103- } else {
104- this . content . querySelector ( "#gPipe" ) . style . display = 'inline' ;
105- this . content . querySelector ( "#gHP" ) . removeAttribute ( "transform" ) ;
106- this . content . querySelector ( "#gSettings" ) . removeAttribute ( "transform" ) ;
107- this . heatingCurcuit1 ( this . content , hass ) ;
108- this . heatingCurcuit2 ( this . content , hass ) ;
109- this . heatingCurcuit3 ( this . content , hass ) ;
110- }
93+ this . heatingCurcuit1 ( this . content , hass ) ;
94+ this . heatingCurcuit2 ( this . content , hass ) ;
95+ this . heatingCurcuit3 ( this . content , hass ) ;
11196
11297 this . content . querySelector ( "#textEvaporatorPressure" ) . innerHTML = this . formatNum ( hass , this . config . evaporatorPressure ) ;
11398 this . content . querySelector ( "#textEvaporatorTemperature" ) . innerHTML = this . formatNum ( hass , this . config . evaporatorTemperature ) ;
@@ -137,9 +122,7 @@ class HeatPumpCard extends HTMLElement {
137122 this . content . querySelector ( "#textExpansionValve" ) . innerHTML = HeatPumpCard . localization . svgTexts [ 'expansionValve' ] ;
138123 this . content . querySelector ( "#textCirculatingPump" ) . innerHTML = HeatPumpCard . localization . svgTexts [ 'circulatingPump' ] ;
139124 this . content . querySelector ( "#textSupplyTemperatureLabel" ) . innerHTML = HeatPumpCard . localization . svgTexts [ 'supplyTemperatureLabel' ] ;
140- this . querySelector ( "ha-card" ) . setAttribute ( "header" , this . config . title ) ;
141- this . moveHeatingCircuitPump ( this . content , this . config . heatingCircuitPumpBeforeValve ) ;
142- this . setLinks ( ) ;
125+ this . setConfig ( this . config ) ;
143126 this . setValues ( hass ) ;
144127 } else if ( lang != "en" ) {
145128 this . readLocalization ( "en" , hass ) ;
@@ -280,27 +263,19 @@ class HeatPumpCard extends HTMLElement {
280263 window . dispatchEvent ( new CustomEvent ( "location-changed" ) ) ;
281264 }
282265
283- changeHeatPumpType ( content , selection , running , hass ) {
284- content . querySelector ( '#gHPFan' ) . style . display = ( ! selection || selection === 'A2W' ? 'inline' : 'none' ) ;
285- content . querySelector ( '#gHPW2W' ) . style . display = ( selection === 'W2W' ? 'inline' : 'none' ) ;
286- content . querySelector ( '#gHPG2W' ) . style . display = ( selection === 'G2W' ? 'inline' : 'none' ) ;
266+ changeHeatPumpRunning ( content , selection , running , hass ) {
287267 this . switchRotateAttribute ( "#animationHPFan" , hass , ! selection || selection === 'A2W' ? running : null ) ;
288268 this . switchRotateAttribute ( "#animationHPW2WPumpBladeWheel" , hass , selection === 'W2W' ? running : null ) ;
289269 this . switchRotateAttribute ( "#animationHPG2WPumpBladeWheel" , hass , selection === 'G2W' ? running : null ) ;
290270 }
291271
292272 heatingCurcuit1 ( content , hass ) {
293273 var type = this . config . heatingCircuitType1 ;
294- if ( ! type || type === 'off' ) {
295- content . querySelector ( '#gHeaterCircuit1' ) . style . display = ( 'none' ) ;
296- } else {
274+ if ( type && type != 'off' ) {
297275 var tempInState = this . readState ( hass , this . config . supplyTemperatureHeating ) ;
298- var tempIn = tempInState ? tempInState . state : 0 ;
276+ var tempIn = tempInState ? tempInState . state : 30 ;
299277 var tempOutState = this . readState ( hass , this . config . refluxTemperatureHeating ) ;
300278 var tempOut = Math . max ( 0 , tempOutState ? tempOutState . state : tempIn - 10 ) ;
301- content . querySelector ( '#gHeaterCircuit1' ) . style . display = ( 'inline' ) ;
302- content . querySelector ( '#gHeaterCircuitFloor1' ) . style . display = ( type === 'underfloor' ? 'inline' : 'none' ) ;
303- content . querySelector ( '#radiator1' ) . style . display = ( type === 'radiator' ? 'inline' : 'none' ) ;
304279 content . querySelector ( '#stopCircuit1' ) . setAttribute ( 'style' , "stop-color:" + this . tempColor ( tempIn ) ) ;
305280 content . querySelector ( '#stopCircuit2' ) . setAttribute ( 'style' , "stop-color:" + this . tempColor ( tempOut ) ) ;
306281 content . querySelector ( "#textSupplyTemperatureHeating" ) . innerHTML = this . formatNumValue ( tempInState ) ;
@@ -310,16 +285,11 @@ class HeatPumpCard extends HTMLElement {
310285
311286 heatingCurcuit2 ( content , hass ) {
312287 var type = this . config . heatingCircuitType2 ;
313- if ( ! type || type === 'off' ) {
314- content . querySelector ( '#gHeaterCircuit2' ) . style . display = ( 'none' ) ;
315- } else {
288+ if ( type && type != 'off' ) {
316289 var tempInState = this . readState ( hass , this . config . supplyTemperatureHeating2 ) ;
317- var tempIn = tempInState ? tempInState . state : 0 ;
290+ var tempIn = tempInState ? tempInState . state : 30 ;
318291 var tempOutState = this . readState ( hass , this . config . refluxTemperatureHeating2 ) ;
319292 var tempOut = Math . max ( 0 , tempOutState ? tempOutState . state : tempIn - 10 ) ;
320- content . querySelector ( '#gHeaterCircuit2' ) . style . display = ( 'inline' ) ;
321- content . querySelector ( '#gHeaterCircuitFloor2' ) . style . display = ( type === 'underfloor' ? 'inline' : 'none' ) ;
322- content . querySelector ( '#radiator2' ) . style . display = ( type === 'radiator' ? 'inline' : 'none' ) ;
323293 content . querySelector ( '#stopCircuit3' ) . setAttribute ( 'style' , "stop-color:" + this . tempColor ( tempIn ) ) ;
324294 content . querySelector ( '#stopCircuit4' ) . setAttribute ( 'style' , "stop-color:" + this . tempColor ( tempOut ) ) ;
325295 content . querySelector ( "#textSupplyTemperatureHeating2" ) . innerHTML = this . formatNumValue ( tempInState ) ;
@@ -329,16 +299,11 @@ class HeatPumpCard extends HTMLElement {
329299
330300 heatingCurcuit3 ( content , hass ) {
331301 var type = this . config . heatingCircuitType3 ;
332- if ( ! type || type == = 'off' ) {
333- content . querySelector ( '#gHeaterCircuit3' ) . style . display = ( 'none' ) ;
334- } else {
302+ if ( type && type ! = 'off' ) {
303+ var tempInState = this . readState ( hass , this . config . supplyTemperatureHeating3 ) ;
304+ var tempIn = tempInState ? tempInState . state : 30 ;
335305 var tempOutState = this . readState ( hass , this . config . refluxTemperatureHeating3 ) ;
336306 var tempOut = Math . max ( 0 , tempOutState ? tempOutState . state : tempIn - 10 ) ;
337- var tempIn = this . readState ( hass , this . config . supplyTemperatureHeating3 ) ;
338- var tempOut = Math . max ( 0 , this . readState ( hass , this . config . refluxTemperatureHeating3 ) ? this . readState ( hass , this . config . refluxTemperatureHeating3 ) : tempIn - 10 ) ;
339- content . querySelector ( '#gHeaterCircuit3' ) . style . display = ( 'inline' ) ;
340- content . querySelector ( '#gHeaterCircuitFloor3' ) . style . display = ( type === 'underfloor' ? 'inline' : 'none' ) ;
341- content . querySelector ( '#radiator3' ) . style . display = ( type === 'radiator' ? 'inline' : 'none' ) ;
342307 content . querySelector ( '#stopCircuit5' ) . setAttribute ( 'style' , "stop-color:" + this . tempColor ( tempIn ) ) ;
343308 content . querySelector ( '#stopCircuit6' ) . setAttribute ( 'style' , "stop-color:" + this . tempColor ( tempOut ) ) ;
344309 content . querySelector ( "#textSupplyTemperatureHeating3" ) . innerHTML = this . formatNumValue ( tempInState ) ;
@@ -383,10 +348,61 @@ class HeatPumpCard extends HTMLElement {
383348
384349 this . config = config ;
385350 if ( this . content ) {
386- this . querySelector ( "ha-card" ) . setAttribute ( "header" , this . config . title ) ;
387- this . moveHeatingCircuitPump ( this . content , this . config . heatingCircuitPumpBeforeValve ) ;
351+ this . querySelector ( "ha-card" ) . setAttribute ( "header" , config . title ) ;
352+ this . content . querySelector ( '#gHPFan' ) . style . display = ( ! this . config . heatingPumpType || this . config . heatingPumpType === 'A2W' ? 'inline' : 'none' ) ;
353+ this . content . querySelector ( '#gHPW2W' ) . style . display = ( this . config . heatingPumpType === 'W2W' ? 'inline' : 'none' ) ;
354+ this . content . querySelector ( '#gHPG2W' ) . style . display = ( this . config . heatingPumpType === 'G2W' ? 'inline' : 'none' ) ;
355+ this . moveHeatingCircuitPump ( this . content , config . heatingCircuitPumpBeforeValve ) ;
356+ this . content . querySelector ( "#gCirculatingPump" ) . style . display = config . circulatingPumpRunning ? 'inline' : 'none' ;
357+ this . content . querySelector ( '#animationCirculatingPumpBladeWheel' ) . removeAttribute ( 'type' ) ;
358+ this . content . querySelector ( "#gTankHP" ) . style . display = config . tankHP ? 'inline' : 'none' ;
359+ this . content . querySelector ( "#gWW" ) . style . display = config . tankWW ? 'inline' : 'none' ;
360+
361+ if ( ! config . supplyTemperatureHeating && ! config . refluxTemperatureHeating && ! config . tankTempHPUp && ! config . tankTempWWUp && ! config . heatingCircuitPumpRunning && config . circulatingPumpRunning ) {
362+ this . content . querySelector ( "#gPipe" ) . style . display = 'none' ;
363+ this . content . querySelector ( "#gHP" ) . setAttribute ( "transform" , "translate(460 -300)" ) ;
364+ this . content . querySelector ( "#gSettings" ) . setAttribute ( "transform" , "translate(-25)" ) ;
365+ } else {
366+ this . content . querySelector ( "#gPipe" ) . style . display = 'inline' ;
367+ this . content . querySelector ( "#gHP" ) . removeAttribute ( "transform" ) ;
368+ this . content . querySelector ( "#gSettings" ) . removeAttribute ( "transform" ) ;
369+ }
370+
371+ var type1 = config . heatingCircuitType1 ;
372+ if ( ! type1 || type1 === 'off' ) {
373+ this . content . querySelector ( '#gHeaterCircuit1' ) . style . display = 'none' ;
374+ } else {
375+ this . content . querySelector ( '#gHeaterCircuit1' ) . style . display = 'inline' ;
376+ this . content . querySelector ( '#gHeaterCircuitFloor1' ) . style . display = ( type1 === 'underfloor' ? 'inline' : 'none' ) ;
377+ this . content . querySelector ( '#radiator1' ) . style . display = ( type1 === 'radiator' ? 'inline' : 'none' ) ;
378+ }
379+ this . content . querySelector ( '#animationHeatingCircuitPumpBladeWheel' ) . removeAttribute ( 'type' ) ;
380+ this . content . querySelector ( "#gHeatingCircuitPump" ) . style . display = config . heatingCircuitPumpRunning ? 'inline' : 'none' ;
381+
382+ var type2 = config . heatingCircuitType2 ;
383+ if ( ! type2 || type2 === 'off' ) {
384+ this . content . querySelector ( '#gHeaterCircuit2' ) . style . display = 'none' ;
385+ } else {
386+ this . content . querySelector ( '#gHeaterCircuit2' ) . style . display = 'inline' ;
387+ this . content . querySelector ( '#gHeaterCircuitFloor2' ) . style . display = ( type2 === 'underfloor' ? 'inline' : 'none' ) ;
388+ this . content . querySelector ( '#radiator2' ) . style . display = ( type2 === 'radiator' ? 'inline' : 'none' ) ;
389+ }
390+ this . content . querySelector ( '#animationHeatingCircuitPumpBladeWheel2' ) . removeAttribute ( 'type' ) ;
391+ this . content . querySelector ( "#gHeatingCircuitPump2" ) . style . display = config . heatingCircuitPumpRunning2 ? 'inline' : 'none' ;
392+
393+ var type3 = config . heatingCircuitType3 ;
394+ if ( ! type3 || type3 === 'off' ) {
395+ this . content . querySelector ( '#gHeaterCircuit3' ) . style . display = 'none' ;
396+ } else {
397+ this . content . querySelector ( '#gHeaterCircuit3' ) . style . display = 'inline' ;
398+ this . content . querySelector ( '#gHeaterCircuitFloor3' ) . style . display = ( type3 === 'underfloor' ? 'inline' : 'none' ) ;
399+ this . content . querySelector ( '#radiator3' ) . style . display = ( type3 === 'radiator' ? 'inline' : 'none' ) ;
400+ }
401+ this . content . querySelector ( '#animationHeatingCircuitPumpBladeWheel3' ) . removeAttribute ( 'type' ) ;
402+ this . content . querySelector ( "#gHeatingCircuitPump3" ) . style . display = config . heatingCircuitPumpRunning3 ? 'inline' : 'none' ;
403+
404+ this . setLinks ( ) ;
388405 }
389- this . setLinks ( ) ;
390406 }
391407
392408 static getConfigForm ( ) {
0 commit comments