import { MQTTEntity } from './mqtt_base'; export class MqttLight extends MQTTEntity { pl_on: string = ''; pl_off: string = ''; val_tpl: string = ''; bri_cmd_t: string = 'brightness/command/topic'; _cmd_t: string = 'command/topic'; override readonly ent_type: string = 'light'; override attrs: Set = new Set([ 'name', 'uniq_id', 'stat_t', 'pl_on', 'pl_off', 'val_tpl', 'bri_cmd_t', 'cmd_t', ]); get cmd_t() { return this._cmd_t; } set cmd_t(data: string) { this._cmd_t = data; } override set name(data: string) { super.name = data; this.topic_updates.next('cmd_t'); this.topic_updates.next('bri_cmd_t'); } override get name() { return this._name; } override set uniq_id(data: string) { super.uniq_id = data; this.topic_updates.next('cmd_t'); this.topic_updates.next('bri_cmd_t'); } override get uniq_id() { return this._uniq_id; } override publish_topics(index: number = 1): string[] { return [ `String stat_topic_${index} = "${this.stat_t}";`, `String cmd_topic_${index} = "${this.cmd_t}";`, `String bri_cmd_topic_${index} = "${this.bri_cmd_t}";`, ]; } }