diff --git a/.github/ISSUE_TEMPLATE/1-report-an-issue.yaml b/.github/ISSUE_TEMPLATE/1-report-an-issue.yaml index 78c83b3..6507007 100644 --- a/.github/ISSUE_TEMPLATE/1-report-an-issue.yaml +++ b/.github/ISSUE_TEMPLATE/1-report-an-issue.yaml @@ -5,7 +5,8 @@ body: - type: markdown attributes: value: | - ## Issue with `chargerPhases1p3p` is already fixed! - Update your integration via HACS to get the latest version! + ## HACs does not always notify you about new version's - you must check do this manually! + Please follow this routine: 1. In Home Assistant go to `HACS` 2. In the list of installed integrations search for `evcc` 3. Click on the 3-dot menu on the right side of the `evcc` integration list entry @@ -30,11 +31,7 @@ body: required: true - label: I confirm it's really an issue | In the case that you want to understand the functionality of a certain feature/sensor Please be so kind and make use if the discussion feature of this repo (and do not create an issue) - TIA - label: | - I confirm, that I did not read any of the previous bulletin-points and just checked them all. - I don't wanted to waste my time with details, I don't read or follow any existing instructions. - Instead, I want that the maintainers of this repro will spend time explaining the world to me - that's their job!. - I live by the motto: Better to ask than to think about it once. - It's the maintainers' own fault that they provide open-source software and are willing to offer free support. + I confirm, that I did not read any of the previous bulletin-points and just checked them all. | I don't wanted to waste my time with details, I don't read or follow any existing instructions. | Instead, I want that the maintainers of this repro will spend time explaining the world to me - that's their job!. | I live by the motto: Better to ask than to think about it once. | It's the maintainers' own fault that they provide open-source software and are willing to offer free support. - type: textarea id: content attributes: diff --git a/custom_components/evcc_intg/manifest.json b/custom_components/evcc_intg/manifest.json index 1da835d..7b86efd 100644 --- a/custom_components/evcc_intg/manifest.json +++ b/custom_components/evcc_intg/manifest.json @@ -10,5 +10,5 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/marq24/ha-evcc/issues", "requirements": [], - "version": "2025.1.4" + "version": "2025.1.5" } diff --git a/custom_components/evcc_intg/sensor.py b/custom_components/evcc_intg/sensor.py index dbb58e0..f839d2b 100644 --- a/custom_components/evcc_intg/sensor.py +++ b/custom_components/evcc_intg/sensor.py @@ -88,24 +88,23 @@ def native_value(self): """Return the state of the sensor.""" try: value = self.coordinator.read_tag(self.tag, self.idx) - if isinstance(value, list): - if self.entity_description.tuple_idx is not None and len(self.entity_description.tuple_idx) > 1: - array_idx1 = self.entity_description.tuple_idx[0] - array_idx2 = self.entity_description.tuple_idx[1] - if len(value) > array_idx1 or array_idx1 in value: - value = value[array_idx1] - if isinstance(value, list) and len(value) > array_idx2 or array_idx2 in value: - value = value[array_idx2] - - elif self.entity_description.array_idx is not None: - array_idx = self.entity_description.array_idx - if len(value) > array_idx or array_idx in value: - value = value[array_idx] - - if isinstance(value, list): - # if the value is a list, but could not be extracted (cause of none matching indices) we need - # to purge the value to None! - value = None + if hasattr(self.entity_description, "tuple_idx") and self.entity_description.tuple_idx is not None and len(self.entity_description.tuple_idx) > 1: + array_idx1 = self.entity_description.tuple_idx[0] + array_idx2 = self.entity_description.tuple_idx[1] + if len(value) > array_idx1 or array_idx1 in value: + value = value[array_idx1] + if len(value) > array_idx2 or array_idx2 in value: + value = value[array_idx2] + + elif hasattr(self.entity_description, "array_idx") and self.entity_description.array_idx is not None: + array_idx = self.entity_description.array_idx + if len(value) > array_idx or array_idx in value: + value = value[array_idx] + + if isinstance(value, (dict, list)): + # if the value is a list (or dict), but could not be extracted (cause of none matching indices) we need + # to purge the value to None! + value = None if value is None or len(str(value)) == 0: value = None