CHNAGE: discovery values not don't auto update
All checks were successful
mqtt_creator/pipeline/head This commit looks good
All checks were successful
mqtt_creator/pipeline/head This commit looks good
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
</div>
|
||||
<div class="col-span-2 property" >
|
||||
<p>Discovery Topic</p>
|
||||
<input type="text" readonly value="{{discoveryTopic}}">
|
||||
<input type="text" readonly [ngModel]="_discoveryTopic">
|
||||
</div>
|
||||
</ng-container>
|
||||
</main>
|
||||
@@ -24,6 +24,7 @@ export class EntityComponent {
|
||||
readonly useRandomString = randomString;
|
||||
|
||||
showDiscovery: boolean = false;
|
||||
_discoveryTopic: string = '';
|
||||
|
||||
@Input() entity_type: number = 0;
|
||||
@Input() stat_t: string = '';
|
||||
@@ -133,7 +134,6 @@ export class EntityComponent {
|
||||
|
||||
create_entity() {
|
||||
this.basemodel?.setProperty('stat_t', this.stat_t);
|
||||
|
||||
this.basemodel?.setProperty('name', this.entity_name);
|
||||
this.basemodel?.setProperty('cmd_t', this.entity_cmd_t);
|
||||
this.basemodel?.setProperty('bri_cmd_t', this.entity_bri_cmd_t);
|
||||
@@ -142,36 +142,27 @@ export class EntityComponent {
|
||||
this.basemodel?.setProperty('unit_of_meas', this.entity_unit_of_meas);
|
||||
this.basemodel?.setProperty('val_tpl', this.entity_val_tpl);
|
||||
this.basemodel?.setProperty('dev_cla', this.entity_dev_cla);
|
||||
this._discoveryTopic = this.discoveryTopic;
|
||||
this.showDiscovery = true;
|
||||
return;
|
||||
}
|
||||
|
||||
get discoveryString() {
|
||||
// this.basemodel?.createString();
|
||||
return this.basemodel?.toJSON();
|
||||
// let discString = this.basemodel?.toJ();
|
||||
// if (discString == '' || discString == undefined) return '';
|
||||
}
|
||||
|
||||
get JSONdiscoveryString() {
|
||||
return JSON.stringify(this.basemodel?.toJSON()).replaceAll('"', '\\"');
|
||||
// let discString = this.basemodel?.createString();
|
||||
// if (discString == '' || discString == undefined) return '';
|
||||
// discString = discString.replaceAll('"', '\\"');
|
||||
}
|
||||
|
||||
get discoveryTopic() {
|
||||
if (this.entity_type == 0) return '';
|
||||
if (this.entity_name == '') return '';
|
||||
let discTopic =
|
||||
'homeassistant/' +
|
||||
entity_types[this.entity_type][0] +
|
||||
'/' +
|
||||
this.entity_name +
|
||||
'_' +
|
||||
this.entity_uniq_id +
|
||||
'/config';
|
||||
return discTopic;
|
||||
return join(
|
||||
'/',
|
||||
'homeassistant',
|
||||
entity_types[this.entity_type][0],
|
||||
this.display_name
|
||||
).toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user