mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
Merge pull request #1591 from MichaelDvP/dev
fix #1590 and more checks for device-telegram mapping
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
"@table-library/react-table-library": "4.1.7",
|
"@table-library/react-table-library": "4.1.7",
|
||||||
"@types/imagemin": "^8.0.5",
|
"@types/imagemin": "^8.0.5",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^20.11.9",
|
"@types/node": "^20.11.10",
|
||||||
"@types/react": "^18.2.48",
|
"@types/react": "^18.2.48",
|
||||||
"@types/react-dom": "^18.2.18",
|
"@types/react-dom": "^18.2.18",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
@@ -54,8 +54,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@preact/compat": "^17.1.2",
|
"@preact/compat": "^17.1.2",
|
||||||
"@preact/preset-vite": "^2.8.1",
|
"@preact/preset-vite": "^2.8.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
||||||
"@typescript-eslint/parser": "^6.19.1",
|
"@typescript-eslint/parser": "^6.20.0",
|
||||||
"concurrently": "^8.2.2",
|
"concurrently": "^8.2.2",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
"eslint-config-airbnb": "^19.0.4",
|
"eslint-config-airbnb": "^19.0.4",
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ const de: Translation = {
|
|||||||
THE_LATEST: 'Die neueste',
|
THE_LATEST: 'Die neueste',
|
||||||
OFFICIAL: 'offizielle',
|
OFFICIAL: 'offizielle',
|
||||||
DEVELOPMENT: 'Entwicklungs',
|
DEVELOPMENT: 'Entwicklungs',
|
||||||
RELEASE_IS: 'release ist', // TODO translate
|
RELEASE_IS: 'Release ist',
|
||||||
RELEASE_NOTES: 'Versionshinweise',
|
RELEASE_NOTES: 'Versionshinweise',
|
||||||
EMS_ESP_VER: 'EMS-ESP Version',
|
EMS_ESP_VER: 'EMS-ESP Version',
|
||||||
UPTIME: 'System Betriebszeit',
|
UPTIME: 'System Betriebszeit',
|
||||||
@@ -228,7 +228,7 @@ const de: Translation = {
|
|||||||
BROKER: 'Broker',
|
BROKER: 'Broker',
|
||||||
CLIENT: 'Client',
|
CLIENT: 'Client',
|
||||||
BASE_TOPIC: 'Base',
|
BASE_TOPIC: 'Base',
|
||||||
OPTIONAL: 'Optional', // TODO translate
|
OPTIONAL: 'Optional',
|
||||||
FORMATTING: 'Formattierung',
|
FORMATTING: 'Formattierung',
|
||||||
MQTT_FORMAT: 'Topic/Payload Format',
|
MQTT_FORMAT: 'Topic/Payload Format',
|
||||||
MQTT_NEST_1: 'Eingebettet in einem Gesamttopic',
|
MQTT_NEST_1: 'Eingebettet in einem Gesamttopic',
|
||||||
@@ -307,7 +307,7 @@ const de: Translation = {
|
|||||||
LEAVE: 'Verlassen',
|
LEAVE: 'Verlassen',
|
||||||
SCHEDULER: 'Planer',
|
SCHEDULER: 'Planer',
|
||||||
SCHEDULER_HELP_1: 'Fügen Sie eigene, geplante Befehle zur Automatisierung hinzu. Vergeben Sie einen Entitätsnamen um die Aktivierung über API/Mqtt zu steuern',
|
SCHEDULER_HELP_1: 'Fügen Sie eigene, geplante Befehle zur Automatisierung hinzu. Vergeben Sie einen Entitätsnamen um die Aktivierung über API/Mqtt zu steuern',
|
||||||
SCHEDULER_HELP_2: 'Use 00:00 to trigger once on start-up', // TODO translate
|
SCHEDULER_HELP_2: '00:00 aktiviert einmalige Ausführung am Start',
|
||||||
SCHEDULE: 'Zeitplan',
|
SCHEDULE: 'Zeitplan',
|
||||||
TIME: 'Zeit',
|
TIME: 'Zeit',
|
||||||
TIMER: 'Timer',
|
TIMER: 'Timer',
|
||||||
@@ -316,7 +316,7 @@ const de: Translation = {
|
|||||||
SCHEDULE_TIMER_2: 'jede Minute',
|
SCHEDULE_TIMER_2: 'jede Minute',
|
||||||
SCHEDULE_TIMER_3: 'jede Stunde',
|
SCHEDULE_TIMER_3: 'jede Stunde',
|
||||||
CUSTOM_ENTITIES: 'Individuelle Entitäten',
|
CUSTOM_ENTITIES: 'Individuelle Entitäten',
|
||||||
ENTITIES_HELP_1: 'Abfrage von Werten auf dem EMS-Bus', // TODO translate
|
ENTITIES_HELP_1: 'Definition eigener EMS-Werte oder dynamischer Variablen',
|
||||||
ENTITIES_UPDATED: 'Entitäten gespeichert',
|
ENTITIES_UPDATED: 'Entitäten gespeichert',
|
||||||
WRITEABLE: 'Schreibbar',
|
WRITEABLE: 'Schreibbar',
|
||||||
SHOWING: 'Anzeigen von',
|
SHOWING: 'Anzeigen von',
|
||||||
|
|||||||
@@ -1590,12 +1590,12 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/node@npm:^20.11.9":
|
"@types/node@npm:^20.11.10":
|
||||||
version: 20.11.9
|
version: 20.11.10
|
||||||
resolution: "@types/node@npm:20.11.9"
|
resolution: "@types/node@npm:20.11.10"
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: "npm:~5.26.4"
|
undici-types: "npm:~5.26.4"
|
||||||
checksum: 5683ec162f7975119b9c9b026f00bfc8e4fcd02d87ba106787685765fe042b8c16b71241baec043b6ac19caa343fe4e0edcb252c74943c36b98fadd72c8924fe
|
checksum: 41ca9c7e7c95bf070ad747ab266f267f41950e01f5ddda739d0665c2ed39acc45cce46f78e33ffa2bf2dacd74a8493044b967c86358017dacce12958e49db664
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -1713,15 +1713,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@typescript-eslint/eslint-plugin@npm:^6.19.1":
|
"@typescript-eslint/eslint-plugin@npm:^6.20.0":
|
||||||
version: 6.19.1
|
version: 6.20.0
|
||||||
resolution: "@typescript-eslint/eslint-plugin@npm:6.19.1"
|
resolution: "@typescript-eslint/eslint-plugin@npm:6.20.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@eslint-community/regexpp": "npm:^4.5.1"
|
"@eslint-community/regexpp": "npm:^4.5.1"
|
||||||
"@typescript-eslint/scope-manager": "npm:6.19.1"
|
"@typescript-eslint/scope-manager": "npm:6.20.0"
|
||||||
"@typescript-eslint/type-utils": "npm:6.19.1"
|
"@typescript-eslint/type-utils": "npm:6.20.0"
|
||||||
"@typescript-eslint/utils": "npm:6.19.1"
|
"@typescript-eslint/utils": "npm:6.20.0"
|
||||||
"@typescript-eslint/visitor-keys": "npm:6.19.1"
|
"@typescript-eslint/visitor-keys": "npm:6.20.0"
|
||||||
debug: "npm:^4.3.4"
|
debug: "npm:^4.3.4"
|
||||||
graphemer: "npm:^1.4.0"
|
graphemer: "npm:^1.4.0"
|
||||||
ignore: "npm:^5.2.4"
|
ignore: "npm:^5.2.4"
|
||||||
@@ -1734,44 +1734,44 @@ __metadata:
|
|||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
typescript:
|
typescript:
|
||||||
optional: true
|
optional: true
|
||||||
checksum: e88a35527b066a42d0253d153183a360faedc1cd39867c541ce7cb1f7b22f8446bb913b998fcdeba269d5d4217888af42e6d64da5c0592b1f49ed5648d2e3e84
|
checksum: dee6a2392c831e6ae69611ecc4de06e66a7b16f6bf6d8e3bfd25091eb14d88c9d0bb9c9cd634efcfa318902341f7a459cf48f713d55cb1d610145ca1f52af4d3
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@typescript-eslint/parser@npm:^6.19.1":
|
"@typescript-eslint/parser@npm:^6.20.0":
|
||||||
version: 6.19.1
|
version: 6.20.0
|
||||||
resolution: "@typescript-eslint/parser@npm:6.19.1"
|
resolution: "@typescript-eslint/parser@npm:6.20.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/scope-manager": "npm:6.19.1"
|
"@typescript-eslint/scope-manager": "npm:6.20.0"
|
||||||
"@typescript-eslint/types": "npm:6.19.1"
|
"@typescript-eslint/types": "npm:6.20.0"
|
||||||
"@typescript-eslint/typescript-estree": "npm:6.19.1"
|
"@typescript-eslint/typescript-estree": "npm:6.20.0"
|
||||||
"@typescript-eslint/visitor-keys": "npm:6.19.1"
|
"@typescript-eslint/visitor-keys": "npm:6.20.0"
|
||||||
debug: "npm:^4.3.4"
|
debug: "npm:^4.3.4"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^7.0.0 || ^8.0.0
|
eslint: ^7.0.0 || ^8.0.0
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
typescript:
|
typescript:
|
||||||
optional: true
|
optional: true
|
||||||
checksum: 63ff00a56586879a62e40b27b55c94501173fcf2fb5a620d01e7505851b4bb20feb1e7fbad36010af97aefc0a722267d9ce3aa004abab22cb7eb23eebb0102ce
|
checksum: 691062d47cae7977604ede848ffff3689162428a53577f298989f585954aa3a3450e7fd5c2b363d024cd5f16022c163cecf0f1f1d138234bbd78048050b4b8bf
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@typescript-eslint/scope-manager@npm:6.19.1":
|
"@typescript-eslint/scope-manager@npm:6.20.0":
|
||||||
version: 6.19.1
|
version: 6.20.0
|
||||||
resolution: "@typescript-eslint/scope-manager@npm:6.19.1"
|
resolution: "@typescript-eslint/scope-manager@npm:6.20.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/types": "npm:6.19.1"
|
"@typescript-eslint/types": "npm:6.20.0"
|
||||||
"@typescript-eslint/visitor-keys": "npm:6.19.1"
|
"@typescript-eslint/visitor-keys": "npm:6.20.0"
|
||||||
checksum: 2a17f68d3c41582bfac7ecd192e2c2539cf4d2c9728a7018d842da7a8a23986b8a1f8cfcb59862c909b483140a2d164a4ba44451905e0a141378e5dd0df056cc
|
checksum: 2c1a644f2931454b34875f2e6dffad52a1fc7b6ac508d7d1ad3cd9da028a7dff9c6191feeea2c9ca691deba199ac9e83cbd0036914be4cd45b6954437f03c09a
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@typescript-eslint/type-utils@npm:6.19.1":
|
"@typescript-eslint/type-utils@npm:6.20.0":
|
||||||
version: 6.19.1
|
version: 6.20.0
|
||||||
resolution: "@typescript-eslint/type-utils@npm:6.19.1"
|
resolution: "@typescript-eslint/type-utils@npm:6.20.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/typescript-estree": "npm:6.19.1"
|
"@typescript-eslint/typescript-estree": "npm:6.20.0"
|
||||||
"@typescript-eslint/utils": "npm:6.19.1"
|
"@typescript-eslint/utils": "npm:6.20.0"
|
||||||
debug: "npm:^4.3.4"
|
debug: "npm:^4.3.4"
|
||||||
ts-api-utils: "npm:^1.0.1"
|
ts-api-utils: "npm:^1.0.1"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -1779,23 +1779,23 @@ __metadata:
|
|||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
typescript:
|
typescript:
|
||||||
optional: true
|
optional: true
|
||||||
checksum: 5150b897d8b3778c549c6b964b031981da1039dfa0fb89a0eb92702735ca55793d2f840af14b340eccbca81669ba3dd02d7f09fb420fb66b18ec9f1f211b3243
|
checksum: bc2f2793cfec3463164b5f5ded31b4e169e21c3a1990c1ce4effe70a359c486d92fbbc4cd92758bbf1c30a468ad0839e0fa890bd452c707d0c294cb3a7b14021
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@typescript-eslint/types@npm:6.19.1":
|
"@typescript-eslint/types@npm:6.20.0":
|
||||||
version: 6.19.1
|
version: 6.20.0
|
||||||
resolution: "@typescript-eslint/types@npm:6.19.1"
|
resolution: "@typescript-eslint/types@npm:6.20.0"
|
||||||
checksum: 93f3ded80b81a1b8686866b93e36ddf9bac04604d09e88d7ed1ec25b6b2f49ff64747d8d194ba1f3215e231fd0790b88fb5ecadcc6ed53ff584f8c0b87423216
|
checksum: 74ed1761e27c3c1a29fd260fe51096f42cfb1472b20390d6df6ec41de0420208f379e809de416e81cd7c00fdc3d5550b2391872be56bf4a1b0c595f71db0b1ea
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@typescript-eslint/typescript-estree@npm:6.19.1":
|
"@typescript-eslint/typescript-estree@npm:6.20.0":
|
||||||
version: 6.19.1
|
version: 6.20.0
|
||||||
resolution: "@typescript-eslint/typescript-estree@npm:6.19.1"
|
resolution: "@typescript-eslint/typescript-estree@npm:6.20.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/types": "npm:6.19.1"
|
"@typescript-eslint/types": "npm:6.20.0"
|
||||||
"@typescript-eslint/visitor-keys": "npm:6.19.1"
|
"@typescript-eslint/visitor-keys": "npm:6.20.0"
|
||||||
debug: "npm:^4.3.4"
|
debug: "npm:^4.3.4"
|
||||||
globby: "npm:^11.1.0"
|
globby: "npm:^11.1.0"
|
||||||
is-glob: "npm:^4.0.3"
|
is-glob: "npm:^4.0.3"
|
||||||
@@ -1805,34 +1805,34 @@ __metadata:
|
|||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
typescript:
|
typescript:
|
||||||
optional: true
|
optional: true
|
||||||
checksum: 3ce91dd477ccb2cc3cf5d07ac8d23792988f4fad78bfd39783292846f32daea5081d3790ba9cc795d9de89ea2e1d55dc9c3d2aeaa8597093b0f6ac3a206195e9
|
checksum: 55b280c6e71c79cb009ac80189a7f0e1aa9011bc7206c810bbb52d9703a894aa2817dfd44d947edf64d62f3aa0962e01f3423fcb21d2f39964a4840287d9e196
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@typescript-eslint/utils@npm:6.19.1":
|
"@typescript-eslint/utils@npm:6.20.0":
|
||||||
version: 6.19.1
|
version: 6.20.0
|
||||||
resolution: "@typescript-eslint/utils@npm:6.19.1"
|
resolution: "@typescript-eslint/utils@npm:6.20.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@eslint-community/eslint-utils": "npm:^4.4.0"
|
"@eslint-community/eslint-utils": "npm:^4.4.0"
|
||||||
"@types/json-schema": "npm:^7.0.12"
|
"@types/json-schema": "npm:^7.0.12"
|
||||||
"@types/semver": "npm:^7.5.0"
|
"@types/semver": "npm:^7.5.0"
|
||||||
"@typescript-eslint/scope-manager": "npm:6.19.1"
|
"@typescript-eslint/scope-manager": "npm:6.20.0"
|
||||||
"@typescript-eslint/types": "npm:6.19.1"
|
"@typescript-eslint/types": "npm:6.20.0"
|
||||||
"@typescript-eslint/typescript-estree": "npm:6.19.1"
|
"@typescript-eslint/typescript-estree": "npm:6.20.0"
|
||||||
semver: "npm:^7.5.4"
|
semver: "npm:^7.5.4"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^7.0.0 || ^8.0.0
|
eslint: ^7.0.0 || ^8.0.0
|
||||||
checksum: f8931df675defa84af373c81bbb13cc34c2fcf0803c687a38b982e85335dbf2fb8415667fbabaa043df0326ba3e98ed974104bbd21f09ec538304fc3adeed0c3
|
checksum: 6d4604be6123e0073dd5e7dd357c95b370c678572d2e982478d0d6937d4d65f0cad0ac207b8b724f3bce239e64ba1ddd6bece11e1592734d8bf691177e6971e6
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@typescript-eslint/visitor-keys@npm:6.19.1":
|
"@typescript-eslint/visitor-keys@npm:6.20.0":
|
||||||
version: 6.19.1
|
version: 6.20.0
|
||||||
resolution: "@typescript-eslint/visitor-keys@npm:6.19.1"
|
resolution: "@typescript-eslint/visitor-keys@npm:6.20.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/types": "npm:6.19.1"
|
"@typescript-eslint/types": "npm:6.20.0"
|
||||||
eslint-visitor-keys: "npm:^3.4.1"
|
eslint-visitor-keys: "npm:^3.4.1"
|
||||||
checksum: b41f3247520e1e4d3e43876843b03f0d887e544d4ac8a9e1f4b25d08568da36fedde883fa226488a595f688198859cd0290d0f1351c2ca6cbc30cca2c90adf21
|
checksum: df066c73f3880ad78880c442f307e58f026e6047d9caab9d7c356d13276f4fe466fab3e8d19cdb1e6749e87639cb7c4babcfe118f554fcd2d3929ce9f4983216
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -1858,12 +1858,12 @@ __metadata:
|
|||||||
"@table-library/react-table-library": "npm:4.1.7"
|
"@table-library/react-table-library": "npm:4.1.7"
|
||||||
"@types/imagemin": "npm:^8.0.5"
|
"@types/imagemin": "npm:^8.0.5"
|
||||||
"@types/lodash-es": "npm:^4.17.12"
|
"@types/lodash-es": "npm:^4.17.12"
|
||||||
"@types/node": "npm:^20.11.9"
|
"@types/node": "npm:^20.11.10"
|
||||||
"@types/react": "npm:^18.2.48"
|
"@types/react": "npm:^18.2.48"
|
||||||
"@types/react-dom": "npm:^18.2.18"
|
"@types/react-dom": "npm:^18.2.18"
|
||||||
"@types/react-router-dom": "npm:^5.3.3"
|
"@types/react-router-dom": "npm:^5.3.3"
|
||||||
"@typescript-eslint/eslint-plugin": "npm:^6.19.1"
|
"@typescript-eslint/eslint-plugin": "npm:^6.20.0"
|
||||||
"@typescript-eslint/parser": "npm:^6.19.1"
|
"@typescript-eslint/parser": "npm:^6.20.0"
|
||||||
alova: "npm:^2.17.0"
|
alova: "npm:^2.17.0"
|
||||||
async-validator: "npm:^4.2.5"
|
async-validator: "npm:^4.2.5"
|
||||||
concurrently: "npm:^8.2.2"
|
concurrently: "npm:^8.2.2"
|
||||||
|
|||||||
@@ -623,6 +623,11 @@ void AnalogSensor::publish_values(const bool force) {
|
|||||||
// called from emsesp.cpp for commands
|
// called from emsesp.cpp for commands
|
||||||
// searches sensor by name
|
// searches sensor by name
|
||||||
bool AnalogSensor::get_value_info(JsonObject output, const char * cmd, const int8_t id) {
|
bool AnalogSensor::get_value_info(JsonObject output, const char * cmd, const int8_t id) {
|
||||||
|
// check of it a 'commmands' command
|
||||||
|
if (Helpers::toLower(cmd) == F_(commands)) {
|
||||||
|
return Command::list(EMSdevice::DeviceType::ANALOGSENSOR, output);
|
||||||
|
}
|
||||||
|
|
||||||
if (sensors_.empty()) {
|
if (sensors_.empty()) {
|
||||||
return true; // no sensors, return true
|
return true; // no sensors, return true
|
||||||
}
|
}
|
||||||
@@ -647,11 +652,6 @@ bool AnalogSensor::get_value_info(JsonObject output, const char * cmd, const int
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check of it a 'commmands' command
|
|
||||||
if (Helpers::toLower(cmd) == F_(commands)) {
|
|
||||||
return Command::list(EMSdevice::DeviceType::TEMPERATURESENSOR, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is for a specific sensor
|
// this is for a specific sensor
|
||||||
// make a copy of the string command for parsing, and lowercase it
|
// make a copy of the string command for parsing, and lowercase it
|
||||||
char sensor_name[30] = {'\0'};
|
char sensor_name[30] = {'\0'};
|
||||||
|
|||||||
@@ -173,8 +173,10 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
|
|||||||
if (!output.containsKey("api_data")) {
|
if (!output.containsKey("api_data")) {
|
||||||
return CommandRet::INVALID;
|
return CommandRet::INVALID;
|
||||||
}
|
}
|
||||||
data = output["api_data"];
|
String dat = output["api_data"];
|
||||||
output.clear();
|
output.clear();
|
||||||
|
input["data"] = dat.c_str();
|
||||||
|
data = input["data"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -437,7 +439,11 @@ void Command::erase_command(const uint8_t device_type, const char * cmd) {
|
|||||||
|
|
||||||
// list all commands for a specific device, output as json
|
// list all commands for a specific device, output as json
|
||||||
bool Command::list(const uint8_t device_type, JsonObject output) {
|
bool Command::list(const uint8_t device_type, JsonObject output) {
|
||||||
if (cmdfunctions_.empty()) {
|
// force add info and commands for those non-EMS devices
|
||||||
|
if (device_type == EMSdevice::DeviceType::TEMPERATURESENSOR || device_type == EMSdevice::DeviceType::ANALOGSENSOR) {
|
||||||
|
output[F_(info)] = Helpers::translated_word(FL_(info_cmd));
|
||||||
|
output[F_(commands)] = Helpers::translated_word(FL_(commands_cmd));
|
||||||
|
} else if (cmdfunctions_.empty()) {
|
||||||
output["message"] = "no commands available";
|
output["message"] = "no commands available";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -451,12 +457,6 @@ bool Command::list(const uint8_t device_type, JsonObject output) {
|
|||||||
}
|
}
|
||||||
sorted_cmds.sort();
|
sorted_cmds.sort();
|
||||||
|
|
||||||
// force add info and commands for those non-EMS devices
|
|
||||||
if (device_type == EMSdevice::DeviceType::TEMPERATURESENSOR) {
|
|
||||||
output[F_(info)] = Helpers::translated_word(FL_(info_cmd));
|
|
||||||
output[F_(commands)] = Helpers::translated_word(FL_(commands_cmd));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto & cl : sorted_cmds) {
|
for (const auto & cl : sorted_cmds) {
|
||||||
for (const auto & cf : cmdfunctions_) {
|
for (const auto & cf : cmdfunctions_) {
|
||||||
if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == std::string(cf.cmd_))) {
|
if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == std::string(cf.cmd_))) {
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
register_telegram_type(0x49D, "HPSettings3", true, MAKE_PF_CB(process_HpSettings3));
|
register_telegram_type(0x49D, "HPSettings3", true, MAKE_PF_CB(process_HpSettings3));
|
||||||
register_telegram_type(0x4AE, "HPEnergy", true, MAKE_PF_CB(process_HpEnergy));
|
register_telegram_type(0x4AE, "HPEnergy", true, MAKE_PF_CB(process_HpEnergy));
|
||||||
register_telegram_type(0x4AF, "HPMeters", true, MAKE_PF_CB(process_HpMeters));
|
register_telegram_type(0x4AF, "HPMeters", true, MAKE_PF_CB(process_HpMeters));
|
||||||
|
register_telegram_type(0x2CC, "HPPressure", true, MAKE_PF_CB(process_HpPressure));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model() == EMSdevice::EMS_DEVICE_FLAG_HIU) {
|
if (model() == EMSdevice::EMS_DEVICE_FLAG_HIU) {
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c
|
|||||||
// EMS+
|
// EMS+
|
||||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS) {
|
if (flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS) {
|
||||||
if (device_id >= 0x20 && device_id <= 0x27) {
|
if (device_id >= 0x20 && device_id <= 0x27) {
|
||||||
register_telegram_type(device_id - 0x20 + 0x02D7, "MMPLUSStatusMessage_HC", false, MAKE_PF_CB(process_MMPLUSStatusMessage_HC));
|
register_telegram_type(device_id - 0x20 + 0x02D7, "MMPLUSStatusMessage", false, MAKE_PF_CB(process_MMPLUSStatusMessage_HC));
|
||||||
// register_telegram_type(device_id - 0x20 + 0x02E1, "MMPLUSSetMessage_HC", true, MAKE_PF_CB(process_MMPLUSSetMessage_HC));
|
// register_telegram_type(device_id - 0x20 + 0x02E1, "MMPLUSSetMessage", true, MAKE_PF_CB(process_MMPLUSSetMessage_HC));
|
||||||
register_telegram_type(2 * (device_id - 0x20) + 0x02CC, "MMPLUSSetMessage_HC", false, MAKE_PF_CB(process_MMPLUSSetMessage_HC));
|
register_telegram_type(2 * (device_id - 0x20) + 0x02CC, "MMPLUSSetMessage", true, MAKE_PF_CB(process_MMPLUSSetMessage_HC));
|
||||||
type_ = Type::HC;
|
type_ = Type::HC;
|
||||||
hc_ = device_id - 0x20 + 1;
|
hc_ = device_id - 0x20 + 1;
|
||||||
uint8_t tag = DeviceValueTAG::TAG_HC1 + hc_ - 1;
|
uint8_t tag = DeviceValueTAG::TAG_HC1 + hc_ - 1;
|
||||||
|
|||||||
103
src/emsesp.cpp
103
src/emsesp.cpp
@@ -722,20 +722,26 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
std::string dest_name("");
|
std::string dest_name("");
|
||||||
std::string type_name("");
|
std::string type_name("");
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice) {
|
// get src & dest
|
||||||
// get src & dest
|
if (emsdevice->is_device_id(src)) {
|
||||||
if (emsdevice->is_device_id(src)) {
|
src_name = emsdevice->device_type_name();
|
||||||
src_name = emsdevice->device_type_name();
|
} else if (emsdevice->is_device_id(dest)) {
|
||||||
} else if (emsdevice->is_device_id(dest)) {
|
dest_name = emsdevice->device_type_name();
|
||||||
dest_name = emsdevice->device_type_name();
|
}
|
||||||
|
// get the type name
|
||||||
|
if (type_name.empty()) {
|
||||||
|
if ((telegram->operation == Telegram::Operation::RX_READ && emsdevice->is_device_id(dest))
|
||||||
|
|| (telegram->operation != Telegram::Operation::RX_READ && dest == 0 && emsdevice->is_device_id(src))
|
||||||
|
|| (telegram->operation != Telegram::Operation::RX_READ && src == EMSbus::ems_bus_id() && emsdevice->is_device_id(dest))) {
|
||||||
|
type_name = emsdevice->telegram_type_name(telegram);
|
||||||
}
|
}
|
||||||
// get the type name
|
}
|
||||||
if (type_name.empty()) {
|
}
|
||||||
if ((telegram->operation == Telegram::Operation::RX_READ && emsdevice->is_device_id(dest))
|
if (type_name.empty()) {
|
||||||
|| (telegram->operation != Telegram::Operation::RX_READ && dest == 0 && emsdevice->is_device_id(src))
|
// fallback, get the type name from src
|
||||||
|| (telegram->operation != Telegram::Operation::RX_READ && src == EMSbus::ems_bus_id() && emsdevice->is_device_id(dest))) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
type_name = emsdevice->telegram_type_name(telegram);
|
if (telegram->operation != Telegram::Operation::RX_READ && emsdevice->is_device_id(src)) {
|
||||||
}
|
type_name = emsdevice->telegram_type_name(telegram);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -920,49 +926,70 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
// calls the associated process function for that EMS device
|
// calls the associated process function for that EMS device
|
||||||
// returns false if the device_id doesn't recognize it
|
// returns false if the device_id doesn't recognize it
|
||||||
// after the telegram has been processed, see if there have been values changed and we need to do a MQTT publish
|
// after the telegram has been processed, see if there have been values changed and we need to do a MQTT publish
|
||||||
bool found = false;
|
bool telegram_found = false;
|
||||||
bool knowndevice = false;
|
uint8_t device_found = 0;
|
||||||
|
// broadcast or send to us
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice->is_device_id(telegram->src) && (telegram->dest == 0 || telegram->dest == EMSbus::ems_bus_id())) {
|
if (emsdevice->is_device_id(telegram->src) && (telegram->dest == 0 || telegram->dest == EMSbus::ems_bus_id())) {
|
||||||
knowndevice = true;
|
telegram_found = emsdevice->handle_telegram(telegram);
|
||||||
found = emsdevice->handle_telegram(telegram);
|
device_found = emsdevice->unique_id();
|
||||||
// if we correctly processed the telegram then follow up with sending it via MQTT (if enabled)
|
break;
|
||||||
if (found && Mqtt::connected()) {
|
}
|
||||||
if ((mqtt_.get_publish_onchange(emsdevice->device_type()) && emsdevice->has_update())
|
}
|
||||||
|| (telegram->type_id == publish_id_ && telegram->dest == EMSbus::ems_bus_id())) {
|
if (!telegram_found) {
|
||||||
if (telegram->type_id == publish_id_) {
|
// check for command to the device
|
||||||
publish_id_ = 0;
|
for (const auto & emsdevice : emsdevices) {
|
||||||
}
|
if (emsdevice->is_device_id(telegram->dest) && telegram->src != EMSbus::ems_bus_id()) {
|
||||||
emsdevice->has_update(false); // reset flag
|
telegram_found = emsdevice->handle_telegram(telegram);
|
||||||
if (!Mqtt::publish_single()) {
|
device_found = emsdevice->unique_id();
|
||||||
publish_device_values(emsdevice->device_type()); // publish to MQTT if we explicitly have too
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!telegram_found) {
|
||||||
|
// check for sends to master thermostat
|
||||||
|
for (const auto & emsdevice : emsdevices) {
|
||||||
|
if (emsdevice->is_device_id(telegram->src) && telegram->dest == 0x10) {
|
||||||
|
telegram_found = emsdevice->handle_telegram(telegram);
|
||||||
|
device_found = emsdevice->unique_id();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const auto & emsdevice : emsdevices) {
|
||||||
|
if (emsdevice->unique_id() == device_found) {
|
||||||
|
if (!telegram_found && telegram->message_length > 0) {
|
||||||
|
emsdevice->add_handlers_ignored(telegram->type_id);
|
||||||
}
|
}
|
||||||
if (wait_validate_ == telegram->type_id) {
|
if (wait_validate_ == telegram->type_id) {
|
||||||
wait_validate_ = 0;
|
wait_validate_ = 0;
|
||||||
}
|
}
|
||||||
if (!found && telegram->message_length > 0) {
|
if (Mqtt::connected() && telegram_found
|
||||||
emsdevice->add_handlers_ignored(telegram->type_id);
|
&& ((mqtt_.get_publish_onchange(emsdevice->device_type()) && emsdevice->has_update())
|
||||||
|
|| (telegram->type_id == publish_id_ && telegram->dest == EMSbus::ems_bus_id()))) {
|
||||||
|
if (telegram->type_id == publish_id_) {
|
||||||
|
publish_id_ = 0;
|
||||||
|
}
|
||||||
|
emsdevice->has_update(false); // reset flag
|
||||||
|
if (!Mqtt::publish_single()) {
|
||||||
|
publish_device_values(emsdevice->device_type()); // publish to MQTT if we explicitly have too
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} else if (emsdevice->is_device_id(telegram->dest) && telegram->src != EMSbus::ems_bus_id()) {
|
|
||||||
emsdevice->handle_telegram(telegram);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// handle unknown broadcasted telegrams (or send to us)
|
||||||
// handle unknown broadcasted telegrams
|
if (!telegram_found && (telegram->dest == 0 || telegram->dest == EMSbus::ems_bus_id())) {
|
||||||
if (!found && telegram->dest == 0) {
|
|
||||||
LOG_DEBUG("No telegram type handler found for ID 0x%02X (src 0x%02X)", telegram->type_id, telegram->src);
|
LOG_DEBUG("No telegram type handler found for ID 0x%02X (src 0x%02X)", telegram->type_id, telegram->src);
|
||||||
if (watch() == WATCH_UNKNOWN) {
|
if (watch() == WATCH_UNKNOWN) {
|
||||||
LOG_NOTICE("%s", pretty_telegram(telegram).c_str());
|
LOG_NOTICE("%s", pretty_telegram(telegram).c_str());
|
||||||
}
|
}
|
||||||
if (!wait_km_ && !knowndevice && (telegram->src != EMSbus::ems_bus_id()) && (telegram->message_length > 0)) {
|
if (!wait_km_ && !device_found && (telegram->src != EMSbus::ems_bus_id()) && (telegram->message_length > 0)) {
|
||||||
send_read_request(EMSdevice::EMS_TYPE_VERSION, telegram->src);
|
send_read_request(EMSdevice::EMS_TYPE_VERSION, telegram->src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return telegram_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return true if we have this device already registered
|
// return true if we have this device already registered
|
||||||
|
|||||||
@@ -509,8 +509,8 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (operation == Telegram::Operation::TX_RAW) {
|
if (operation == Telegram::Operation::TX_RAW) {
|
||||||
if (src != ems_bus_id()) {
|
if (src != ems_bus_id() || dest == 0) {
|
||||||
operation = Telegram::Operation::NONE; // do not check reply/ack for other ids
|
operation = Telegram::Operation::NONE; // do not check reply/ack for other ids and broadcasts
|
||||||
} else if (dest & 0x80) {
|
} else if (dest & 0x80) {
|
||||||
operation = Telegram::Operation::TX_READ;
|
operation = Telegram::Operation::TX_READ;
|
||||||
EMSESP::set_response_id(type_id);
|
EMSESP::set_response_id(type_id);
|
||||||
|
|||||||
@@ -345,6 +345,11 @@ bool TemperatureSensor::updated_values() {
|
|||||||
|
|
||||||
// called from emsesp.cpp for commands
|
// called from emsesp.cpp for commands
|
||||||
bool TemperatureSensor::get_value_info(JsonObject output, const char * cmd, const int8_t id) {
|
bool TemperatureSensor::get_value_info(JsonObject output, const char * cmd, const int8_t id) {
|
||||||
|
// check of it a 'commmands' command
|
||||||
|
if (Helpers::toLower(cmd) == F_(commands)) {
|
||||||
|
return Command::list(EMSdevice::DeviceType::TEMPERATURESENSOR, output);
|
||||||
|
}
|
||||||
|
|
||||||
if (sensors_.empty()) {
|
if (sensors_.empty()) {
|
||||||
return true; // no sensors, return true
|
return true; // no sensors, return true
|
||||||
}
|
}
|
||||||
@@ -372,11 +377,6 @@ bool TemperatureSensor::get_value_info(JsonObject output, const char * cmd, cons
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check of it a 'commmands' command
|
|
||||||
if (Helpers::toLower(cmd) == F_(commands)) {
|
|
||||||
return Command::list(EMSdevice::DeviceType::TEMPERATURESENSOR, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is for a specific sensor
|
// this is for a specific sensor
|
||||||
// make a copy of the string command for parsing, and lowercase it
|
// make a copy of the string command for parsing, and lowercase it
|
||||||
char sensor_name[30] = {'\0'};
|
char sensor_name[30] = {'\0'};
|
||||||
|
|||||||
Reference in New Issue
Block a user