diff --git a/src/app/app.component.html b/src/app/app.component.html
index 2ee0a3e..2926ff0 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -27,7 +27,7 @@
-
+
diff --git a/src/app/heating-controller/heating-controller.component.ts b/src/app/heating-controller/heating-controller.component.ts
index c947638..933742e 100644
--- a/src/app/heating-controller/heating-controller.component.ts
+++ b/src/app/heating-controller/heating-controller.component.ts
@@ -9,36 +9,58 @@ import { MqttclientService } from '../mqttclient.service'
'font-family': 'sans-serif' }">
{{label}}
-
+
-
+
+
+
`
})
export class HeatingControllerComponent implements OnInit {
- @Input() topic : string = 'invalid'
+ @Input() topicPre : string = 'invalid'
+ commandTopic : string = 'invalid'
+ presetTopic : string = 'invalid'
+ feedbackPresetTopic : string = 'invalid'
+ temperatureTopic : string = 'invalid'
+ feedbackTemperatureTopic : string = 'invalid'
@Input() label : string = 'invalid'
+
+ currentTemperature : string
+ presetTemperature : string
constructor(private mqttclientService : MqttclientService) { }
ngOnInit() {
+ this.commandTopic = this.topicPre + '/command'
+ this.presetTopic = this.topicPre + '/presetTemperature'
+ this.feedbackPresetTopic = this.topicPre + '/presetTemperature/feedback'
+ this.temperatureTopic = this.topicPre + '/temperature'
+ this.feedbackTemperatureTopic = this.topicPre + '/temperature/feedback'
+
+ this.mqttclientService.register(this.feedbackTemperatureTopic, (message: string) => {
+ this.currentTemperature = message
+ })
+ this.mqttclientService.register(this.feedbackPresetTopic, (message: string) => {
+ this.presetTemperature = message
+ })
}
clickOn() {
- console.log(`click on for ${this.topic}`)
- this.mqttclientService.publish(this.topic, "ON")
+ console.log(`click on for ${this.commandTopic}`)
+ this.mqttclientService.publish(this.commandTopic, "ON")
}
- clickAbsent() {
- console.log(`click absent for ${this.topic}`)
- this.mqttclientService.publish(this.topic, "ABSENT")
+ clickForceOn() {
+ console.log(`click absent for ${this.commandTopic}`)
+ this.mqttclientService.publish(this.commandTopic, "FORCE_ON")
}
clickOff() {
- console.log(`click off for ${this.topic}`)
- this.mqttclientService.publish(this.topic, "OFF")
+ console.log(`click off for ${this.commandTopic}`)
+ this.mqttclientService.publish(this.commandTopic, "OFF")
}
}