Skip to content

Commit cfb55df

Browse files
committed
added vision multi zone
1 parent c68af29 commit cfb55df

File tree

8 files changed

+815
-140
lines changed

8 files changed

+815
-140
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ The adapter can control the mower and you can change config params like mowtimes
4747
- (Lucky-ESA) Catch publish crash
4848
- (Lucky-ESA) Added for Vision electric height adjustment
4949
- (Lucky-ESA) Added for Vision new calendar
50-
- (Lucky-ESA) Added head light
51-
- (Lucky-ESA) Added cut over slabs
50+
- (Lucky-ESA) Added Vision head light
51+
- (Lucky-ESA) Added Vision cut over slabs
5252
- (Lucky-ESA) Node 18 required
5353
- (Lucky-ESA) Catch aws_cer error and use old mqtt connection
5454
- (Lucky-ESA) Added rain wait countdown
55+
- (Lucky-ESA) Added Vision Multi Zone
5556

5657
### 2.3.4 (2023-10-19)
5758

docs/de/README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,18 @@
298298

299299
### Zusätzlich Vision Infos
300300

301-
- Area
302-
- `rfid`: Anzahl Zonen (nur lesen)
303-
- `startSequence`: Multizone JSON (Vision/änderbar) [Beispiel](#beispiel-blockly-startsequence-vison)
301+
- MultiZone
302+
- `multiZone.passages.passage_01.tagIdFrom`: RFID id von z1 - Mit Blockly ohne Verzögerung setzen - Änderung wird in `multiZone.multiZone` geschrieben (Vision/änderbar)
303+
- `multiZone.passages.passage_01.tagIdTo`: RFID id von z2 - Mit Blockly ohne Verzögerung setzen - Änderung wird in `multiZone.multiZone` geschrieben (Vision/änderbar)
304+
- `multiZone.passages.passage_01.zoneIdFrom`: Zone von (muss z1 < z2) - Mit Blockly ohne Verzögerung setzen - Änderung wird in `multiZone.multiZone` geschrieben (Vision/änderbar)
305+
- `multiZone.passages.passage_01.zoneIdTo`: Zone zu (muss z2 > z1) - Mit Blockly ohne Verzögerung setzen - Änderung wird in `multiZone.multiZone` geschrieben (Vision/änderbar)
306+
- `multiZone.zones.zone_1.borderDistance`: Kantenschnitt in mm - erlaubt 10mm, 15mm und 20mm - Mit Blockly ohne Verzögerung setzen - Änderung wird in `multiZone.multiZone` geschrieben (Vision/änderbar)
307+
- `multiZone.zones.zone_1.chargingStation`: 1 Wenn sich die Ladestation in diese Zone gefindet. 0 für keine Ladestation - Mit Blockly ohne Verzögerung setzen - Änderung wird in `multiZone.multiZone` geschrieben (Vision/änderbar)
308+
- `multiZone.zones.zone_1.cutOverBorder`: 1 zum Überfahren von Platten, wenn diese erkannt werden, ansonsten 0.Unterschiedliche Werte pro Zone sind nicht zulässig - Mit Blockly ohne Verzögerung setzen - Änderung wird in `multiZone.multiZone` geschrieben (Vision/änderbar)
309+
- `multiZone.zones.zone_1.zone_id`: Nummerierung - Start mit 1 - Mit Blockly ohne Verzögerung setzen - Änderung wird in `multiZone.multiZone` geschrieben (Vision/änderbar)
310+
- `multiZone.rfid`: Anzahl Zonen (nur lesen)
311+
- `multiZone.multiZone`: Multizone JSON (Vision/änderbar) [Beispiel](#beispiel-blockly-startsequence-vision)
312+
- `multiZone.sendMultiZoneJson`: Änderungen an Worx senden mit mit einer Verzögerung von 1,1 Sekunden (Vision/änderbar)
304313

305314
Beispiel:
306315

@@ -365,7 +374,7 @@ Standard ohne Zonen:
365374
}
366375
```
367376

368-
![Vision img/areas_vision.png](../en/img/areas_vision.png)
377+
![Vision img/areas_vision.png](img/areas_vision.png)
369378

370379
- Mower
371380
- `log_improvement`: Protokoll zur Verbesserung an Worx senden de-/aktivieren (änderbar)

docs/de/img/areas_vision.png

103 KB
Loading

docs/en/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,18 @@
298298

299299
### Additionally for vision
300300

301-
- Area
302-
- `rfid`: Total Areas (readonly)
303-
- `startSequence`: Multizone JSON (Vision/changeable) [Example](#example-blockly-startsequence-vison)
301+
- MultiZone
302+
- `multiZone.passages.passage_01.tagIdFrom`: RFID id of z1 - Set with Blockly without delay - Change is written to `multiZone.multiZone` (vision/changeable)
303+
- `multiZone.passages.passage_01.tagIdTo`: RFID id of z2 - Set with Blockly without delay - Change is written to `multiZone.multiZone` (vision/changeable)
304+
- `multiZone.passages.passage_01.zoneIdFrom`: Zone from (must z1 < z2) - Set with Blockly without delay - Change is written to `multiZone.multiZone` (vision/changeable)
305+
- `multiZone.passages.passage_01.zoneIdTo`: Zone closed (must z2 > z1) - Set with Blockly without delay - Change is written to `multiZone.multiZone` (vision/changeable)
306+
- `multiZone.zones.zone_1.borderDistance`: Edge cut in mm - allowed 10mm, 15mm and 20mm - Set with Blockly without delay - Change is written in `multiZone.multiZone` (vision/changeable)
307+
- `multiZone.zones.zone_1.chargingStation`: 1 If the charging station is found in this zone. 0 for no charging station - Set with Blockly without delay - Change is written to `multiZone.multiZone` (vision/changeable)
308+
- `multiZone.zones.zone_1.cutOverBorder`: 1 to drive over plates if they are detected, otherwise 0. Different values ​​per zone are not permitted - Set with Blockly without delay - Change is written to `multiZone.multiZone` (Vision /changeable)
309+
- `multiZone.zones.zone_1.zone_id`: Numbering - Start with 1 - Set with Blockly without delay - Change is written to `multiZone.multiZone` (vision/changeable)
310+
- `multiZone.rfid`: Total Areas (readonly)
311+
- `multiZone.multiZone`: Multizone JSON (Vision/changeable) [Example](#example-blockly-startsequence-vision)
312+
- `multiZone.sendMultiZoneJson`: Send changes to Worx with a delay of 1.1 seconds (vision/changeable)
304313

305314
Example:
306315

docs/en/img/areas_vision.png

89.3 KB
Loading

lib/helper.js

Lines changed: 94 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -303,22 +303,6 @@ module.exports = {
303303
},
304304
};
305305
await this.createDataPoint(`${mower.serial_number}.mower`, common, "channel");
306-
common = {
307-
name: {
308-
en: "Mower Areas",
309-
de: "Mähergebiete",
310-
ru: "Районы Mower",
311-
pt: "Áreas de esgoto",
312-
nl: "Mower Areas",
313-
fr: "Zones d ' amorçage",
314-
it: "Zone fognarie",
315-
es: "Mower Areas",
316-
pl: "Obszar Mowera",
317-
uk: "Моверарки",
318-
"zh-cn": "摩托区",
319-
},
320-
};
321-
await this.createDataPoint(`${mower.serial_number}.areas`, common, "channel");
322306
if (dev) {
323307
common = {
324308
name: {
@@ -417,6 +401,16 @@ module.exports = {
417401
}
418402
}
419403
}
404+
for (const o of objects.multiZones) {
405+
await this.createDataPoint(`${mower.serial_number}.${o._id}`, o.common, o.type, o.native);
406+
}
407+
for (const o of objects.zones_channel) {
408+
await this.createDataPoint(`${mower.serial_number}.multiZone.${o._id}`, o.common, o.type, o.native);
409+
}
410+
for (const o of objects.passage_channel) {
411+
await this.createDataPoint(`${mower.serial_number}.multiZone.${o._id}`, o.common, o.type, o.native);
412+
}
413+
await this.evaluateVisionMultiZone(mower, true);
420414
states_cmd = {
421415
1: "Start",
422416
2: "Stop",
@@ -445,7 +439,7 @@ module.exports = {
445439
def: 0,
446440
desc: `Mowing zone detection`,
447441
};
448-
await this.createDataPoint(`${mower.serial_number}.areas.rfid`, common, "state");
442+
await this.createDataPoint(`${mower.serial_number}.multiZone.rfid`, common, "state");
449443
common = {
450444
name: {
451445
en: "Add new mowing time",
@@ -537,7 +531,66 @@ module.exports = {
537531
for (const o of objects.firmware_body) {
538532
await this.createDataPoint(`${mower.serial_number}.mower.${o._id}`, o.common, o.type, o.native);
539533
}
534+
common = {
535+
type: "string",
536+
role: "json",
537+
name: {
538+
en: "Start sequence",
539+
de: "Startsequenz",
540+
ru: "Начать последовательность",
541+
pt: "Sequência de início",
542+
nl: "Start de reeks",
543+
fr: "Démarrer la séquence",
544+
it: "Avviare la sequenza",
545+
es: "Secuencia de inicio",
546+
pl: "Sekwencja początkowa",
547+
uk: "Послідовність старту",
548+
"zh-cn": "启动顺序",
549+
},
550+
desc: "Sequence of area to start from",
551+
read: true,
552+
write: true,
553+
};
554+
await this.createDataPoint(`${mower.serial_number}.multiZone.multiZone`, common, "state");
555+
common = {
556+
type: "boolean",
557+
role: "button",
558+
name: {
559+
en: "Send multi-zone as JSON",
560+
de: "Mehrzonen als JSON senden",
561+
ru: "Отправить мультизону как JSON",
562+
pt: "Enviar multizona como JSON",
563+
nl: "Multi-zone verzenden als JSON",
564+
fr: "Envoyer plusieurs zones comme JSON",
565+
it: "Invia multizona come JSON",
566+
es: "Enviar multizona como JSON",
567+
pl: "Wyślij wielostrefę jako JSON",
568+
uk: "Надіслати багатозон як JSON",
569+
"zh-cn": "作为 JSON 发送多区",
570+
},
571+
desc: "Send multi-zone as JSON",
572+
read: true,
573+
write: true,
574+
def: false,
575+
};
576+
await this.createDataPoint(`${mower.serial_number}.multiZone.sendMultiZoneJson`, common, "state");
540577
} else {
578+
common = {
579+
name: {
580+
en: "Mower Areas",
581+
de: "Mähergebiete",
582+
ru: "Районы Mower",
583+
pt: "Áreas de esgoto",
584+
nl: "Mower Areas",
585+
fr: "Zones d ' amorçage",
586+
it: "Zone fognarie",
587+
es: "Mower Areas",
588+
pl: "Obszar Mowera",
589+
uk: "Моверарки",
590+
"zh-cn": "摩托区",
591+
},
592+
};
593+
await this.createDataPoint(`${mower.serial_number}.areas`, common, "channel");
541594
for (let a = 0; a <= 3; a++) {
542595
await this.setObjectNotExistsAsync(`${mower.serial_number}.areas.area_${a}`, {
543596
type: "state",
@@ -666,30 +719,29 @@ module.exports = {
666719
8: "pause when follow wire",
667720
9: "safe homing",
668721
};
722+
common = {
723+
type: "string",
724+
role: "json",
725+
name: {
726+
en: "Start sequence",
727+
de: "Startsequenz",
728+
ru: "Начать последовательность",
729+
pt: "Sequência de início",
730+
nl: "Start de reeks",
731+
fr: "Démarrer la séquence",
732+
it: "Avviare la sequenza",
733+
es: "Secuencia de inicio",
734+
pl: "Sekwencja początkowa",
735+
uk: "Послідовність старту",
736+
"zh-cn": "启动顺序",
737+
},
738+
desc: "Sequence of area to start from",
739+
read: true,
740+
write: true,
741+
};
742+
await this.createDataPoint(`${mower.serial_number}.areas.startSequence`, common, "state");
669743
}
670744

671-
common = {
672-
type: "string",
673-
role: "json",
674-
name: {
675-
en: "Start sequence",
676-
de: "Startsequenz",
677-
ru: "Начать последовательность",
678-
pt: "Sequência de início",
679-
nl: "Start de reeks",
680-
fr: "Démarrer la séquence",
681-
it: "Avviare la sequenza",
682-
es: "Secuencia de inicio",
683-
pl: "Sekwencja początkowa",
684-
uk: "Послідовність старту",
685-
"zh-cn": "启动顺序",
686-
},
687-
desc: "Sequence of area to start from",
688-
read: true,
689-
write: true,
690-
};
691-
await this.createDataPoint(`${mower.serial_number}.areas.startSequence`, common, "state");
692-
693745
// mower
694746
common = {
695747
name: {
@@ -1726,7 +1778,7 @@ module.exports = {
17261778
data.cfg.sc.slots = await this.evaluateVisionCalendar(mower, data.cfg.sc.slots);
17271779
}
17281780
if (data.dat && data.dat.rfid) {
1729-
await this.setStateAsync(`${mower.serial_number}.areas.rfid`, {
1781+
await this.setStateAsync(`${mower.serial_number}.multiZone.rfid`, {
17301782
val: data.dat.rfid.status,
17311783
ack: true,
17321784
});
@@ -1787,10 +1839,11 @@ module.exports = {
17871839
});
17881840
}
17891841
if (data.cfg.mz != null) {
1790-
await this.setStateAsync(`${mower.serial_number}.areas.startSequence`, {
1842+
await this.setStateAsync(`${mower.serial_number}.multiZone.multiZone`, {
17911843
val: JSON.stringify(data.cfg.mz),
17921844
ack: true,
17931845
});
1846+
await this.evaluateVisionMultiZone(mower, false);
17941847
}
17951848
} else {
17961849
await this.setStateAsync(`${mower.serial_number}.mower.mowerActive`, {

0 commit comments

Comments
 (0)