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>
|
||||||
<div class="col-span-2 property" >
|
<div class="col-span-2 property" >
|
||||||
<p>Discovery Topic</p>
|
<p>Discovery Topic</p>
|
||||||
<input type="text" readonly value="{{discoveryTopic}}">
|
<input type="text" readonly [ngModel]="_discoveryTopic">
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</main>
|
</main>
|
||||||
@@ -24,6 +24,7 @@ export class EntityComponent {
|
|||||||
readonly useRandomString = randomString;
|
readonly useRandomString = randomString;
|
||||||
|
|
||||||
showDiscovery: boolean = false;
|
showDiscovery: boolean = false;
|
||||||
|
_discoveryTopic: string = '';
|
||||||
|
|
||||||
@Input() entity_type: number = 0;
|
@Input() entity_type: number = 0;
|
||||||
@Input() stat_t: string = '';
|
@Input() stat_t: string = '';
|
||||||
@@ -133,7 +134,6 @@ export class EntityComponent {
|
|||||||
|
|
||||||
create_entity() {
|
create_entity() {
|
||||||
this.basemodel?.setProperty('stat_t', this.stat_t);
|
this.basemodel?.setProperty('stat_t', this.stat_t);
|
||||||
|
|
||||||
this.basemodel?.setProperty('name', this.entity_name);
|
this.basemodel?.setProperty('name', this.entity_name);
|
||||||
this.basemodel?.setProperty('cmd_t', this.entity_cmd_t);
|
this.basemodel?.setProperty('cmd_t', this.entity_cmd_t);
|
||||||
this.basemodel?.setProperty('bri_cmd_t', this.entity_bri_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('unit_of_meas', this.entity_unit_of_meas);
|
||||||
this.basemodel?.setProperty('val_tpl', this.entity_val_tpl);
|
this.basemodel?.setProperty('val_tpl', this.entity_val_tpl);
|
||||||
this.basemodel?.setProperty('dev_cla', this.entity_dev_cla);
|
this.basemodel?.setProperty('dev_cla', this.entity_dev_cla);
|
||||||
|
this._discoveryTopic = this.discoveryTopic;
|
||||||
this.showDiscovery = true;
|
this.showDiscovery = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
get discoveryString() {
|
get discoveryString() {
|
||||||
// this.basemodel?.createString();
|
|
||||||
return this.basemodel?.toJSON();
|
return this.basemodel?.toJSON();
|
||||||
// let discString = this.basemodel?.toJ();
|
|
||||||
// if (discString == '' || discString == undefined) return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get JSONdiscoveryString() {
|
get JSONdiscoveryString() {
|
||||||
return JSON.stringify(this.basemodel?.toJSON()).replaceAll('"', '\\"');
|
return JSON.stringify(this.basemodel?.toJSON()).replaceAll('"', '\\"');
|
||||||
// let discString = this.basemodel?.createString();
|
|
||||||
// if (discString == '' || discString == undefined) return '';
|
|
||||||
// discString = discString.replaceAll('"', '\\"');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get discoveryTopic() {
|
get discoveryTopic() {
|
||||||
if (this.entity_type == 0) return '';
|
if (this.entity_type == 0) return '';
|
||||||
if (this.entity_name == '') return '';
|
return join(
|
||||||
let discTopic =
|
'/',
|
||||||
'homeassistant/' +
|
'homeassistant',
|
||||||
entity_types[this.entity_type][0] +
|
entity_types[this.entity_type][0],
|
||||||
'/' +
|
this.display_name
|
||||||
this.entity_name +
|
).toLowerCase();
|
||||||
'_' +
|
|
||||||
this.entity_uniq_id +
|
|
||||||
'/config';
|
|
||||||
return discTopic;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user