stamp Github contribution chart
stamp Github Stats
stamp Most Used Languages

Activity

03 Oct 2022

Issue Comment

Stamp

Timeout reading data

Hi! and thanks for the amazing worker! I am running into trouble on the last step of set-up. Using a tibber puls(han). I am getting the strings on the topic both in homasitent and separate mqtt client. Any tips on the next step of troubleshooting? the log does not produce any useful pointer so I might be looking in the wrong place.

Forked On 03 Oct 2022 at 01:30:08

Stamp

Sure!

I just searched for FIELD_METER_ID and FIELD_METER_MANUFACTURER_ID and commented out all code that seamed relevant. I also hardcoded meter_id = 1 and manufacturer_id = 1 in _ensure_entities_are_created. I suppose that hardcoded id numbers will have the effect that the integration only can have one meter connected. In my case that is not a problem since the Tibber Pulse thingie is connected directly to my only meter.

diff --git a/custom_components/amshan/config_flow.py b/custom_components/amshan/config_flow.py

index 470ceb9..269b03d 100644
--- a/custom_components/amshan/config_flow.py
+++ b/custom_components/amshan/config_flow.py
@@ -328,13 +328,13 @@ class ConfigFlowValidation:
             if measure is not None:
                 decoded_measure = decoder.decode_message(measure)
                 if decoded_measure:
-                    if (
-                        obis_map.FIELD_METER_ID in decoded_measure
-                        and obis_map.FIELD_METER_MANUFACTURER in decoded_measure
-                    ) or (obis_map.FIELD_METER_MANUFACTURER_ID in decoded_measure):
-                        return MeterInfo.from_measure_data(decoded_measure)
+                    #if (
+                    #    obis_map.FIELD_METER_ID in decoded_measure
+                    #    and obis_map.FIELD_METER_MANUFACTURER in decoded_measure
+                    #) or (obis_map.FIELD_METER_MANUFACTURER_ID in decoded_measure):
+                    return MeterInfo.from_measure_data(decoded_measure)
 
-                    _LOGGER.debug("Decoded measure data is missing required info.")
+                    #_LOGGER.debug("Decoded measure data is missing required info.")
 
         raise TimeoutError() 

diff --git a/custom_components/amshan/sensor.py b/custom_components/amshan/sensor.py

index 738c187..972a905 100644
--- a/custom_components/amshan/sensor.py
+++ b/custom_components/amshan/sensor.py
@@ -58,18 +58,18 @@ class AmsHanSensorEntityDescription(SensorEntityDescription):
SENSOR_TYPES: dict[str, AmsHanSensorEntityDescription] = {
    sensor.key: sensor
    for sensor in [
-        AmsHanSensorEntityDescription(
-            key=obis_map.FIELD_METER_ID,
-            entity_category=entity.EntityCategory.DIAGNOSTIC,
-            name="Meter ID",
-            use_configured_scaling=False,
-        ),
-        AmsHanSensorEntityDescription(
-            key=obis_map.FIELD_METER_MANUFACTURER,
-            entity_category=entity.EntityCategory.DIAGNOSTIC,
-            name="Meter manufacturer",
-            use_configured_scaling=False,
-        ),
+        #AmsHanSensorEntityDescription(
+        #    key=obis_map.FIELD_METER_ID,
+        #    entity_category=entity.EntityCategory.DIAGNOSTIC,
+        #    name="Meter ID",
+        #    use_configured_scaling=False,
+        #),
+        #AmsHanSensorEntityDescription(
+        #    key=obis_map.FIELD_METER_MANUFACTURER,
+        #    entity_category=entity.EntityCategory.DIAGNOSTIC,
+        #    name="Meter manufacturer",
+        #    use_configured_scaling=False,
+        #),
        AmsHanSensorEntityDescription(
            key=obis_map.FIELD_METER_TYPE,
            entity_category=entity.EntityCategory.DIAGNOSTIC,
@@ -266,16 +266,16 @@ class AmsHanEntity(SensorEntity):
            raise TypeError("entity_description is required")
        if measure_data is None:
            raise TypeError("measure_data is required")
-        if (
-            obis_map.FIELD_METER_ID not in measure_data
-            and obis_map.FIELD_METER_MANUFACTURER_ID not in measure_data
-        ):
-            raise ValueError(
-                (
-                    f"Expected element {obis_map.FIELD_METER_ID} "
-                    f"{obis_map.FIELD_METER_MANUFACTURER_ID} not in measure_data."
-                )
-            )
+        #if (
+        #    obis_map.FIELD_METER_ID not in measure_data
+        #    and obis_map.FIELD_METER_MANUFACTURER_ID not in measure_data
+        #):
+        #    raise ValueError(
+        #        (
+        #            f"Expected element {obis_map.FIELD_METER_ID} "
+        #            f"{obis_map.FIELD_METER_MANUFACTURER_ID} not in measure_data."
+        #        )
+        #    )
        if new_measure_signal_name is None:
            raise TypeError("new_measure_signal_name is required")

@@ -570,8 +570,8 @@ class MeterMeasureProcessor:
        self, measure_data: dict[str, str | int | float | dt.datetime]
    ) -> None:
        # meter_id or manufacturer_id is required to register entities (required by unique_id).
-        meter_id = measure_data.get(obis_map.FIELD_METER_ID)
-        manufacturer_id = measure_data.get(obis_map.FIELD_METER_MANUFACTURER_ID)
+        meter_id = 1  #measure_data.get(obis_map.FIELD_METER_ID)
+        manufacturer_id = 1  #measure_data.get(obis_map.FIELD_METER_MANUFACTURER_ID)
        if meter_id or manufacturer_id:
            missing_measures = measure_data.keys() - self._known_measures 

Commented On 03 Oct 2022 at 01:30:08
Issue Comment

Stamp

Timeout reading data

Hi! and thanks for the amazing worker! I am running into trouble on the last step of set-up. Using a tibber puls(han). I am getting the strings on the topic both in homasitent and separate mqtt client. Any tips on the next step of troubleshooting? the log does not produce any useful pointer so I might be looking in the wrong place.

Forked On 30 Sep 2022 at 08:51:11

Stamp

I can confirm that the issue is the missing FIELD_METER_MANUFACTURER_ID and FIELD_METER_ID parameters that's the issue.

I locally removed all sections from the integration that relates to FIELD_METER_MANUFACTURER_ID and FIELD_METER_ID. Not a perfect solution but it worked.

I have an Swedish Aidon 6484SE meter with a Tibber Pulse HAN connected to it.

stamp_2022-09-30_104712

Commented On 30 Sep 2022 at 08:51:11

Stamp

Another model for calculating pricelevel

we take the max and min value for 24h in the past.

level 1 = if the price is below min plus 20% of the difference between max and min and so on...

fixes #369

Merged On 29 Sep 2022 at 06:45:32

Stamp

Commented On 29 Sep 2022 at 06:45:32