fix HA discovery not refreshed when entity customization is cleared

This commit is contained in:
proddy
2026-10-27 22:09:16 +01:00
parent 33df92fdba
commit 63935c4748
6 changed files with 390 additions and 392 deletions
+4 -4
View File
@@ -33,7 +33,7 @@
"@table-library/react-table-library": "4.1.15",
"alova": "^3.5.5",
"jwt-decode": "^4.0.0",
"preact": "^11.0.1",
"preact": "^11.0.2",
"react": "^19.3.1",
"react-dom": "^19.3.1",
"react-icons": "^5.7.0",
@@ -56,9 +56,9 @@
"rollup-plugin-visualizer": "^7.1.1",
"terser": "^5.51.2",
"typescript": "^6.0.3",
"typescript-eslint": "^8.72.0",
"vite": "^8.3.4",
"typescript-eslint": "^8.72.1",
"vite": "^8.3.5",
"vite-plugin-imagemin": "^0.6.1"
},
"packageManager": "pnpm@12.14.0"
"packageManager": "pnpm@12.15.0"
}
+294 -294
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -17,5 +17,5 @@
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
"prettier": "^3.9.10"
},
"packageManager": "pnpm@12.14.0"
"packageManager": "pnpm@12.15.0"
}
+81 -81
View File
@@ -7,153 +7,153 @@ importers:
configDependencies: {}
packageManagerDependencies:
pnpm:
specifier: 12.14.0
version: 12.14.0
specifier: 12.15.0
version: 12.15.0
packages:
'@pnpm/exe.android-arm64@12.14.0':
resolution: {integrity: sha512-+iSh7x21C3A2hqc+Z0ZmbKTcn6YNlzrXM142PsnQH/dLj0DYxFzoBvc6XAnL/yfQ5nnH2ebBiRj/zVxr61fZbQ==}
'@pnpm/exe.android-arm64@12.15.0':
resolution: {integrity: sha512-eVCqmscY70LGvgRzu3mi8IBWBFGix+a6mNZoWmXxESsBdeiKEF9xQSuaeel10yn+zI7TXy2jlI63vFLzETk+aQ==}
cpu: [arm64]
os: [android]
'@pnpm/exe.android-x64@12.14.0':
resolution: {integrity: sha512-qT+0LqEr2wBVaxcG2T8cX/R8SSRz2Rvpp8nRR4fh8tnGUZRch87gFmsHUAoSQh7w6j1h0qTjrA384j4xi8frvw==}
'@pnpm/exe.android-x64@12.15.0':
resolution: {integrity: sha512-Gx/WbkFcdUFUg8g8AShezcS9EiQxfYvdAm2hfKLO8sfJmJvKOCt5fzlgHWDzmGhoclibgW+tUGZ/KF4F4wOTCA==}
cpu: [x64]
os: [android]
'@pnpm/exe.darwin-arm64@12.14.0':
resolution: {integrity: sha512-tnrdUB8ecJoehuKKqi1YHCBVl61xtJ9XVGcx5EviC6fWO4DeGI8GtXrjvJxDBM3nuVjJeWistgsUp/N142x4sw==}
'@pnpm/exe.darwin-arm64@12.15.0':
resolution: {integrity: sha512-N0ZykiDWCvqSBJvt71j7cSoBR993FqvYZFtmpCtqvW3pguiI+NAgraLPA5OTwu5mV+/d8hYpVcPktJA3xFDLtA==}
cpu: [arm64]
os: [darwin]
'@pnpm/exe.darwin-x64@12.14.0':
resolution: {integrity: sha512-vlBfGkruqQRsEHTW43cPwpYd7QlbIJ//cvpAdb3bVXkI8SgTPoXhCnc05m+ZNiPrrEkBsX/t7KHw9aXpkzPm3Q==}
'@pnpm/exe.darwin-x64@12.15.0':
resolution: {integrity: sha512-7Ntr2HlBUxzwWOg7NwDxCbRW/3vXuqKO+hcXm+w3SBi9rrHY53li1wLqWVT7Gjxd+lVEHM1QJZo6WJEGFU8C6A==}
cpu: [x64]
os: [darwin]
'@pnpm/exe.freebsd-x64@12.14.0':
resolution: {integrity: sha512-Qg5rxBrGYl6Tfso+EyygPf84fY1Fzy55E/0or+iuYKtnf0vc0MlHJfVIlT7pBukMRntQHRik7hUi0Z4s7AlJsw==}
'@pnpm/exe.freebsd-x64@12.15.0':
resolution: {integrity: sha512-btOiyL7fL7W4uQGH0aqFai2TNC3IoKcZ7gNHBVbEFZt2dWrnrD0SufL3iGs3fLlmb4OtuU35uf4Zpr9V9Jh9mA==}
cpu: [x64]
os: [freebsd]
'@pnpm/exe.linux-arm64-musl@12.14.0':
resolution: {integrity: sha512-DRIe4yQkXBGA/PhVJdzlbnllxBdAtnMMvTVLLcGpsK5FvJz9kxD2Hyxtn68ovmNkVX06f6p45cQwfm3wx2jn1A==}
'@pnpm/exe.linux-arm64-musl@12.15.0':
resolution: {integrity: sha512-pNC38k+O+90FOjbPNSnw0E7apq1PKTmz3fFe1amn+lys/U5kL++uzir8bRiho8ONcyA3d9EU7wdqcY0DKkj+JA==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-arm64@12.14.0':
resolution: {integrity: sha512-7joGShZ44Nk3WpNU+60JoOPjCXlgxhJAq11S2UiVtwCUDgTer1yTPPfxGW8pxaD6046actYLIYDbZNlubHWs0A==}
'@pnpm/exe.linux-arm64@12.15.0':
resolution: {integrity: sha512-qML/8aCXslh8td/w4U+HJNqUcZ2+m6EfTbWScIzZRmyPsRFN+xB4LP1U/hymxc1iSJiKtG56HJx2fvUErWFIGw==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-ppc64@12.14.0':
resolution: {integrity: sha512-gSoryn7ySdXd//gjgf3MvvA8ZerJayaSbuMZMtAWq4vb2/wlVEgpl0Kvqt54y58TRj533Qjq2txKgnxd4JyoAQ==}
'@pnpm/exe.linux-ppc64@12.15.0':
resolution: {integrity: sha512-tjRDUUl7RCJ6T/6eoNPxOqkwU4Mzi5RtTXmSAxujyz37OTwwsMU7Ps087Zk4gHcUvRSeyF40ZFsew3vtE+nmUA==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-riscv64@12.14.0':
resolution: {integrity: sha512-EMjew1H9WqQ7pL+tYqCPwiuB+0PeCiJRV7fyWeuFw0wwYUajFBjcaPO3IGAVu9sdmJDU+e+HYv/Zey6aKae0Vw==}
'@pnpm/exe.linux-riscv64@12.15.0':
resolution: {integrity: sha512-bF1uBWEfbwaeryz6lIiaJ8AWD082otZfvzGX5l+6LZRpRwUEpJHUsJrORaYP5/cNMv5ZR2p6TvvcJcQzwtDzmw==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-s390x@12.14.0':
resolution: {integrity: sha512-shYOj/SFoXD35fHe0pWr2JofwSXulC0BnEIXLj2QokDi0EF//AfKsui35yKIkTEl+s2VJybc3PO4iJNhKIj5Qw==}
'@pnpm/exe.linux-s390x@12.15.0':
resolution: {integrity: sha512-zKMhIzsexYMToeLmqV5jPsvV/f9vwsJb2kUH2NFYzalbxImeBrlA4kL7GwF8gD4pagV6jYYcJb8RjbZIdjHptg==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@pnpm/exe.linux-x64-musl@12.14.0':
resolution: {integrity: sha512-btZiZ2Ot0llKK1ndSfA5i3IRX7/S0VrmzseNH/BJ4c+Cady+S81H6vvU1zByggHMyqQhC8OgxO5PiIY7D9bH0Q==}
'@pnpm/exe.linux-x64-musl@12.15.0':
resolution: {integrity: sha512-A9J0Jg0Rdx+qQU4qXtwyST5tto9IOu1zi4fDk35nbc6DWahggbcKtFvZPKFwL2qgUXGXOX//hXv6z/sp6emO8A==}
cpu: [x64]
os: [linux]
libc: [musl]
'@pnpm/exe.linux-x64@12.14.0':
resolution: {integrity: sha512-F6K8e/jWxiuEYJaQtRRUG9ynBSTEHa+t7Lf86MKuOO5UA7WVVMbi+oB8nY6iKW++ncWS2yG6T9faXZGxqNsfoQ==}
'@pnpm/exe.linux-x64@12.15.0':
resolution: {integrity: sha512-yc+QlZR+9+nr29J4fRzhMoapgxTBDndq/+peyoq1XUufnQFnfbXUMFudDIKzHi545linGqmOmXfn0NoufNgcOg==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@pnpm/exe.win32-arm64@12.14.0':
resolution: {integrity: sha512-DOjlkVB6TtTKeAAe0hNZXn5S7YqESmo1Z6SGbR4BZNQ4isRg31XVHjX2RFTbY8gnZq68IwzyLmPqlEjMmYxofg==}
'@pnpm/exe.win32-arm64@12.15.0':
resolution: {integrity: sha512-fPXZxuY1VclkOga9bc53qNCXcegfeoBR8+Ue+AospDwKzuGGSHll0oDxkLfkmpjyRqpe7bH5DyQPYp/xSMaIVA==}
cpu: [arm64]
os: [win32]
'@pnpm/exe.win32-x64@12.14.0':
resolution: {integrity: sha512-/LSX6mew/sLf08XqcjemuklNKf1K/Ftpgj4//hK/HKzI2dKbmxDB27a/2OaQ5a0O3/3OFzlssXDziZsi+yVBwQ==}
'@pnpm/exe.win32-x64@12.15.0':
resolution: {integrity: sha512-nrd+Tp1We1DGj4DGG5Bea9lZNh9y1PjlLBdEwdInS4D0h0UIDtM7JaGGGDJhNzIwcHASyihWI7HLV+dtG+fhYg==}
cpu: [x64]
os: [win32]
pnpm@12.14.0:
resolution: {integrity: sha512-wYum2HmT09Fky16JSPMrLAbuhUSH4GzY2GeBNC+z5btGNDZwNHEehoArqpw3vqkGzhkprQjXCITJfYAd8TOJpg==}
engines: {node: '>=18.*'}
pnpm@12.15.0:
resolution: {integrity: sha512-s5UdbW/0qfE9x89WzSjSuOs328ycaOUuHhGRhz6p+CoBcoerULqtxczElPA2xnwOR+sTYIwvo29HcRth6hKOYQ==}
engines: {node: '>=18'}
hasBin: true
snapshots:
'@pnpm/exe.android-arm64@12.14.0':
'@pnpm/exe.android-arm64@12.15.0':
optional: true
'@pnpm/exe.android-x64@12.14.0':
'@pnpm/exe.android-x64@12.15.0':
optional: true
'@pnpm/exe.darwin-arm64@12.14.0':
'@pnpm/exe.darwin-arm64@12.15.0':
optional: true
'@pnpm/exe.darwin-x64@12.14.0':
'@pnpm/exe.darwin-x64@12.15.0':
optional: true
'@pnpm/exe.freebsd-x64@12.14.0':
'@pnpm/exe.freebsd-x64@12.15.0':
optional: true
'@pnpm/exe.linux-arm64-musl@12.14.0':
'@pnpm/exe.linux-arm64-musl@12.15.0':
optional: true
'@pnpm/exe.linux-arm64@12.14.0':
'@pnpm/exe.linux-arm64@12.15.0':
optional: true
'@pnpm/exe.linux-ppc64@12.14.0':
'@pnpm/exe.linux-ppc64@12.15.0':
optional: true
'@pnpm/exe.linux-riscv64@12.14.0':
'@pnpm/exe.linux-riscv64@12.15.0':
optional: true
'@pnpm/exe.linux-s390x@12.14.0':
'@pnpm/exe.linux-s390x@12.15.0':
optional: true
'@pnpm/exe.linux-x64-musl@12.14.0':
'@pnpm/exe.linux-x64-musl@12.15.0':
optional: true
'@pnpm/exe.linux-x64@12.14.0':
'@pnpm/exe.linux-x64@12.15.0':
optional: true
'@pnpm/exe.win32-arm64@12.14.0':
'@pnpm/exe.win32-arm64@12.15.0':
optional: true
'@pnpm/exe.win32-x64@12.14.0':
'@pnpm/exe.win32-x64@12.15.0':
optional: true
pnpm@12.14.0:
pnpm@12.15.0:
optionalDependencies:
'@pnpm/exe.android-arm64': 12.14.0
'@pnpm/exe.android-x64': 12.14.0
'@pnpm/exe.darwin-arm64': 12.14.0
'@pnpm/exe.darwin-x64': 12.14.0
'@pnpm/exe.freebsd-x64': 12.14.0
'@pnpm/exe.linux-arm64': 12.14.0
'@pnpm/exe.linux-arm64-musl': 12.14.0
'@pnpm/exe.linux-ppc64': 12.14.0
'@pnpm/exe.linux-riscv64': 12.14.0
'@pnpm/exe.linux-s390x': 12.14.0
'@pnpm/exe.linux-x64': 12.14.0
'@pnpm/exe.linux-x64-musl': 12.14.0
'@pnpm/exe.win32-arm64': 12.14.0
'@pnpm/exe.win32-x64': 12.14.0
'@pnpm/exe.android-arm64': 12.15.0
'@pnpm/exe.android-x64': 12.15.0
'@pnpm/exe.darwin-arm64': 12.15.0
'@pnpm/exe.darwin-x64': 12.15.0
'@pnpm/exe.freebsd-x64': 12.15.0
'@pnpm/exe.linux-arm64': 12.15.0
'@pnpm/exe.linux-arm64-musl': 12.15.0
'@pnpm/exe.linux-ppc64': 12.15.0
'@pnpm/exe.linux-riscv64': 12.15.0
'@pnpm/exe.linux-s390x': 12.15.0
'@pnpm/exe.linux-x64': 12.15.0
'@pnpm/exe.linux-x64-musl': 12.15.0
'@pnpm/exe.win32-arm64': 12.15.0
'@pnpm/exe.win32-x64': 12.15.0
---
lockfileVersion: '9.0'
@@ -194,16 +194,16 @@ packages:
resolution: {integrity: sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==}
engines: {node: '>=6.9.0'}
'@babel/helper-string-parser@7.29.7':
resolution: {integrity: sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==}
'@babel/helper-string-parser@7.29.11':
resolution: {integrity: sha512-snZbO7MEDOof+hvNa97EjEY7qD7h2kwvQr5AJC3ZhQudKW5dnej6k3kP9NQV88hJwaS8vDqRLFo9rivLEhle2g==}
engines: {node: '>=6.9.0'}
'@babel/helper-validator-identifier@7.29.7':
resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==}
engines: {node: '>=6.9.0'}
'@babel/parser@7.29.9':
resolution: {integrity: sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==}
'@babel/parser@7.29.11':
resolution: {integrity: sha512-OZ6+oaK7GMyg3IfCpj8JOmn8n+w2rJbDT0LLfVDTLb1ZFeKDh3AiNELgCMUw175IJHSkLl74hG0M0VLsvx+gag==}
engines: {node: '>=6.0.0'}
hasBin: true
@@ -215,8 +215,8 @@ packages:
resolution: {integrity: sha512-B3lYAs2nkKskbgQ1nfy8Ma9ao9Q1rntTAQHrzzyDuj+TSO+X3le6PfWwqDvodsb+OumE10eMFfuMCTQSQ5iuIQ==}
engines: {node: '>=6.9.0'}
'@babel/types@7.29.8':
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
'@babel/types@7.29.11':
resolution: {integrity: sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==}
engines: {node: '>=6.9.0'}
'@jridgewell/gen-mapping@0.3.13':
@@ -318,43 +318,43 @@ snapshots:
'@babel/generator@7.29.8':
dependencies:
'@babel/parser': 7.29.9
'@babel/types': 7.29.8
'@babel/parser': 7.29.11
'@babel/types': 7.29.11
'@jridgewell/gen-mapping': 0.3.13
'@jridgewell/trace-mapping': 0.3.31
jsesc: 3.1.0
'@babel/helper-globals@7.29.7': {}
'@babel/helper-string-parser@7.29.7': {}
'@babel/helper-string-parser@7.29.11': {}
'@babel/helper-validator-identifier@7.29.7': {}
'@babel/parser@7.29.9':
'@babel/parser@7.29.11':
dependencies:
'@babel/types': 7.29.8
'@babel/types': 7.29.11
'@babel/template@7.29.7':
dependencies:
'@babel/code-frame': 7.29.7
'@babel/parser': 7.29.9
'@babel/types': 7.29.8
'@babel/parser': 7.29.11
'@babel/types': 7.29.11
'@babel/traverse@7.29.10':
dependencies:
'@babel/code-frame': 7.29.7
'@babel/generator': 7.29.8
'@babel/helper-globals': 7.29.7
'@babel/parser': 7.29.9
'@babel/parser': 7.29.11
'@babel/template': 7.29.7
'@babel/types': 7.29.8
'@babel/types': 7.29.11
debug: 4.4.3
transitivePeerDependencies:
- supports-color
'@babel/types@7.29.8':
'@babel/types@7.29.11':
dependencies:
'@babel/helper-string-parser': 7.29.7
'@babel/helper-string-parser': 7.29.11
'@babel/helper-validator-identifier': 7.29.7
'@jridgewell/gen-mapping@0.3.13':
@@ -376,9 +376,9 @@ snapshots:
'@trivago/prettier-plugin-sort-imports@6.0.2(prettier@3.9.10)':
dependencies:
'@babel/generator': 7.29.8
'@babel/parser': 7.29.9
'@babel/parser': 7.29.11
'@babel/traverse': 7.29.10
'@babel/types': 7.29.8
'@babel/types': 7.29.11
javascript-natural-sort: 0.7.1
lodash-es: 4.18.1
minimatch: 9.0.9
+1
View File
@@ -1358,3 +1358,4 @@ POWERON
crashtest
otadata
merase
Seeed
+8 -11
View File
@@ -1337,13 +1337,14 @@ void EMSdevice::setCustomizationEntity(const std::string & entity_id) {
if (entity_name == shortname) {
// check the masks
uint8_t current_mask = dv.state >> 4;
uint8_t new_mask = Helpers::hextoint(entity_id.substr(0, 2).c_str()); // first character contains mask flags
bool had_limit = dv.custom_fullname().find('>') != std::string::npos || dv.custom_fullname().find('<') != std::string::npos;
uint8_t current_mask = dv.state >> 4;
uint8_t new_mask = Helpers::hextoint(entity_id.substr(0, 2).c_str()); // first character contains mask flags
bool had_limit = dv.custom_fullname().find('>') != std::string::npos || dv.custom_fullname().find('<') != std::string::npos;
std::string new_custom_name = has_custom_name ? entity_id.substr(custom_name_pos + 1) : std::string{};
// if it's a new mask, reconfigure HA
if (Mqtt::ha_enabled() && (has_custom_name || ((current_mask ^ new_mask) & (DeviceValueState::DV_READONLY >> 4)))) {
// remove ha config on change of dv_readonly flag
// reconfigure HA on a new name or limits (also when cleared), or a change of the dv_readonly flag
if (Mqtt::ha_enabled()
&& (has_custom_name || new_custom_name != dv.custom_fullname() || ((current_mask ^ new_mask) & (DeviceValueState::DV_READONLY >> 4)))) {
dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED);
Mqtt::publish_ha_sensor_config_dv(dv, "", "", "", true); // delete topic (remove = true)
}
@@ -1352,11 +1353,7 @@ void EMSdevice::setCustomizationEntity(const std::string & entity_id) {
dv.state = ((dv.state & 0x0F) | (new_mask << 4)); // set state high bits to flag
// set the custom name if it has one, or clear it
if (has_custom_name) {
dv.set_custom_fullname(entity_id.substr(custom_name_pos + 1));
} else {
dv.set_custom_fullname("");
}
dv.set_custom_fullname(new_custom_name);
// Climate discovery reads its own min/max. selRoomTemp keeps the register limits.
// A custom range is copied across; clearing it restores the limits haclimate was registered with (5..30).