hyxi-cloud-api 1.3.7__tar.gz → 1.3.8__tar.gz

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.
Files changed (57) hide show
  1. {hyxi_cloud_api-1.3.7/src/hyxi_cloud_api.egg-info → hyxi_cloud_api-1.3.8}/PKG-INFO +1 -1
  2. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/pyproject.toml +1 -1
  3. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/src/hyxi_cloud_api/__init__.py +1 -1
  4. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/src/hyxi_cloud_api/api.py +36 -20
  5. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8/src/hyxi_cloud_api.egg-info}/PKG-INFO +1 -1
  6. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_compute_battery_metrics.py +21 -0
  7. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/LICENSE +0 -0
  8. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/README.md +0 -0
  9. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/setup.cfg +0 -0
  10. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/src/hyxi_cloud_api.egg-info/SOURCES.txt +0 -0
  11. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/src/hyxi_cloud_api.egg-info/dependency_links.txt +0 -0
  12. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/src/hyxi_cloud_api.egg-info/requires.txt +0 -0
  13. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/src/hyxi_cloud_api.egg-info/top_level.txt +0 -0
  14. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_additional_coverage.py +0 -0
  15. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_alarm_push.py +0 -0
  16. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_all_in_one.py +0 -0
  17. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_api.py +0 -0
  18. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_build_plant_tasks.py +0 -0
  19. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_caching.py +0 -0
  20. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_compute_derived_metrics.py +0 -0
  21. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_compute_grid_metrics.py +0 -0
  22. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_compute_load_metrics.py +0 -0
  23. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_device_control.py +0 -0
  24. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_device_entry.py +0 -0
  25. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_devices_errors.py +0 -0
  26. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_discovery.py +0 -0
  27. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_execute_device_tasks.py +0 -0
  28. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_execute_metric_tasks.py +0 -0
  29. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_execute_metrics_and_map_alarms.py +0 -0
  30. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_extract_battery_info.py +0 -0
  31. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_extract_device_info_metadata.py +0 -0
  32. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_fetch_and_process_alarms.py +0 -0
  33. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_fetch_device_list_for_plant.py +0 -0
  34. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_fetch_plants.py +0 -0
  35. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_fetch_state.py +0 -0
  36. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_fetch_sub_device_list.py +0 -0
  37. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_filter_metrics.py +0 -0
  38. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_fuzz_parser.py +0 -0
  39. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_get_f.py +0 -0
  40. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_handle_back_discovery_alarm.py +0 -0
  41. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_info_errors.py +0 -0
  42. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_mask_id.py +0 -0
  43. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_metrics_errors.py +0 -0
  44. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_parse_data_list.py +0 -0
  45. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_parse_ems_kv.py +0 -0
  46. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_parser.py +0 -0
  47. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_process_alarms_and_back_discovery.py +0 -0
  48. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_process_devices_for_plant.py +0 -0
  49. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_push.py +0 -0
  50. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_sanitize_dict.py +0 -0
  51. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_sanitize_list.py +0 -0
  52. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_security_fix.py +0 -0
  53. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_subscriptions.py +0 -0
  54. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_token_errors.py +0 -0
  55. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_token_handling.py +0 -0
  56. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_validate_post_rate_ms.py +0 -0
  57. {hyxi_cloud_api-1.3.7 → hyxi_cloud_api-1.3.8}/tests/test_validate_subscription_device_sns.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyxi-cloud-api
3
- Version: 1.3.7
3
+ Version: 1.3.8
4
4
  Summary: An async API client for HYXi Cloud.
5
5
  Author-email: Veldkornet <Veldkornet@users.noreply.github.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hyxi-cloud-api"
7
- version = "1.3.7"
7
+ version = "1.3.8"
8
8
  authors = [
9
9
  { name="Veldkornet", email="Veldkornet@users.noreply.github.com" },
10
10
  ]
@@ -5,5 +5,5 @@ from .api import HyxiApiClient
5
5
  # Module-level alias so callers can do: from hyxi_cloud_api import VPP_ACTIVE_MODES
6
6
  VPP_ACTIVE_MODES: frozenset[str] = HyxiApiClient.VPP_ACTIVE_MODES
7
7
 
8
- __version__ = "1.3.7"
8
+ __version__ = "1.3.8"
9
9
  __all__ = ["VPP_ACTIVE_MODES", "HyxiApiClient"]
@@ -646,28 +646,44 @@ def _compute_battery_metrics(
646
646
  return True
647
647
 
648
648
  # Unify cumulative battery charge energy telemetry keys to resolve polling/push mismatch
649
- charge_val = None
650
- if _is_valid_metric("batCharge"):
651
- charge_val = _get_f("batCharge", m_raw)
652
- elif _is_valid_metric("totalEchg"):
653
- charge_val = _get_f("totalEchg", m_raw)
654
-
655
- if charge_val is not None:
656
- derived["bat_charge_total"] = charge_val
657
- derived["totalEchg"] = charge_val
658
- derived["batCharge"] = charge_val
649
+ total_echg_val = (
650
+ _get_f("totalEchg", m_raw) if _is_valid_metric("totalEchg") else None
651
+ )
652
+ bat_charge_val = (
653
+ _get_f("batCharge", m_raw) if _is_valid_metric("batCharge") else None
654
+ )
655
+
656
+ if total_echg_val is not None:
657
+ derived["totalEchg"] = total_echg_val
658
+ derived["bat_charge_total"] = total_echg_val
659
+ if bat_charge_val is None:
660
+ derived["batCharge"] = total_echg_val
661
+
662
+ if bat_charge_val is not None:
663
+ derived["batCharge"] = bat_charge_val
664
+ if total_echg_val is None:
665
+ derived["totalEchg"] = bat_charge_val
666
+ derived["bat_charge_total"] = bat_charge_val
659
667
 
660
668
  # Unify cumulative battery discharge energy telemetry keys to resolve polling/push mismatch
661
- discharge_val = None
662
- if _is_valid_metric("batDisCharge"):
663
- discharge_val = _get_f("batDisCharge", m_raw)
664
- elif _is_valid_metric("totalEdchg"):
665
- discharge_val = _get_f("totalEdchg", m_raw)
666
-
667
- if discharge_val is not None:
668
- derived["bat_discharge_total"] = discharge_val
669
- derived["totalEdchg"] = discharge_val
670
- derived["batDisCharge"] = discharge_val
669
+ total_edchg_val = (
670
+ _get_f("totalEdchg", m_raw) if _is_valid_metric("totalEdchg") else None
671
+ )
672
+ bat_discharge_val = (
673
+ _get_f("batDisCharge", m_raw) if _is_valid_metric("batDisCharge") else None
674
+ )
675
+
676
+ if total_edchg_val is not None:
677
+ derived["totalEdchg"] = total_edchg_val
678
+ derived["bat_discharge_total"] = total_edchg_val
679
+ if bat_discharge_val is None:
680
+ derived["batDisCharge"] = total_edchg_val
681
+
682
+ if bat_discharge_val is not None:
683
+ derived["batDisCharge"] = bat_discharge_val
684
+ if total_edchg_val is None:
685
+ derived["totalEdchg"] = bat_discharge_val
686
+ derived["bat_discharge_total"] = bat_discharge_val
671
687
 
672
688
 
673
689
  def _compute_pv_metrics(m_raw: dict, derived: dict[str, float]) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyxi-cloud-api
3
- Version: 1.3.7
3
+ Version: 1.3.8
4
4
  Summary: An async API client for HYXi Cloud.
5
5
  Author-email: Veldkornet <Veldkornet@users.noreply.github.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -107,3 +107,24 @@ def test_compute_battery_metrics_none_device_type():
107
107
  _compute_battery_metrics(m_raw, derived, None) # type: ignore
108
108
  assert derived["bat_charging"] == 100.0
109
109
  assert derived["bat_power_dc"] == -100.0
110
+
111
+
112
+ def test_compute_battery_metrics_both_present():
113
+ """Test that when both polling and daily keys are present, they are preserved.
114
+
115
+ Cumulative values should take priority for battery totals.
116
+ """
117
+ derived: dict[str, float] = {}
118
+ m_raw = {
119
+ "totalEchg": 366.3,
120
+ "totalEdchg": 371.3,
121
+ "batCharge": 2.3,
122
+ "batDisCharge": 4.4,
123
+ }
124
+ _compute_battery_metrics(m_raw, derived, "OTHER")
125
+ assert derived["bat_charge_total"] == 366.3
126
+ assert derived["bat_discharge_total"] == 371.3
127
+ assert derived["totalEchg"] == 366.3
128
+ assert derived["totalEdchg"] == 371.3
129
+ assert derived["batCharge"] == 2.3
130
+ assert derived["batDisCharge"] == 4.4
File without changes
File without changes
File without changes