heating stuff
This commit is contained in:
@ -27,7 +27,7 @@
|
|||||||
<p class="clear"></p>
|
<p class="clear"></p>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Heizung">
|
<mat-tab label="Heizung">
|
||||||
<heatingcontroller></heatingcontroller>
|
<heatingcontroller topicPre="testTopic" label="testLabel"></heatingcontroller>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
|
|
||||||
|
@ -9,36 +9,58 @@ import { MqttclientService } from '../mqttclient.service'
|
|||||||
'font-family': 'sans-serif' }">
|
'font-family': 'sans-serif' }">
|
||||||
{{label}}<br/>
|
{{label}}<br/>
|
||||||
<button mat-mini-fab color="primary" (click)="clickOff()" [ngStyle]="{'font-size':'100%'}">off</button>
|
<button mat-mini-fab color="primary" (click)="clickOff()" [ngStyle]="{'font-size':'100%'}">off</button>
|
||||||
<button mat-mini-fab color="primary" (click)="clickAbsent()" [ngStyle]="{'font-size':'100%'}">absent</button>
|
|
||||||
<button mat-mini-fab color="primary" (click)="clickOn()" [ngStyle]="{'font-size':'100%'}">on</button>
|
<button mat-mini-fab color="primary" (click)="clickOn()" [ngStyle]="{'font-size':'100%'}">on</button>
|
||||||
|
<button mat-mini-fab color="primary" (click)="clickForceOn()" [ngStyle]="{'font-size':'100%'}">forceOn</button>
|
||||||
<br/>
|
<br/>
|
||||||
|
<!-- <input type="text" [value]="currentTemperature"></input> -->
|
||||||
|
<br/>
|
||||||
|
<!-- <input type="text" [value]="presetTemperature"></input> -->
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
|
|
||||||
})
|
})
|
||||||
export class HeatingControllerComponent implements OnInit {
|
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'
|
@Input() label : string = 'invalid'
|
||||||
|
|
||||||
|
currentTemperature : string
|
||||||
|
presetTemperature : string
|
||||||
|
|
||||||
constructor(private mqttclientService : MqttclientService) { }
|
constructor(private mqttclientService : MqttclientService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
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() {
|
clickOn() {
|
||||||
console.log(`click on for ${this.topic}`)
|
console.log(`click on for ${this.commandTopic}`)
|
||||||
this.mqttclientService.publish(this.topic, "ON")
|
this.mqttclientService.publish(this.commandTopic, "ON")
|
||||||
}
|
}
|
||||||
|
|
||||||
clickAbsent() {
|
clickForceOn() {
|
||||||
console.log(`click absent for ${this.topic}`)
|
console.log(`click absent for ${this.commandTopic}`)
|
||||||
this.mqttclientService.publish(this.topic, "ABSENT")
|
this.mqttclientService.publish(this.commandTopic, "FORCE_ON")
|
||||||
}
|
}
|
||||||
|
|
||||||
clickOff() {
|
clickOff() {
|
||||||
console.log(`click off for ${this.topic}`)
|
console.log(`click off for ${this.commandTopic}`)
|
||||||
this.mqttclientService.publish(this.topic, "OFF")
|
this.mqttclientService.publish(this.commandTopic, "OFF")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user