@@ -9,7 +9,7 @@ const languages = { en, de, es, fr };
99
1010function _getLangCode ( langInput ) {
1111 const raw = ( langInput || ( typeof navigator !== "undefined" && navigator . language ) || "en" ) . toString ( ) . toLowerCase ( ) ;
12- return raw . split ( / [ _ - ] / ) [ 0 ] ;
12+ return raw . split ( / [ _ - ] / ) [ 0 ] ;
1313}
1414
1515function localize ( key , langInput ) {
@@ -438,10 +438,22 @@ class B2500DCard extends LitElement {
438438 }
439439
440440 _getEntity ( type ) {
441+ const mapping = {
442+ daily_pv_charging : "production_today" ,
443+ battery_percentage : "battery_percentage" ,
444+ battery_capacity : "battery_capacity" ,
445+ total_input_power : "solar_power" ,
446+ input_1_power : "p1_power" ,
447+ input_2_power : "p2_power" ,
448+ total_output_power : "output_power" ,
449+ } ;
450+
441451 if ( this . config . device ) {
442452 return `sensor.${ this . config . device } _${ type } ` ;
443453 }
444- return this . config . entities ?. [ type ] || null ;
454+
455+ const externalType = mapping [ type ] ?? type ;
456+ return this . config . entities ?. [ externalType ] || null ;
445457 }
446458
447459 _toggleSwitch ( entityId , checked ) {
@@ -538,7 +550,7 @@ class B2500DCard extends LitElement {
538550 const switchEntity = this . _hass . states [ `switch.${ this . config . device } _adaptive_mode` ] ;
539551
540552
541- return html `
553+ return html `
542554 < div class ="container ">
543555 < div class ="device ">
544556 <!-- Header -->
@@ -562,7 +574,7 @@ class B2500DCard extends LitElement {
562574 < section class ="grid ">
563575 <!-- Solar -->
564576 ${ this . config . solar ? html `
565- < article class ="card solar ">
577+ < article class ="card solar " @click = ${ ( ) => this . _handleMoreInfo ( this . _getEntity ( "total_input_power" ) ) } >
566578 < div class ="title ">
567579 ${ localize ( "card.solar" , lang ) }
568580 < div class ="right-big "> ${ this . _solarPower } </ div > < div class ="big-num-unit "> W</ div >
@@ -586,7 +598,7 @@ class B2500DCard extends LitElement {
586598
587599 <!-- Output -->
588600 ${ this . config . output ? html `
589- < article class ="card ">
601+ < article class ="card " @click = ${ ( ) => this . _handleMoreInfo ( this . _getEntity ( "total_output_power" ) ) } >
590602 < div class ="title "> ${ localize ( "card.output" , lang ) } </ div >
591603 < div class ="subtitle "> ${ localize ( "card.realtime" , lang ) } </ div >
592604 < div class ="flex-wrapper ">
@@ -649,7 +661,7 @@ class B2500DCard extends LitElement {
649661
650662 <!-- Production -->
651663 ${ this . config . production ? html `
652- < article class ="card ">
664+ < article class ="card " @click = ${ ( ) => this . _handleMoreInfo ( this . _getEntity ( "daily_pv_charging" ) ) } >
653665 < div class ="title "> ${ localize ( "card.production" , lang ) } </ div >
654666 < div class ="subtitle "> ${ localize ( "card.today" , lang ) } </ div >
655667 < div class ="flex-wrapper "> < div class ="big-num "> ${ Number ( this . _productionToday ) . toFixed ( 2 ) } </ div > < div class ="big-num-unit "> kWh</ div > </ div >
0 commit comments