Skip to content

Commit 4b3a491

Browse files
Merge pull request #6 from volkmarnissen/modbuscache
[bug]Modbus Error Handling, Slave Specification Detection, TCP RTU bridge, Fixes
2 parents 3a75e75 + 0628956 commit 4b3a491

27 files changed

+879
-519
lines changed

.vscode/launch.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
87
{
98
"name": "ng serve",
109
"request": "launch",

CHANGELOG.md

Lines changed: 44 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +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-
- 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)
1010

11-
## [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)
1212

13-
[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)
1414

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

17-
- Please update me [\#4](https://github.com/modbus2mqtt/angular/pull/4) ([volkmarnissen](https://github.com/volkmarnissen))
18-
- Fixed package-lock.json [\#3](https://github.com/modbus2mqtt/angular/pull/3) ([volkmarnissen](https://github.com/volkmarnissen))
19-
- 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)
2018

21-
## [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)
2220

23-
[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)
2422

25-
## [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)
2624

27-
[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)
2826

29-
## [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)
3028

31-
[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)
3230

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

35-
- 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)
3634

37-
## [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)
3836

39-
[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)
4038

41-
## [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)
4240

43-
[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)
4442

45-
## [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)
4644

47-
[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)
4846

49-
## [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)
5048

51-
[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)
5250

53-
## [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)
5452

55-
[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)
5654

57-
## [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)
5856

59-
[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)
6058

61-
## [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)
6260

63-
[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)
6462

65-
## [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)
6664

67-
[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)
6866

69-
## [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)
7068

71-
[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)
7270

73-
## [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)
7472

75-
[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)
7674

77-
## [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)
7876

79-
[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)
8078

81-
## [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)
8280

83-
[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)
8482

85-
## [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)
8684

87-
[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)
8886

89-
## [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)
9088

91-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.3...v0.12.4)
92-
93-
## [v0.12.3](https://github.com/modbus2mqtt/angular/tree/v0.12.3) (2024-09-06)
94-
95-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.2...v0.12.3)
96-
97-
## [v0.12.2](https://github.com/modbus2mqtt/angular/tree/v0.12.2) (2024-08-27)
98-
99-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.0...v0.12.2)
100-
101-
## [v0.12.0](https://github.com/modbus2mqtt/angular/tree/v0.12.0) (2024-08-16)
102-
103-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.11.0...v0.12.0)
104-
105-
## [v0.11.0](https://github.com/modbus2mqtt/angular/tree/v0.11.0) (2024-08-05)
106-
107-
[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.10.1...v0.11.0)
108-
109-
## [v0.10.1](https://github.com/modbus2mqtt/angular/tree/v0.10.1) (2024-08-05)
110-
111-
[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)
11290

11391

11492

cypress/fixtures/bus.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"busId": 1,
3+
"connectionData": {
4+
"baudrate": 9600,
5+
"serialport": "/dev/ttytest",
6+
"timeout": 100
7+
}
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"mqttbasetopic": "modbus2mqtt",
3+
"rootUrl": "/",
4+
"mqttdiscoverylanguage": "en"
5+
}

cypress/fixtures/detection.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"filename": "dimplexpco5",
4+
"name": "Dimplex Heat Pump",
5+
"status": 0,
6+
"entities": [
7+
{
8+
"name": "entity1",
9+
"readonly": true,
10+
"mqttname": "e1"
11+
}
12+
],
13+
"identified": 1
14+
}
15+
]

cypress/fixtures/slave.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"slaveid": 1,
3+
"specificationid": "dimplexpco5",
4+
"name": "slavename",
5+
"pollInterval": 500,
6+
"pollMode": 1,
7+
"rootTopic": "heatpump",
8+
"modbusErrorsForSlave": []
9+
}

cypress/fixtures/slaves.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[
2+
{
3+
"slaveid": 1,
4+
"specificationid": "dimplexpco5",
5+
"name": "slavename",
6+
"pollInterval": 500,
7+
"pollMode": 1,
8+
"rootTopic": "heatpump",
9+
"modbusErrorsForSlave": []
10+
}
11+
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"filename": "dimplexpco5",
3+
"name": "Dimplex Heat Pump",
4+
"status": 0,
5+
"entities": [
6+
{
7+
"name": "entity1",
8+
"readonly": true,
9+
"mqttname": "e1"
10+
}
11+
],
12+
"i18n": [
13+
{ "lang": "en", "texts": [{ "textId": "name", "text": "Specname" }] }
14+
]
15+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[
2+
{
3+
"filename": "dimplexpco5",
4+
"name": "Dimplex Heat Pump",
5+
"status": 0,
6+
"entities": [
7+
{
8+
"id": 1,
9+
"name": "entity1",
10+
"readonly": true,
11+
"mqttname": "e1"
12+
}
13+
],
14+
"i18n": [
15+
{ "lang": "en", "texts": [{ "textId": "name", "text": "Specname" }] }
16+
]
17+
},
18+
{
19+
"filename": "additional",
20+
"name": "Additional",
21+
"status": 0,
22+
"entities": [
23+
{
24+
"id": 1,
25+
"name": "entity1",
26+
"readonly": true,
27+
"mqttname": "e1"
28+
}
29+
],
30+
"i18n": [
31+
{ "lang": "en", "texts": [{ "textId": "name", "text": "AdditionalTxt" }] }
32+
]
33+
},
34+
{
35+
"filename": "second",
36+
"name": "Second",
37+
"status": 0,
38+
"entities": [
39+
{
40+
"id": 1,
41+
"name": "second.entity1",
42+
"readonly": true,
43+
"mqttname": "se1"
44+
}
45+
],
46+
"i18n": [
47+
{ "lang": "en", "texts": [{ "textId": "name", "text": "Second" }] }
48+
]
49+
}
50+
]

cypress/modbus-error.cy.ts

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,60 +15,52 @@ import {
1515
} from "@modbus2mqtt/server.shared";
1616
import { ModbusRegisterType } from "@modbus2mqtt/specification.shared";
1717

18-
19-
let date = Date.now()
18+
let date = Date.now();
2019
let modbusErrors: ImodbusErrorsForSlave = {
2120
task: ModbusTasks.deviceDetection,
2221
date: date,
23-
address: { address:1,registerType:ModbusRegisterType.HoldingRegister},
24-
state:ModbusErrorStates.crc
25-
22+
address: { address: 1, registerType: ModbusRegisterType.HoldingRegister },
23+
state: ModbusErrorStates.crc,
2624
};
27-
function mount( currentDate:number){
28-
// This configures the rootUrl for /api... calls
29-
// they need to be relative in ingress scenarios,
30-
// but they must be absolute for cypress tests
31-
cy.window().then((win) => {
32-
(win as any).configuration = { rootUrl: "/" };
33-
});
34-
cy.mount(ModbusErrorComponent, {
35-
providers: [
36-
provideHttpClient(withInterceptorsFromDi()),
37-
provideRouter([]),
38-
],
39-
autoDetectChanges: true,
40-
componentProperties: {
41-
modbusErrors: [modbusErrors],
42-
currentDate: date + 30*1000
43-
},
44-
});
25+
function mount(currentDate: number) {
26+
// This configures the rootUrl for /api... calls
27+
// they need to be relative in ingress scenarios,
28+
// but they must be absolute for cypress tests
29+
cy.window().then((win) => {
30+
(win as any).configuration = { rootUrl: "/" };
31+
});
32+
cy.mount(ModbusErrorComponent, {
33+
providers: [provideHttpClient(withInterceptorsFromDi()), provideRouter([])],
34+
autoDetectChanges: true,
35+
componentProperties: {
36+
modbusErrors: [modbusErrors],
37+
currentDate: date + 30 * 1000,
38+
},
39+
});
4540

46-
// This configures the rootUrl for /api... calls
47-
// they need to be relative in ingress scenarios,
48-
// but they must be absolute for cypress tests
49-
cy.window().then((win) => {
50-
(win as any).configuration = { rootUrl: "/" };
51-
});
52-
cy.mount(ModbusErrorComponent, {
53-
providers: [
54-
provideHttpClient(withInterceptorsFromDi()),
55-
provideRouter([]),
56-
],
57-
autoDetectChanges: true,
58-
componentProperties: {
59-
modbusErrors: [modbusErrors],
60-
currentDate: currentDate
61-
},
62-
});
41+
// This configures the rootUrl for /api... calls
42+
// they need to be relative in ingress scenarios,
43+
// but they must be absolute for cypress tests
44+
cy.window().then((win) => {
45+
(win as any).configuration = { rootUrl: "/" };
46+
});
47+
cy.mount(ModbusErrorComponent, {
48+
providers: [provideHttpClient(withInterceptorsFromDi()), provideRouter([])],
49+
autoDetectChanges: true,
50+
componentProperties: {
51+
modbusErrors: [modbusErrors],
52+
currentDate: currentDate,
53+
},
54+
});
6355
}
6456
describe("Modbus Error Component tests", () => {
6557
it("can mount 30 seconds after last error", () => {
66-
mount(date + 30*1000)
67-
cy.get('mat-panel-description:first').should('contain', '30 seconds ago')
58+
mount(date + 30 * 1000);
59+
cy.get("mat-panel-description:first").should("contain", "30 seconds ago");
6860
});
69-
61+
7062
it("can mount 90 seconds after last error", () => {
71-
mount(date + 90*1000)
72-
cy.get('mat-panel-description:first').should('contain', '1:30 minutes ago')
63+
mount(date + 90 * 1000);
64+
cy.get("mat-panel-description:first").should("contain", "1:30 minutes ago");
7365
});
7466
});

0 commit comments

Comments
 (0)