Skip to content

Commit 69b6b47

Browse files
authored
Merge pull request #9 from volkmarnissen/modbuscache
[bug]Modbus Error Handling, Slave Specification Detection, TCP RTU bridge, Fixes
2 parents 5ce2cb4 + 74b56c1 commit 69b6b47

File tree

4 files changed

+67
-98
lines changed

4 files changed

+67
-98
lines changed

CHANGELOG.md

Lines changed: 44 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,92 @@
11
# Changelog for angular
22

3-
## [Unreleased](https://github.com/modbus2mqtt/angular/tree/HEAD)
3+
## [v0.12.19](https://github.com/volkmarnissen/angular/tree/v0.12.19) (2025-01-16)
44

5-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.20...HEAD)
5+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.18...v0.12.19)
66

7-
**Merged pull requests:**
7+
## [v0.12.18](https://github.com/volkmarnissen/angular/tree/v0.12.18) (2025-01-15)
88

9-
- \[bug\]Modbus Error Handling, Slave Specification Detection, TCP RTU bridge, Fixes [\#8](https://github.com/modbus2mqtt/angular/pull/8) ([volkmarnissen](https://github.com/volkmarnissen))
10-
- Angular TcpBridge Fix [\#7](https://github.com/modbus2mqtt/angular/pull/7) ([volkmarnissen](https://github.com/volkmarnissen))
11-
- \[bug\]Modbus Error Handling, Slave Specification Detection, TCP RTU bridge, Fixes [\#6](https://github.com/modbus2mqtt/angular/pull/6) ([volkmarnissen](https://github.com/volkmarnissen))
12-
- Modbus Error Handling and Monitoring [\#5](https://github.com/modbus2mqtt/angular/pull/5) ([volkmarnissen](https://github.com/volkmarnissen))
9+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.17...v0.12.18)
1310

14-
## [v0.12.20](https://github.com/modbus2mqtt/angular/tree/v0.12.20) (2025-04-14)
11+
## [v0.12.17](https://github.com/volkmarnissen/angular/tree/v0.12.17) (2025-01-02)
1512

16-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.19...v0.12.20)
13+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.16...v0.12.17)
1714

18-
**Merged pull requests:**
15+
## [v0.12.16](https://github.com/volkmarnissen/angular/tree/v0.12.16) (2024-12-31)
1916

20-
- Please update me [\#4](https://github.com/modbus2mqtt/angular/pull/4) ([volkmarnissen](https://github.com/volkmarnissen))
21-
- Fixed package-lock.json [\#3](https://github.com/modbus2mqtt/angular/pull/3) ([volkmarnissen](https://github.com/volkmarnissen))
22-
- Adding support for discrete inputs [\#2](https://github.com/modbus2mqtt/angular/pull/2) ([arturmietek](https://github.com/arturmietek))
17+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.15...v0.12.16)
2318

24-
## [v0.12.19](https://github.com/modbus2mqtt/angular/tree/v0.12.19) (2025-01-16)
19+
## [v0.12.15](https://github.com/volkmarnissen/angular/tree/v0.12.15) (2024-12-30)
2520

26-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.18...v0.12.19)
21+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.14...v0.12.15)
2722

28-
## [v0.12.18](https://github.com/modbus2mqtt/angular/tree/v0.12.18) (2025-01-15)
23+
## [v0.12.14](https://github.com/volkmarnissen/angular/tree/v0.12.14) (2024-12-30)
2924

30-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.17...v0.12.18)
25+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/0.12.14...v0.12.14)
3126

32-
## [v0.12.17](https://github.com/modbus2mqtt/angular/tree/v0.12.17) (2025-01-02)
27+
## [0.12.14](https://github.com/volkmarnissen/angular/tree/0.12.14) (2024-12-13)
3328

34-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.16...v0.12.17)
29+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.13...0.12.14)
3530

36-
**Merged pull requests:**
31+
## [v0.12.13](https://github.com/volkmarnissen/angular/tree/v0.12.13) (2024-12-13)
3732

38-
- Adding signed int 32 and unsigned int 32 options to number format [\#1](https://github.com/modbus2mqtt/angular/pull/1) ([arturmietek](https://github.com/arturmietek))
33+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.12...v0.12.13)
3934

40-
## [v0.12.16](https://github.com/modbus2mqtt/angular/tree/v0.12.16) (2024-12-31)
35+
## [v0.12.12](https://github.com/volkmarnissen/angular/tree/v0.12.12) (2024-12-11)
4136

42-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.15...v0.12.16)
37+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.11...v0.12.12)
4338

44-
## [v0.12.15](https://github.com/modbus2mqtt/angular/tree/v0.12.15) (2024-12-30)
39+
## [v0.12.11](https://github.com/volkmarnissen/angular/tree/v0.12.11) (2024-11-22)
4540

46-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.14...v0.12.15)
41+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.10...v0.12.11)
4742

48-
## [v0.12.14](https://github.com/modbus2mqtt/angular/tree/v0.12.14) (2024-12-30)
43+
## [v0.12.10](https://github.com/volkmarnissen/angular/tree/v0.12.10) (2024-11-19)
4944

50-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/0.12.14...v0.12.14)
45+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.9...v0.12.10)
5146

52-
## [0.12.14](https://github.com/modbus2mqtt/angular/tree/0.12.14) (2024-12-13)
47+
## [v0.12.9](https://github.com/volkmarnissen/angular/tree/v0.12.9) (2024-11-16)
5348

54-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.13...0.12.14)
49+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.8...v0.12.9)
5550

56-
## [v0.12.13](https://github.com/modbus2mqtt/angular/tree/v0.12.13) (2024-12-13)
51+
## [v0.12.8](https://github.com/volkmarnissen/angular/tree/v0.12.8) (2024-11-14)
5752

58-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.12...v0.12.13)
53+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.7...v0.12.8)
5954

60-
## [v0.12.12](https://github.com/modbus2mqtt/angular/tree/v0.12.12) (2024-12-11)
55+
## [v0.12.7](https://github.com/volkmarnissen/angular/tree/v0.12.7) (2024-10-23)
6156

62-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.11...v0.12.12)
57+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.6...v0.12.7)
6358

64-
## [v0.12.11](https://github.com/modbus2mqtt/angular/tree/v0.12.11) (2024-11-22)
59+
## [v0.12.6](https://github.com/volkmarnissen/angular/tree/v0.12.6) (2024-10-16)
6560

66-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.10...v0.12.11)
61+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.5...v0.12.6)
6762

68-
## [v0.12.10](https://github.com/modbus2mqtt/angular/tree/v0.12.10) (2024-11-19)
63+
## [v0.12.5](https://github.com/volkmarnissen/angular/tree/v0.12.5) (2024-09-24)
6964

70-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.9...v0.12.10)
65+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.4...v0.12.5)
7166

72-
## [v0.12.9](https://github.com/modbus2mqtt/angular/tree/v0.12.9) (2024-11-16)
67+
## [v0.12.4](https://github.com/volkmarnissen/angular/tree/v0.12.4) (2024-09-16)
7368

74-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.8...v0.12.9)
69+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.3...v0.12.4)
7570

76-
## [v0.12.8](https://github.com/modbus2mqtt/angular/tree/v0.12.8) (2024-11-14)
71+
## [v0.12.3](https://github.com/volkmarnissen/angular/tree/v0.12.3) (2024-09-06)
7772

78-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.7...v0.12.8)
73+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.2...v0.12.3)
7974

80-
## [v0.12.7](https://github.com/modbus2mqtt/angular/tree/v0.12.7) (2024-10-23)
75+
## [v0.12.2](https://github.com/volkmarnissen/angular/tree/v0.12.2) (2024-08-27)
8176

82-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.6...v0.12.7)
77+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.0...v0.12.2)
8378

84-
## [v0.12.6](https://github.com/modbus2mqtt/angular/tree/v0.12.6) (2024-10-16)
79+
## [v0.12.0](https://github.com/volkmarnissen/angular/tree/v0.12.0) (2024-08-16)
8580

86-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.5...v0.12.6)
81+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.11.0...v0.12.0)
8782

88-
## [v0.12.5](https://github.com/modbus2mqtt/angular/tree/v0.12.5) (2024-09-24)
83+
## [v0.11.0](https://github.com/volkmarnissen/angular/tree/v0.11.0) (2024-08-05)
8984

90-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.4...v0.12.5)
85+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.10.1...v0.11.0)
9186

92-
## [v0.12.4](https://github.com/modbus2mqtt/angular/tree/v0.12.4) (2024-09-16)
87+
## [v0.10.1](https://github.com/volkmarnissen/angular/tree/v0.10.1) (2024-08-05)
9388

94-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.3...v0.12.4)
95-
96-
## [v0.12.3](https://github.com/modbus2mqtt/angular/tree/v0.12.3) (2024-09-06)
97-
98-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.2...v0.12.3)
99-
100-
## [v0.12.2](https://github.com/modbus2mqtt/angular/tree/v0.12.2) (2024-08-27)
101-
102-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.0...v0.12.2)
103-
104-
## [v0.12.0](https://github.com/modbus2mqtt/angular/tree/v0.12.0) (2024-08-16)
105-
106-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.11.0...v0.12.0)
107-
108-
## [v0.11.0](https://github.com/modbus2mqtt/angular/tree/v0.11.0) (2024-08-05)
109-
110-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.10.1...v0.11.0)
111-
112-
## [v0.10.1](https://github.com/modbus2mqtt/angular/tree/v0.10.1) (2024-08-05)
113-
114-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/0b2169b1bceece9fa4c2c6940ef33dafe96ae43b...v0.10.1)
89+
[Full Changelog](https://github.com/volkmarnissen/angular/compare/0b2169b1bceece9fa4c2c6940ef33dafe96ae43b...v0.10.1)
11590

11691

11792

src/app/select-slave/select-slave.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<mat-select matInput formControlName="specificationid" (selectionChange)="onSpecificationChange(uislave)"
4949
[compareWith]="compareSpecificationIdentification">
5050
<ng-container *ngIf="uislave.specsObservable|async as identSpecs;else undetectedTemplate">
51-
<ng-container *ngFor="let i = index; let ispec of identSpecs">
51+
<ng-container *ngFor="let ispec of identSpecs">
5252
<mat-option [value]="ispec">
5353
<mat-icon
5454
[matTooltip]="statusTooltip(ispec?ispec.status:3)">{{statusIcon(ispec?ispec.status:3)}}</mat-icon>
@@ -59,7 +59,7 @@
5959
</ng-container>
6060
</ng-container>
6161
<ng-template #undetectedTemplate >
62-
<ng-container *ngFor="let i = index; let ispec of preparedSpecs">
62+
<ng-container *ngFor="let ispec of preparedIdentSpecs">
6363
<mat-option [value]="ispec">
6464
<mat-icon
6565
[matTooltip]="statusTooltip(ispec?ispec.status:3)">{{statusIcon(ispec?ispec.status:3)}}</mat-icon>

src/app/select-slave/select-slave.component.ts

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ interface IuiSlave {
120120
MatExpansionPanelTitle,
121121
MatInput,
122122
MatError,
123-
AsyncPipe,
123+
AsyncPipe
124124
],
125125
})
126126
export class SelectSlaveComponent extends SessionStorage implements OnInit {
@@ -177,26 +177,14 @@ export class SelectSlaveComponent extends SessionStorage implements OnInit {
177177
this.currentLanguage = getCurrentLanguage(navigator.language);
178178
this.entityApiService.getSpecifications().subscribe((specs) => {
179179
this.preparedSpecs = specs;
180-
specs.forEach((spec) => {
181-
let name = getSpecificationI18nName(spec, this.currentLanguage);
182-
183-
let entities: IidentEntity[] = spec.entities.map((e) => {
184-
return {
185-
id: e.id,
186-
name: e.name,
187-
readonly: e.readonly,
188-
mqttname: e.mqttname,
189-
};
190-
});
191-
if (name == undefined) name = "unknown";
192-
});
193180
});
194181
this.paramsSubscription = this.route.params.subscribe((params) => {
195182
let busId = +params["busid"];
196183
this.entityApiService.getBus(busId).subscribe((bus) => {
197184
this.bus = bus;
198185
if (this.bus) {
199186
this.busname = getConnectionName(this.bus.connectionData);
187+
this.getIdentSpecs(undefined).then((identSpecs)=>{this.preparedIdentSpecs = identSpecs})
200188
this.updateSlaves();
201189
}
202190
});
@@ -345,8 +333,8 @@ export class SelectSlaveComponent extends SessionStorage implements OnInit {
345333
);
346334
return rc
347335
}
348-
getSpecsForConfiguredSlave(uiSlave:IuiSlave):Observable<IidentificationSpecification[]>{
349-
let rc= new Subject<IidentificationSpecification[]>()
336+
getIdentSpecs(uiSlave:IuiSlave| undefined ):Promise<IidentificationSpecification[]>{
337+
return new Promise<IidentificationSpecification[]>((resolve, reject)=>{
350338
let fct = ( specModbus:ImodbusSpecification| undefined )=>{
351339
let rci:IidentificationSpecification[]=[]
352340
this.preparedSpecs.forEach(spec=>{
@@ -356,15 +344,17 @@ export class SelectSlaveComponent extends SessionStorage implements OnInit {
356344
identified: specModbus && spec.filename== specModbus.filename?specModbus.identified:IdentifiedStates.unknown,
357345
filename: spec.filename,
358346
} as IidentificationSpecification);
359-
rc.next(rci)
360347
})
348+
resolve(rci)
361349
}
362-
if( uiSlave.slave.specificationid )
363-
this.entityApiService.getModbusSpecification(this.bus.busId,uiSlave.slave.slaveid,uiSlave.slave.specificationid, true).subscribe(fct)
350+
if( uiSlave && uiSlave.slave.specificationid )
351+
this.entityApiService.getModbusSpecification(this.bus.busId,uiSlave.slave.slaveid,uiSlave.slave.specificationid, false).subscribe((spec)=>{
352+
console.log("DSSSS")
353+
fct(spec)
354+
})
364355
else
365356
fct(undefined )
366-
367-
return rc;
357+
})
368358
}
369359
getUiSlave(slave: Islave, detectSpec: boolean | undefined): IuiSlave {
370360
let fg = this.initiateSlaveControl(slave, null);
@@ -373,8 +363,9 @@ export class SelectSlaveComponent extends SessionStorage implements OnInit {
373363
label: this.getSlaveName(slave),
374364
slaveForm: fg,
375365
} as any;
376-
377-
rc.specsObservable = this.getSpecsForConfiguredSlave(rc) // getDetectedSpecs is disabled, because of performance issues
366+
let sub = new Subject<IidentificationSpecification[]>()
367+
rc.specsObservable = sub
368+
this.getIdentSpecs(rc).then((identSpecs)=>{ sub.next(identSpecs)}).catch(e=>{ console.log(e.message)}) // getDetectedSpecs is disabled, because of performance issues
378369
this.addSpecificationToUiSlave(rc);
379370
(rc.selectedEntitites = this.getSelectedEntites(slave)),
380371
this.fillCommandTopics(rc);
@@ -592,10 +583,13 @@ export class SelectSlaveComponent extends SessionStorage implements OnInit {
592583
// Initialization of the UI
593584
// replacing this.uiSlaves with newUiSlaves will initialize and show it
594585
// Now, the new value needs to be marked as touched to enable cancel and save.
595-
let specCtrl = newUiSlave.slaveForm.get("specificationid");
586+
if( detectSpec){
587+
let specCtrl = newUiSlave.slaveForm.get("specificationid");
588+
589+
if (specCtrl && specCtrl.value != undefined)
590+
newUiSlave.slaveForm.markAllAsTouched();
596591

597-
if (specCtrl && specCtrl.value != undefined)
598-
newUiSlave.slaveForm.markAllAsTouched();
592+
}
599593
});
600594
}
601595
private static form2SlaveSetValue(uiSlave: IuiSlave, controlname: string) {

src/app/specification/entity/entity.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ export class EntityComponent
439439
this.entityFormGroup.get("readonly")!.setValue(entity.readonly);
440440
}
441441

442-
this.entityFormGroup.get("registerType")!.setValue(entity.registerType);
442+
this.entityFormGroup.get("registerType")!.setValue( { registerType: entity.registerType, name: "unknown"});
443443
converterFormControl.setValue(entity.converter);
444444
modbusAddressFormControl.setValue(
445445
entity.modbusAddress != undefined ? entity.modbusAddress : null,

0 commit comments

Comments
 (0)