@riddix/hamh 2.1.0-alpha.654 → 2.1.0-alpha.656

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -480,7 +480,7 @@ Newest first.
480
480
  | Contributor | Contributions |
481
481
  |-------------|---------------|
482
482
  | [@Yllelder](https://github.com/Yllelder) | 🌐 **Translator** - Spanish translation ([#314](https://github.com/RiDDiX/home-assistant-matter-hub/pull/314)) |
483
- | [@MStankiewiczOfficial](https://github.com/MStankiewiczOfficial) | 🌐 **Translator** - Polish translation ([#288](https://github.com/RiDDiX/home-assistant-matter-hub/pull/288)) |
483
+ | [@MStankiewiczOfficial](https://github.com/MStankiewiczOfficial) | 🌐 **Translator** - Polish translation ([#288](https://github.com/RiDDiX/home-assistant-matter-hub/pull/288), [#329](https://github.com/RiDDiX/home-assistant-matter-hub/pull/329)) |
484
484
  | [@aetasoul](https://github.com/aetasoul) | 🤖 **Code Contributor** - Immediate force sync on startup to beat stale Alexa queues ([#282](https://github.com/RiDDiX/home-assistant-matter-hub/pull/282)) |
485
485
  | [@omerfaruk-aran](https://github.com/omerfaruk-aran) | 🌐 Turkish translation ([#260](https://github.com/RiDDiX/home-assistant-matter-hub/pull/260)) + 🔧 Network debugging for "No Response" issues ([#129](https://github.com/RiDDiX/home-assistant-matter-hub/issues/129)) |
486
486
  | [@gustavakerstrom](https://github.com/gustavakerstrom) | 🤖 **Code Contributor** - Custom fan speed mapping ([#226](https://github.com/RiDDiX/home-assistant-matter-hub/pull/226)), template description fix ([#215](https://github.com/RiDDiX/home-assistant-matter-hub/pull/215)) |
@@ -179115,58 +179115,65 @@ function RvcOperationalStateServer2(config10) {
179115
179115
  var logger198 = Logger.get("VacuumRvcOperationalStateServer");
179116
179116
  function isCharging(entity) {
179117
179117
  const attrs = entity.attributes;
179118
- if (attrs.battery_icon?.includes("charging")) return true;
179119
179118
  if (attrs.is_charging === true || attrs.charging === true) return true;
179119
+ if (attrs.is_charging === false || attrs.charging === false) return false;
179120
+ const raw = attrs.battery_level ?? attrs.battery;
179121
+ const level = typeof raw === "number" ? raw : Number.parseFloat(String(raw ?? ""));
179122
+ if (Number.isFinite(level) && level >= 100) return false;
179123
+ if (attrs.battery_icon?.includes("charging")) return true;
179120
179124
  if (typeof attrs.status === "string" && attrs.status.toLowerCase().includes("charg"))
179121
179125
  return true;
179122
179126
  return false;
179123
179127
  }
179124
- var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
179125
- getOperationalState(entity) {
179126
- const state = entity.state;
179127
- const cleaningStates = [
179128
- VacuumState.cleaning,
179129
- VacuumState.segment_cleaning,
179130
- VacuumState.zone_cleaning,
179131
- VacuumState.spot_cleaning,
179132
- VacuumState.mop_cleaning
179133
- ];
179134
- let operationalState;
179135
- if (state === VacuumState.docked) {
179136
- if (isCharging(entity)) {
179137
- operationalState = RvcOperationalState3.OperationalState.Charging;
179138
- } else {
179139
- operationalState = RvcOperationalState3.OperationalState.Docked;
179140
- }
179141
- } else if (state === VacuumState.returning) {
179142
- operationalState = RvcOperationalState3.OperationalState.SeekingCharger;
179143
- } else if (cleaningStates.includes(state)) {
179128
+ function mapVacuumOperationalState(entity) {
179129
+ const state = entity.state;
179130
+ const cleaningStates = [
179131
+ VacuumState.cleaning,
179132
+ VacuumState.segment_cleaning,
179133
+ VacuumState.zone_cleaning,
179134
+ VacuumState.spot_cleaning,
179135
+ VacuumState.mop_cleaning
179136
+ ];
179137
+ let operationalState;
179138
+ if (state === VacuumState.docked) {
179139
+ if (isCharging(entity)) {
179140
+ operationalState = RvcOperationalState3.OperationalState.Charging;
179141
+ } else {
179142
+ operationalState = RvcOperationalState3.OperationalState.Docked;
179143
+ }
179144
+ } else if (state === VacuumState.returning) {
179145
+ operationalState = RvcOperationalState3.OperationalState.SeekingCharger;
179146
+ } else if (cleaningStates.includes(state)) {
179147
+ operationalState = RvcOperationalState3.OperationalState.Running;
179148
+ } else if (state === VacuumState.paused) {
179149
+ operationalState = RvcOperationalState3.OperationalState.Paused;
179150
+ } else if (state === VacuumState.idle) {
179151
+ if (isCharging(entity)) {
179152
+ operationalState = RvcOperationalState3.OperationalState.Charging;
179153
+ } else {
179154
+ operationalState = RvcOperationalState3.OperationalState.Stopped;
179155
+ }
179156
+ } else if (state === VacuumState.error || state === "unavailable") {
179157
+ operationalState = RvcOperationalState3.OperationalState.Error;
179158
+ } else {
179159
+ if (state.toLowerCase().includes("clean")) {
179160
+ logger198.info(
179161
+ `Unknown vacuum state "${state}" contains 'clean', treating as Running`
179162
+ );
179144
179163
  operationalState = RvcOperationalState3.OperationalState.Running;
179145
- } else if (state === VacuumState.paused) {
179146
- operationalState = RvcOperationalState3.OperationalState.Paused;
179147
- } else if (state === VacuumState.idle) {
179148
- if (isCharging(entity)) {
179149
- operationalState = RvcOperationalState3.OperationalState.Charging;
179150
- } else {
179151
- operationalState = RvcOperationalState3.OperationalState.Stopped;
179152
- }
179153
- } else if (state === VacuumState.error || state === "unavailable") {
179154
- operationalState = RvcOperationalState3.OperationalState.Error;
179155
179164
  } else {
179156
- if (state.toLowerCase().includes("clean")) {
179157
- logger198.info(
179158
- `Unknown vacuum state "${state}" contains 'clean', treating as Running`
179159
- );
179160
- operationalState = RvcOperationalState3.OperationalState.Running;
179161
- } else {
179162
- logger198.info(`Unknown vacuum state "${state}", treating as Stopped`);
179163
- operationalState = RvcOperationalState3.OperationalState.Stopped;
179164
- }
179165
+ logger198.info(`Unknown vacuum state "${state}", treating as Stopped`);
179166
+ operationalState = RvcOperationalState3.OperationalState.Stopped;
179165
179167
  }
179166
- logger198.debug(
179167
- `Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
179168
- );
179169
- return operationalState;
179168
+ }
179169
+ logger198.debug(
179170
+ `Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
179171
+ );
179172
+ return operationalState;
179173
+ }
179174
+ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
179175
+ getOperationalState(entity) {
179176
+ return mapVacuumOperationalState(entity);
179170
179177
  },
179171
179178
  pause: (_, agent) => {
179172
179179
  const supportedFeatures = agent.get(HomeAssistantEntityBehavior).entity.state.attributes.supported_features ?? 0;