continue on heating controller
This commit is contained in:
parent
e3e8429108
commit
30097df6ef
4302
package-lock.json
generated
4302
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,9 @@ import { MatTabsModule } from '@angular/material/tabs';
|
|||||||
import { MatExpansionModule } from '@angular/material/expansion';
|
import { MatExpansionModule } from '@angular/material/expansion';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatDividerModule } from '@angular/material/divider';
|
import { MatDividerModule } from '@angular/material/divider';
|
||||||
|
import { MatInputModule } from '@angular/material/input'
|
||||||
import { MqttclientService } from './mqttclient.service'
|
import { MqttclientService } from './mqttclient.service'
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { LedindicatorComponent } from './ledindicator/ledindicator.component';
|
import { LedindicatorComponent } from './ledindicator/ledindicator.component';
|
||||||
@ -36,7 +37,9 @@ import { HeatingControllerComponent } from './heating-controller/heating-control
|
|||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
MatExpansionModule,
|
MatExpansionModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
MatDividerModule
|
MatDividerModule,
|
||||||
|
MatInputModule,
|
||||||
|
FormsModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
MqttclientService
|
MqttclientService
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core'
|
||||||
import { MqttclientService } from '../mqttclient.service'
|
import { MqttclientService } from '../mqttclient.service'
|
||||||
|
import {coerceNumberProperty} from '@angular/cdk/coercion'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'heatingcontroller',
|
selector: 'heatingcontroller',
|
||||||
@ -12,9 +13,16 @@ import { MqttclientService } from '../mqttclient.service'
|
|||||||
<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>
|
<button mat-mini-fab color="primary" (click)="clickForceOn()" [ngStyle]="{'font-size':'100%'}">forceOn</button>
|
||||||
<br/>
|
<br/>
|
||||||
<!-- <input type="text" [value]="currentTemperature"></input> -->
|
<mat-form-field [ngStyle]="{'margin':'10px', 'width':'80%'}">
|
||||||
<br/>
|
<input matInput type="number" placeholder="Current" [(ngModel)]="currentTemperature"
|
||||||
<!-- <input type="text" [value]="presetTemperature"></input> -->
|
(click)="setCurrentTemperature()" (keyup)="setCurrentTemperature()">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-form-field [ngStyle]="{'margin':'10px', 'width':'80%'}">
|
||||||
|
<input type="checkbox" [(ngModel)]="enablePresetTemperature">
|
||||||
|
<input matInput type="number" placeholder="Preset" [(ngModel)]="presetTemperature"
|
||||||
|
(click)="setPresetTemperature()" (keyup)="setPresetTemperature()"
|
||||||
|
[disabled]="! enablePresetTemperature">
|
||||||
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
|
|
||||||
@ -28,8 +36,9 @@ export class HeatingControllerComponent implements OnInit {
|
|||||||
feedbackTemperatureTopic : string = 'invalid'
|
feedbackTemperatureTopic : string = 'invalid'
|
||||||
@Input() label : string = 'invalid'
|
@Input() label : string = 'invalid'
|
||||||
|
|
||||||
currentTemperature : string
|
currentTemperature : number = 20
|
||||||
presetTemperature : string
|
enablePresetTemperature : boolean = false
|
||||||
|
presetTemperature : number = 20
|
||||||
|
|
||||||
constructor(private mqttclientService : MqttclientService) { }
|
constructor(private mqttclientService : MqttclientService) { }
|
||||||
|
|
||||||
@ -41,10 +50,10 @@ export class HeatingControllerComponent implements OnInit {
|
|||||||
this.feedbackTemperatureTopic = this.topicPre + '/temperature/feedback'
|
this.feedbackTemperatureTopic = this.topicPre + '/temperature/feedback'
|
||||||
|
|
||||||
this.mqttclientService.register(this.feedbackTemperatureTopic, (message: string) => {
|
this.mqttclientService.register(this.feedbackTemperatureTopic, (message: string) => {
|
||||||
this.currentTemperature = message
|
this.currentTemperature = parseInt(message)
|
||||||
})
|
})
|
||||||
this.mqttclientService.register(this.feedbackPresetTopic, (message: string) => {
|
this.mqttclientService.register(this.feedbackPresetTopic, (message: string) => {
|
||||||
this.presetTemperature = message
|
this.presetTemperature = parseInt(message)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,5 +72,12 @@ export class HeatingControllerComponent implements OnInit {
|
|||||||
this.mqttclientService.publish(this.commandTopic, "OFF")
|
this.mqttclientService.publish(this.commandTopic, "OFF")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCurrentTemperature() {
|
||||||
|
console.log(`click on currentTemperature ${this.currentTemperature}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
setPresetTemperature() {
|
||||||
|
console.log(`click on presetTemperature ${this.presetTemperature}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user