Skip to content

Commit 570fe03

Browse files
committed
.
1 parent dec70aa commit 570fe03

File tree

5 files changed

+29
-6
lines changed

5 files changed

+29
-6
lines changed

nodes/knxUltimateGlobalContext.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ module.exports = function (RED) {
2424
// address,
2525
// dpt,
2626
// payload
27+
// lastupdate
28+
// lastupdateLocale
2729
// }
2830

2931
function knxUltimateGlobalContext(config) {
@@ -72,7 +74,7 @@ module.exports = function (RED) {
7274
if (node.exposeAsVariable !== 'exposeAsVariableNO') {
7375
try {
7476
node.serverKNX.csv.forEach(element => {
75-
node.exposedGAs.push({ address: element.ga, dpt: element.dpt, devicename: element.devicename, payload: undefined })
77+
node.exposedGAs.push({ address: element.ga, dpt: element.dpt, devicename: element.devicename, payload: undefined, lastupdate: undefined, lastupdateLocale: undefined })
7678
})
7779
} catch (error) {
7880
}
@@ -141,11 +143,16 @@ module.exports = function (RED) {
141143
} catch (error) {
142144
console.log(error)
143145
}
146+
const dNow = new Date()
147+
const lastupdate = dNow.toISOString()
148+
const lastupdateLocale = dNow.toLocaleString()
144149
if (oGa === undefined) {
145-
node.exposedGAs.push({ address: msg.knx.destination, devicename: undefined, dpt: msg.knx.dpt, payload: msg.payload })
150+
node.exposedGAs.push({ address: msg.knx.destination, devicename: undefined, dpt: msg.knx.dpt, payload: msg.payload, lastupdate, lastupdateLocale })
146151
} else {
147152
oGa.dpt = msg.knx.dpt
148153
oGa.payload = msg.payload
154+
oGa.lastupdate = lastupdate
155+
oGa.lastupdateLocale = lastupdateLocale
149156
}
150157
// Save into the global Context
151158
try {

nodes/locales/de-DE/knxUltimateGlobalContext.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@
3030
address: "0/0/1",
3131
dpt: "1.001",
3232
payload: true,
33-
devicename: "Dinning Room->Table Light"
33+
devicename: "Dinning Room->Table Light",
34+
lastupdate: "2024-07-10T18:30:25.123Z",
35+
lastupdateLocale: "10.07.2024, 20:30:25"
3436
}
3537
```
3638
39+
`lastupdate` kommt im ISO-8601-Format, `lastupdateLocale` enthält die lokal formatierte Zeitangabe.
40+
3741
## Schnelle Nutzung
3842
3943
### Variable lesen

nodes/locales/en-US/knxUltimateGlobalContext.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@
3232
address : "0/0/1",
3333
dpt: "1.001",
3434
payload: true,
35-
devicename:"Dinning Room->Table Light"
35+
devicename:"Dinning Room->Table Light",
36+
lastupdate:"2024-07-10T18:30:25.123Z",
37+
lastupdateLocale:"7/10/2024, 8:30:25 PM"
3638
}
3739
3840
```
3941

42+
`lastupdate` is provided in ISO 8601 format, while `lastupdateLocale` reflects the gateway's locale-specific representation.
43+
4044

4145
# USAGE
4246

nodes/locales/it-IT/knxUltimateGlobalContext.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@
3030
address: "0/0/1",
3131
dpt: "1.001",
3232
payload: true,
33-
devicename: "Dinning Room->Table Light"
33+
devicename: "Dinning Room->Table Light",
34+
lastupdate: "2024-07-10T18:30:25.123Z",
35+
lastupdateLocale: "10/07/2024, 20:30:25"
3436
}
3537
```
3638
39+
`lastupdate` è in formato ISO 8601, mentre `lastupdateLocale` riporta la data e ora formattate secondo le impostazioni locali del gateway.
40+
3741
## Utilizzo rapido
3842
3943
### Leggere la variabile

nodes/locales/zh-CN/knxUltimateGlobalContext.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@
3030
address: "0/0/1",
3131
dpt: "1.001",
3232
payload: true,
33-
devicename: "Dinning Room->Table Light"
33+
devicename: "Dinning Room->Table Light",
34+
lastupdate: "2024-07-10T18:30:25.123Z",
35+
lastupdateLocale: "2024/7/10 20:30:25"
3436
}
3537
```
3638

39+
`lastupdate` 采用 ISO 8601 格式,`lastupdateLocale` 则依据本地设置输出易读的日期时间。
40+
3741
## 快速用法
3842

3943
### 读取变量

0 commit comments

Comments
 (0)