@@ -229,6 +229,7 @@ export class EntityComponent
229229 entityCategory : [ "" ] ,
230230 icon : [ null as string | null ] ,
231231 forceUpdate : [ false ] ,
232+ value_template : [ null as string | null ] ,
232233 } ) ;
233234 this . variableFormGroup = this . fb . group ( {
234235 variableType : [ null as VariableTargetParameters | null ] ,
@@ -397,6 +398,7 @@ export class EntityComponent
397398
398399 this . entityFormGroup . get ( "icon" ) ! . setValue ( entity . icon ) ;
399400 this . entityFormGroup . get ( "forceUpdate" ) ! . setValue ( entity . forceUpdate ) ;
401+ this . entityFormGroup . get ( "value_template" ) ! . setValue ( entity . value_template ) ;
400402 this . entityFormGroup . get ( "entityCategory" ) ! . setValue ( entity . entityCategory ) ;
401403 this . entityFormGroup . get ( "readonly" ) ! . setValue ( entity . readonly ) ;
402404 this . entityFormGroup
@@ -535,6 +537,9 @@ export class EntityComponent
535537 return ( this . entity . converterParameters as Iselect ) . options ! ;
536538 return [ ] ;
537539 }
540+ getValueTemplate ( ) :string {
541+ return this . entity . value_template ? this . entity . value_template : "{{ value_json." + this . entity . mqttname + "}}"
542+ }
538543 isTouched ( ) : boolean {
539544 if ( ! this . entityFormGroup . pristine ) return true ;
540545 if ( ! this . variableFormGroup ! . pristine ) return true ;
@@ -672,6 +677,8 @@ export class EntityComponent
672677 this . entity . icon = this . entityFormGroup . get ( "icon" ) ! . value ;
673678 if ( this . entityFormGroup . get ( "forceUpdate" ) ! . value != null )
674679 this . entity . forceUpdate = this . entityFormGroup . get ( "forceUpdate" ) ! . value ;
680+ if ( this . entityFormGroup . get ( "value_template" ) ! . value != null )
681+ this . entity . value_template = this . entityFormGroup . get ( "value_template" ) ! . value ;
675682 if ( this . entityFormGroup . get ( "readonly" ) ! . value != null )
676683 this . entity . readonly = this . entityFormGroup . get ( "readonly" ) ! . value ;
677684 if (
0 commit comments