rework process telegram

This commit is contained in:
MichaelDvP
2024-01-23 13:47:28 +01:00
parent 1491f283a8
commit 9266454f82
3 changed files with 154 additions and 138 deletions

View File

@@ -24,8 +24,8 @@
"@babel/core": "^7.23.7",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.5",
"@mui/material": "^5.15.5",
"@mui/icons-material": "^5.15.6",
"@mui/material": "^5.15.6",
"@table-library/react-table-library": "4.1.7",
"@types/imagemin": "^8.0.5",
"@types/lodash-es": "^4.17.12",
@@ -52,8 +52,8 @@
"devDependencies": {
"@preact/compat": "^17.1.2",
"@preact/preset-vite": "^2.8.1",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"concurrently": "^8.2.2",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",

View File

@@ -860,15 +860,15 @@ __metadata:
languageName: node
linkType: hard
"@floating-ui/react-dom@npm:^2.0.5":
version: 2.0.5
resolution: "@floating-ui/react-dom@npm:2.0.5"
"@floating-ui/react-dom@npm:^2.0.6":
version: 2.0.6
resolution: "@floating-ui/react-dom@npm:2.0.6"
dependencies:
"@floating-ui/dom": "npm:^1.5.4"
peerDependencies:
react: ">=16.8.0"
react-dom: ">=16.8.0"
checksum: b4fc008c725149b9565949184d844c914a8fa2687636c3c1166a1d52ca58537b3ba9b0a0e2945cf424662c846e60b173df0d325af7e700a31550e5e0b346070a
checksum: 4a3f828370c1b14af0e4d24df18de7b2cfd6695c189532d5949daaa43cba13ce7f231c71783b47e8c54baefcc2542650d82a4a6cebcf3d9091673f2a53d3a2cb
languageName: node
linkType: hard
@@ -970,14 +970,14 @@ __metadata:
languageName: node
linkType: hard
"@mui/base@npm:5.0.0-beta.32":
version: 5.0.0-beta.32
resolution: "@mui/base@npm:5.0.0-beta.32"
"@mui/base@npm:5.0.0-beta.33":
version: 5.0.0-beta.33
resolution: "@mui/base@npm:5.0.0-beta.33"
dependencies:
"@babel/runtime": "npm:^7.23.8"
"@floating-ui/react-dom": "npm:^2.0.5"
"@floating-ui/react-dom": "npm:^2.0.6"
"@mui/types": "npm:^7.2.13"
"@mui/utils": "npm:^5.15.5"
"@mui/utils": "npm:^5.15.6"
"@popperjs/core": "npm:^2.11.8"
clsx: "npm:^2.1.0"
prop-types: "npm:^15.8.1"
@@ -988,20 +988,20 @@ __metadata:
peerDependenciesMeta:
"@types/react":
optional: true
checksum: c88cd8a412ecaeaf0040e20708b2a607b9594a4462449ad06b90e96465aad0dada23295f801ed72851025fd023ababc410b6a48fcb69d7cdef90b55e62aa9a11
checksum: 8898430f4c8f6d9ce2aa46f621e7a84e800ee2a08fd6ce121e999494c77256060376d11e4d05640e8848eca1d8d553e95c2a150ce68d6416a1517136e8253ef8
languageName: node
linkType: hard
"@mui/core-downloads-tracker@npm:^5.15.5":
version: 5.15.5
resolution: "@mui/core-downloads-tracker@npm:5.15.5"
checksum: 4c9b1281ebe8d17d402e22f7f50c347c0b3918b1ed17af721f4de5ce282d90bc6d90fe9730595998b2bbb2f7ebe57fc55d4c858f31754fccdb606af472a59dc8
"@mui/core-downloads-tracker@npm:^5.15.6":
version: 5.15.6
resolution: "@mui/core-downloads-tracker@npm:5.15.6"
checksum: 38833a893c82e6244814be8321819fd08379a872068e06e1511f01ce243e21258b108fe5ddc66a02fddf07bba95b6cb6e9fc59538733c6072cab59b701ccb5c1
languageName: node
linkType: hard
"@mui/icons-material@npm:^5.15.5":
version: 5.15.5
resolution: "@mui/icons-material@npm:5.15.5"
"@mui/icons-material@npm:^5.15.6":
version: 5.15.6
resolution: "@mui/icons-material@npm:5.15.6"
dependencies:
"@babel/runtime": "npm:^7.23.8"
peerDependencies:
@@ -1011,20 +1011,20 @@ __metadata:
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 25feb86a76ce83c81391c95d0c1c867e988cc7bc1b5a05c5698b71cb3cd1005fd148b07c2fa8908cda9fc4e44ea8b6e0fd2197bc0abafac0ee4880b477852eea
checksum: b7a39bbf86beac98ac0160e6bf4c6130fae16527cbd4e545e2fbcf07105c44c86364a0e03d27120225d30e01ca1a127caf693ba5ee6d0ac34421bc6db14cdb55
languageName: node
linkType: hard
"@mui/material@npm:^5.15.5":
version: 5.15.5
resolution: "@mui/material@npm:5.15.5"
"@mui/material@npm:^5.15.6":
version: 5.15.6
resolution: "@mui/material@npm:5.15.6"
dependencies:
"@babel/runtime": "npm:^7.23.8"
"@mui/base": "npm:5.0.0-beta.32"
"@mui/core-downloads-tracker": "npm:^5.15.5"
"@mui/system": "npm:^5.15.5"
"@mui/base": "npm:5.0.0-beta.33"
"@mui/core-downloads-tracker": "npm:^5.15.6"
"@mui/system": "npm:^5.15.6"
"@mui/types": "npm:^7.2.13"
"@mui/utils": "npm:^5.15.5"
"@mui/utils": "npm:^5.15.6"
"@types/react-transition-group": "npm:^4.4.10"
clsx: "npm:^2.1.0"
csstype: "npm:^3.1.2"
@@ -1044,16 +1044,16 @@ __metadata:
optional: true
"@types/react":
optional: true
checksum: 2a094d94acfc8f945b6cc73b295799f3174d7292707230e9b9486d810990561778f5f228f2fdc13a064ae234d528fb28c9b53f6c487ca43e65dc17460886165c
checksum: c6aff7dc5b65c68b4a6e1d0b4cc9712b906f0d3d57dcda49d7d4dee15e53872dec292e71bbdb38800849dccb0565aa259635e00332e85c1a8ba372322c8eeab8
languageName: node
linkType: hard
"@mui/private-theming@npm:^5.15.5":
version: 5.15.5
resolution: "@mui/private-theming@npm:5.15.5"
"@mui/private-theming@npm:^5.15.6":
version: 5.15.6
resolution: "@mui/private-theming@npm:5.15.6"
dependencies:
"@babel/runtime": "npm:^7.23.8"
"@mui/utils": "npm:^5.15.5"
"@mui/utils": "npm:^5.15.6"
prop-types: "npm:^15.8.1"
peerDependencies:
"@types/react": ^17.0.0 || ^18.0.0
@@ -1061,13 +1061,13 @@ __metadata:
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 1b26bc897417dcd91bbc65af3584c3cdf6704e9beb707c97bb7977962536213d7c7bf8e1004cbe86a19625ed5feba82d3ad2997e943138ed36114a8a36bf0fed
checksum: f56b4c99c4a634a29ff84e8d75940a6972a270ba896dae8d38ac8dc8663fe5c3c97db847c545302c80e831350b867b87c8cad6afc25eeb97ee6e0291bb274528
languageName: node
linkType: hard
"@mui/styled-engine@npm:^5.15.5":
version: 5.15.5
resolution: "@mui/styled-engine@npm:5.15.5"
"@mui/styled-engine@npm:^5.15.6":
version: 5.15.6
resolution: "@mui/styled-engine@npm:5.15.6"
dependencies:
"@babel/runtime": "npm:^7.23.8"
"@emotion/cache": "npm:^11.11.0"
@@ -1082,19 +1082,19 @@ __metadata:
optional: true
"@emotion/styled":
optional: true
checksum: 10e38ed39f7defc26d7e14e9634afcd9d540eaa1b9aeb957a6d1154a14a3cca2843e9aa7ead126604728bbf2125203c1f157059c06b397ed0278fc4b7cfae5c5
checksum: 0c932a6aff4fdacc0f1dcf02768ef3d56dbed4cd58c8040e2ea33d1e0284d18183d759af240fc4a891469e0ace3a32e1b9403951ed996e6e8a736b45ccf20ecc
languageName: node
linkType: hard
"@mui/system@npm:^5.15.5":
version: 5.15.5
resolution: "@mui/system@npm:5.15.5"
"@mui/system@npm:^5.15.6":
version: 5.15.6
resolution: "@mui/system@npm:5.15.6"
dependencies:
"@babel/runtime": "npm:^7.23.8"
"@mui/private-theming": "npm:^5.15.5"
"@mui/styled-engine": "npm:^5.15.5"
"@mui/private-theming": "npm:^5.15.6"
"@mui/styled-engine": "npm:^5.15.6"
"@mui/types": "npm:^7.2.13"
"@mui/utils": "npm:^5.15.5"
"@mui/utils": "npm:^5.15.6"
clsx: "npm:^2.1.0"
csstype: "npm:^3.1.2"
prop-types: "npm:^15.8.1"
@@ -1110,7 +1110,7 @@ __metadata:
optional: true
"@types/react":
optional: true
checksum: bc40858eff92efe1424b4de5782ca48ec0bccfe2de244b00af8f8607a7f47b5ec7006a0e369d1c52ddb3fe01d7666d1f7ed6d9a9070bee28dfa4ab2cecc4d015
checksum: 742133972a60e2c137be9daf231dee47d296acb98742c6c198db94999119883bd36c24e5392eafa9c99e8fb3225883b5a20a282baf56fb29cf0a0ce51740df51
languageName: node
linkType: hard
@@ -1126,9 +1126,9 @@ __metadata:
languageName: node
linkType: hard
"@mui/utils@npm:^5.15.5":
version: 5.15.5
resolution: "@mui/utils@npm:5.15.5"
"@mui/utils@npm:^5.15.6":
version: 5.15.6
resolution: "@mui/utils@npm:5.15.6"
dependencies:
"@babel/runtime": "npm:^7.23.8"
"@types/prop-types": "npm:^15.7.11"
@@ -1140,7 +1140,7 @@ __metadata:
peerDependenciesMeta:
"@types/react":
optional: true
checksum: c8ff39a23ec540c6fd6495e44df6dc5531afca535cbb605f81cd5ef66af946e6c6415290caade8cfa0f61ecfb55703d8065c4968530c0b54c52d44f23a04cbfe
checksum: 7ed0131bc776f01ad64615cca21b6813d44b792d61bd5a17f8b4aab8387c8c72581322c2d0f4cd9664dfecec13268c2a00b50d8991f93a9abddaf22579d68c45
languageName: node
linkType: hard
@@ -1691,15 +1691,15 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/eslint-plugin@npm:^6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/eslint-plugin@npm:6.19.0"
"@typescript-eslint/eslint-plugin@npm:^6.19.1":
version: 6.19.1
resolution: "@typescript-eslint/eslint-plugin@npm:6.19.1"
dependencies:
"@eslint-community/regexpp": "npm:^4.5.1"
"@typescript-eslint/scope-manager": "npm:6.19.0"
"@typescript-eslint/type-utils": "npm:6.19.0"
"@typescript-eslint/utils": "npm:6.19.0"
"@typescript-eslint/visitor-keys": "npm:6.19.0"
"@typescript-eslint/scope-manager": "npm:6.19.1"
"@typescript-eslint/type-utils": "npm:6.19.1"
"@typescript-eslint/utils": "npm:6.19.1"
"@typescript-eslint/visitor-keys": "npm:6.19.1"
debug: "npm:^4.3.4"
graphemer: "npm:^1.4.0"
ignore: "npm:^5.2.4"
@@ -1712,44 +1712,44 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 5ed8483d792c4bc6ed697159c84a47ba5c35cd124949883813f2053b972537de3900a7ae26d4d6f370194f2cc7929baa2d09268e0b90118f20ed961cf6c176b9
checksum: e88a35527b066a42d0253d153183a360faedc1cd39867c541ce7cb1f7b22f8446bb913b998fcdeba269d5d4217888af42e6d64da5c0592b1f49ed5648d2e3e84
languageName: node
linkType: hard
"@typescript-eslint/parser@npm:^6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/parser@npm:6.19.0"
"@typescript-eslint/parser@npm:^6.19.1":
version: 6.19.1
resolution: "@typescript-eslint/parser@npm:6.19.1"
dependencies:
"@typescript-eslint/scope-manager": "npm:6.19.0"
"@typescript-eslint/types": "npm:6.19.0"
"@typescript-eslint/typescript-estree": "npm:6.19.0"
"@typescript-eslint/visitor-keys": "npm:6.19.0"
"@typescript-eslint/scope-manager": "npm:6.19.1"
"@typescript-eslint/types": "npm:6.19.1"
"@typescript-eslint/typescript-estree": "npm:6.19.1"
"@typescript-eslint/visitor-keys": "npm:6.19.1"
debug: "npm:^4.3.4"
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
peerDependenciesMeta:
typescript:
optional: true
checksum: 0c6280a69127cf521b3403be9877775eecda2b2e4e44a67874b0d9cf82ed95a7971dac2db633e55ec22f8026da2681137110b2924313421a22b7c03eba8cda67
checksum: 63ff00a56586879a62e40b27b55c94501173fcf2fb5a620d01e7505851b4bb20feb1e7fbad36010af97aefc0a722267d9ce3aa004abab22cb7eb23eebb0102ce
languageName: node
linkType: hard
"@typescript-eslint/scope-manager@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/scope-manager@npm:6.19.0"
"@typescript-eslint/scope-manager@npm:6.19.1":
version: 6.19.1
resolution: "@typescript-eslint/scope-manager@npm:6.19.1"
dependencies:
"@typescript-eslint/types": "npm:6.19.0"
"@typescript-eslint/visitor-keys": "npm:6.19.0"
checksum: d36c51c05e14c51ce13181120eeea46d1edd59ed1ff16dc4ec1f5532a975b5faec5c10a373aaa90545f82a12330c6cba18ecedc734e18288f5874855c48ba808
"@typescript-eslint/types": "npm:6.19.1"
"@typescript-eslint/visitor-keys": "npm:6.19.1"
checksum: 2a17f68d3c41582bfac7ecd192e2c2539cf4d2c9728a7018d842da7a8a23986b8a1f8cfcb59862c909b483140a2d164a4ba44451905e0a141378e5dd0df056cc
languageName: node
linkType: hard
"@typescript-eslint/type-utils@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/type-utils@npm:6.19.0"
"@typescript-eslint/type-utils@npm:6.19.1":
version: 6.19.1
resolution: "@typescript-eslint/type-utils@npm:6.19.1"
dependencies:
"@typescript-eslint/typescript-estree": "npm:6.19.0"
"@typescript-eslint/utils": "npm:6.19.0"
"@typescript-eslint/typescript-estree": "npm:6.19.1"
"@typescript-eslint/utils": "npm:6.19.1"
debug: "npm:^4.3.4"
ts-api-utils: "npm:^1.0.1"
peerDependencies:
@@ -1757,23 +1757,23 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: f1f20ac28c03dd18546050b63ec0b0fd8c67780265ccb9ef566f16441c3de5deb2607a6046fefdebe8a43ac11fecdf0b009f8e5f70a3d15916d855be74b0f3bb
checksum: 5150b897d8b3778c549c6b964b031981da1039dfa0fb89a0eb92702735ca55793d2f840af14b340eccbca81669ba3dd02d7f09fb420fb66b18ec9f1f211b3243
languageName: node
linkType: hard
"@typescript-eslint/types@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/types@npm:6.19.0"
checksum: 396ad2ad9f2d759dd87bc880a1ffc9d11fda04db8af9402abb4e8eccd58c01fa2d26e38b186526d0b457012f7c912e7afdab2a3798a73aa0ae34abaf50d617ae
"@typescript-eslint/types@npm:6.19.1":
version: 6.19.1
resolution: "@typescript-eslint/types@npm:6.19.1"
checksum: 93f3ded80b81a1b8686866b93e36ddf9bac04604d09e88d7ed1ec25b6b2f49ff64747d8d194ba1f3215e231fd0790b88fb5ecadcc6ed53ff584f8c0b87423216
languageName: node
linkType: hard
"@typescript-eslint/typescript-estree@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/typescript-estree@npm:6.19.0"
"@typescript-eslint/typescript-estree@npm:6.19.1":
version: 6.19.1
resolution: "@typescript-eslint/typescript-estree@npm:6.19.1"
dependencies:
"@typescript-eslint/types": "npm:6.19.0"
"@typescript-eslint/visitor-keys": "npm:6.19.0"
"@typescript-eslint/types": "npm:6.19.1"
"@typescript-eslint/visitor-keys": "npm:6.19.1"
debug: "npm:^4.3.4"
globby: "npm:^11.1.0"
is-glob: "npm:^4.0.3"
@@ -1783,34 +1783,34 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 06e24bb145a302299a6cf86b36652bd4d7080c4e88517ebc24bdc137c57425a68db256ba628ce16b568bfec8020ae2a748ccee93e304efeded329cb3292b17bf
checksum: 3ce91dd477ccb2cc3cf5d07ac8d23792988f4fad78bfd39783292846f32daea5081d3790ba9cc795d9de89ea2e1d55dc9c3d2aeaa8597093b0f6ac3a206195e9
languageName: node
linkType: hard
"@typescript-eslint/utils@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/utils@npm:6.19.0"
"@typescript-eslint/utils@npm:6.19.1":
version: 6.19.1
resolution: "@typescript-eslint/utils@npm:6.19.1"
dependencies:
"@eslint-community/eslint-utils": "npm:^4.4.0"
"@types/json-schema": "npm:^7.0.12"
"@types/semver": "npm:^7.5.0"
"@typescript-eslint/scope-manager": "npm:6.19.0"
"@typescript-eslint/types": "npm:6.19.0"
"@typescript-eslint/typescript-estree": "npm:6.19.0"
"@typescript-eslint/scope-manager": "npm:6.19.1"
"@typescript-eslint/types": "npm:6.19.1"
"@typescript-eslint/typescript-estree": "npm:6.19.1"
semver: "npm:^7.5.4"
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
checksum: 4080c36331204ffef9f218e29f43da767f17551fa4d3877c3d3b49194f7c7382dd9ae2124e7b5ebd47d5556946bb6ad195b47d7d215553efabacdebf81b9e74d
checksum: f8931df675defa84af373c81bbb13cc34c2fcf0803c687a38b982e85335dbf2fb8415667fbabaa043df0326ba3e98ed974104bbd21f09ec538304fc3adeed0c3
languageName: node
linkType: hard
"@typescript-eslint/visitor-keys@npm:6.19.0":
version: 6.19.0
resolution: "@typescript-eslint/visitor-keys@npm:6.19.0"
"@typescript-eslint/visitor-keys@npm:6.19.1":
version: 6.19.1
resolution: "@typescript-eslint/visitor-keys@npm:6.19.1"
dependencies:
"@typescript-eslint/types": "npm:6.19.0"
"@typescript-eslint/types": "npm:6.19.1"
eslint-visitor-keys: "npm:^3.4.1"
checksum: 8d51c0b8d94c5df044fde958f62741cef55be97c6a3a16c47e4df9af7b2ff13aa1ee03ca5240777481dca53f3b7a9b00b329e50aff5e3ad829d96bc5f63ca2c3
checksum: b41f3247520e1e4d3e43876843b03f0d887e544d4ac8a9e1f4b25d08568da36fedde883fa226488a595f688198859cd0290d0f1351c2ca6cbc30cca2c90adf21
languageName: node
linkType: hard
@@ -1829,8 +1829,8 @@ __metadata:
"@babel/core": "npm:^7.23.7"
"@emotion/react": "npm:^11.11.3"
"@emotion/styled": "npm:^11.11.0"
"@mui/icons-material": "npm:^5.15.5"
"@mui/material": "npm:^5.15.5"
"@mui/icons-material": "npm:^5.15.6"
"@mui/material": "npm:^5.15.6"
"@preact/compat": "npm:^17.1.2"
"@preact/preset-vite": "npm:^2.8.1"
"@table-library/react-table-library": "npm:4.1.7"
@@ -1840,8 +1840,8 @@ __metadata:
"@types/react": "npm:^18.2.48"
"@types/react-dom": "npm:^18.2.18"
"@types/react-router-dom": "npm:^5.3.3"
"@typescript-eslint/eslint-plugin": "npm:^6.19.0"
"@typescript-eslint/parser": "npm:^6.19.0"
"@typescript-eslint/eslint-plugin": "npm:^6.19.1"
"@typescript-eslint/parser": "npm:^6.19.1"
alova: "npm:^2.17.0"
async-validator: "npm:^4.2.5"
concurrently: "npm:^8.2.2"

View File

@@ -219,9 +219,9 @@ void EMSESP::uart_init() {
txservice_.tx_mode(tx_mode);
// force a fetch for all new values, unless Tx is set to off
if (tx_mode != 0) {
EMSESP::fetch_device_values();
}
// if (tx_mode != 0) {
// EMSESP::fetch_device_values();
// }
}
// return status of bus: connected (0), connected but Tx is broken (1), disconnected (2)
@@ -690,7 +690,7 @@ bool EMSESP::get_device_value_info(JsonObject root, const char * cmd, const int8
return EMSESP::webSchedulerService.get_value_info(root, cmd);
}
// own entities
// custom entities
if (devicetype == DeviceType::CUSTOM) {
return EMSESP::webCustomEntityService.get_value_info(root, cmd);
}
@@ -924,49 +924,65 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
// calls the associated process function for that EMS device
// 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
bool found = false;
bool knowndevice = false;
bool telegram_found = false;
uint8_t device_found = 0;
for (const auto & emsdevice : emsdevices) {
if (emsdevice->is_device_id(telegram->src) && (telegram->dest == 0 || telegram->dest == EMSbus::ems_bus_id())) {
knowndevice = true;
found = emsdevice->handle_telegram(telegram);
// if we correctly processed the telegram then follow up with sending it via MQTT (if enabled)
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->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
}
}
}
if (wait_validate_ == telegram->type_id) {
wait_validate_ = 0;
}
if (!found && telegram->message_length > 0) {
emsdevice->add_handlers_ignored(telegram->type_id);
}
telegram_found = emsdevice->handle_telegram(telegram);
device_found = emsdevice->unique_id();
break;
} else if (emsdevice->is_device_id(telegram->dest) && telegram->src != EMSbus::ems_bus_id()) {
emsdevice->handle_telegram(telegram);
}
}
// handle unknown broadcasted telegrams
if (!found && telegram->dest == 0) {
if (!telegram_found) {
// check for command to the device
for (const auto & emsdevice : emsdevices) {
if (emsdevice->is_device_id(telegram->dest) && telegram->src != EMSbus::ems_bus_id()) {
telegram_found = emsdevice->handle_telegram(telegram);
device_found = emsdevice->unique_id();
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 (Mqtt::connected() && telegram_found && (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;
}
}
// handle unknown broadcasted telegrams (or send to us)
if (!telegram_found && (telegram->dest == 0 || telegram->dest == EMSbus::ems_bus_id())) {
LOG_DEBUG("No telegram type handler found for ID 0x%02X (src 0x%02X)", telegram->type_id, telegram->src);
if (watch() == WATCH_UNKNOWN) {
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);
}
}
return found;
return telegram_found;
}
// return true if we have this device already registered