Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration shows only a single value from last month #97

Closed
arittner opened this issue Aug 7, 2023 · 19 comments · Fixed by #99
Closed

Integration shows only a single value from last month #97

arittner opened this issue Aug 7, 2023 · 19 comments · Fixed by #99
Labels
Bug: Confirmed! Something isn't working bug Something isn't working outdated Version 2

Comments

@arittner
Copy link

arittner commented Aug 7, 2023

I had tested an old integration a long time ago, but it never really worked. I had tested the Python library manually once and the access worked, but in Home Assistant never any sensor was displayed.

Now I saw the latest update and the integration could be set up without further problems, sensors are displayed and I thought I finally had my long-awaited Home Assistant integration.

But alas, only one entity shows a value (last month as an estimated amount to pay) but no kWh values. Debugging is enabled and shows only that:

2023-08-07 08:46:31.652 DEBUG (MainThread) [custom_components.ecotrend_ista.coordinator] Manually updated ecotrend_ista-1f2bc45c4ad8daaf4f2005a9819d1ba7 data
2023-08-07 08:46:31.660 DEBUG (MainThread) [custom_components.ecotrend_ista.coordinator] Finished fetching ecotrend_ista-1f2bc45c4ad8daaf4f2005a9819d1ba7 data in 3.453 seconds (success: True)

On my dashboard, I see only a single sensor entity with data:

grafik

I update my ecotrend data hourly (I know, ista provides the data only once a month) to get an update. But since days I see only this data from above.

Here more detail information:

grafik

@arittner
Copy link
Author

arittner commented Aug 7, 2023

Further information about the setup:

2023-08-02 13:35:25.308 INFO (MainThread) [homeassistant.setup] Setting up ecotrend_ista
2023-08-02 13:35:25.309 DEBUG (MainThread) [custom_components.ecotrend_ista] Set up the ista EcoTrend Version 2 component
2023-08-02 13:35:25.309 INFO (MainThread) [homeassistant.setup] Setup of domain ecotrend_ista took 0.0 seconds
2023-08-02 13:35:25.311 DEBUG (MainThread) [custom_components.ecotrend_ista] Configure based on config entry 1f2bc45c4ad8daaf4f2005a9819d1ba7
2023-08-02 13:35:30.808 DEBUG (MainThread) [custom_components.ecotrend_ista.coordinator] Manually updated ecotrend_ista-1f2bc45c4ad8daaf4f2005a9819d1ba7 data
2023-08-02 13:35:30.808 DEBUG (MainThread) [custom_components.ecotrend_ista.coordinator] Finished fetching ecotrend_ista-1f2bc45c4ad8daaf4f2005a9819d1ba7 data in 3.311 seconds (success: True)
2023-08-02 13:35:30.822 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ecotrend_ista
2023-08-02 13:35:31.934 DEBUG (MainThread) [custom_components.ecotrend_ista.sensor] heating None kWh
2023-08-02 13:35:31.934 DEBUG (MainThread) [custom_components.ecotrend_ista.sensor] heating 11.0 EUR
2023-08-02 13:35:31.934 DEBUG (MainThread) [custom_components.ecotrend_ista.sensor] heating None None
2023-08-02 13:35:31.936 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ecotrend_ista entity: sensor.heating_wzkefdjf4_2
2023-08-02 13:35:31.939 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ecotrend_ista entity: sensor.heating_costs_wzkefdjf4
2023-08-02 13:35:31.947 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.ecotrend_ista entity: sensor.heating_custom_wzkefdjf4

@arittner
Copy link
Author

arittner commented Aug 7, 2023

I checked the log, and I've only on 2023-08-02 few custom_components.ecotrend_ista.sensor log entries and up today hundreds of log entries with custom_components.ecotrend_ista.coordinator

@Ludy87 Ludy87 added bug Something isn't working check for Bug it is checked whether there is an Bug wait in examination Version 2 labels Aug 7, 2023
@Ludy87
Copy link
Owner

Ludy87 commented Aug 7, 2023

I update my ecotrend data hourly (I know, ista provides the data only once a month) to get an update. But since days I see only this data from above.

An update takes place every 24 hours, unless otherwise set.
Please check the setting of the integration "Einstellungen" -> "Geräte & Dienste" -> "ista EcoTrend"

  1. Try to call the URL: http://CHANGE_IP_ADDRESS:8123/local/ecotrend_ista_WZKEFDJF4.json and see if there are values entered.
  2. Log in to https://ecotrend.ista.de/ and check whether your values are displayed correctly there

@arittner
Copy link
Author

arittner commented Aug 7, 2023

Hello!

Thank you for the fast response :-)

The JSON:

{
    "consum_types": [
        "heating"
    ],
    "combined_data": null,
    "total_additional_values": {
        "heating": null,
        "warmwater": null,
        "water": null,
        "ww": null,
        "w": null,
        "h": null
    },
    "total_additional_custom_values": {
        "heating": null,
        "warmwater": null,
        "water": null,
        "ww": null,
        "w": null,
        "h": null
    },
    "last_value": {
        "heating": null,
        "warmwater": null,
        "water": null,
        "month": 7,
        "year": 2023,
        "ww": null,
        "w": null,
        "h": null
    },
    "last_custom_value": {
        "heating": null,
        "warmwater": null,
        "water": null,
        "month": 7,
        "year": 2023,
        "ww": null,
        "w": null,
        "h": null
    },
    "all_dates": null,
    "sum_by_year": {
        "heating": {
            "2023": 0.0
        },
        "warmwater": null,
        "water": null,
        "ww": null,
        "w": null,
        "h": "kWh"
    },
    "last_costs": {
        "heating": 11.0,
        "warmwater": null,
        "water": null,
        "month": 7,
        "year": 2023,
        "unit": "EUR"
    }
}

11€ is correct for July.

The ista portal shows more data:

grafik

And if I use pyecotrend_ista.py from February, I get this result (only a part):

    {
        "entity_id": "heating_2023_7_wzkefdjf4",
        "year": 2023,
        "month": 7,
        "type": "heating",
        "value": "37,0",
        "valuekwh": null,
        "unit": "kWh",
        "unitkwh": "kWh",
        "supportCode": "WZKEFDJF4",
        "date": {
            "month": 7,
            "year": 2023
        },
        "exception": null
    },

I checked it with this small python script:

ecotrend = ista.PyEcotrendIsta(email="***@***", password="***")

raw = asyncio.run(ecotrend.consum_small())
print ("Raw:")
print (json.dumps(raw, indent=4, default=str))

@arittner
Copy link
Author

arittner commented Aug 7, 2023

Btw., I upgraded to the latest pyecotrend_ista (version 2.0.6) and my short test call is not working any more. I'm not certain how to solve it ;-) - I'm not a professional python dev.

@Ludy87
Copy link
Owner

Ludy87 commented Aug 7, 2023

the latest version of the lib is 2.0.19

import asyncio
import json
import logging

from pyecotrend_ista.pyecotrend_ista import PyEcotrendIsta

_LOGGER = logging.getLogger(__name__)

asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

EMAIL = "your mail"
PASSWORD = "your Pass"


async def main():
    ecotrend: PyEcotrendIsta = PyEcotrendIsta(email=EMAIL, password=PASSWORD, logger=_LOGGER)
    print(ecotrend.getVersion())
    await ecotrend.getUA()
    await ecotrend.login(forceLogin=True)

    raw = await ecotrend.get_raw()
    print("Raw:")
    print(json.dumps(raw, indent=4, default=str))


if __name__ == "__main__":
    asyncio.run(main())

please execute and post the log here, thanks.

@arittner
Copy link
Author

arittner commented Aug 7, 2023

Ok, got it (too old python version was the issue to run the script).

The output is huge and contains a lot of private information, I reduce it to July only (consumption and costs).

If needed, I can send the whole JSON via mail.

{
    "consumptionUnitId": "1e4ca141-f4d8-4352-975e-05ae374170d7",
    "resident": {
        "movedOut": false,
        "moveOutDate": null,
        "invalid": false,
        "invalidDate": null
    },
    "consumptions": [
        {
            "date": {
                "month": 7,
                "year": 2023
            },
            "readings": [
                {
                    "type": "heating",
                    "value": "37,0",
                    "unit": "kWh",
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": {
                        "lastYearValue": 34.0,
                        "period": {
                            "month": 7,
                            "year": 2022
                        },
                        "smiley": "MAD",
                        "comparedPercentage": 9,
                        "comparedValue": "3,0"
                    },
                    "comparedCost": null,
                    "averageConsumption": null
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": null,
                    "comparedCost": null,
                    "averageConsumption": null
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": null,
                    "comparedCost": null,
                    "averageConsumption": null
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": null,
                    "comparedCost": null,
                    "averageConsumption": null
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": null,
                    "comparedCost": null,
                    "averageConsumption": null
                }
            ],
            "exception": null,
            "documentNumber": null
        },
    ],
    "costs": [
        {
            "date": {
                "month": 7,
                "year": 2023
            },
            "exception": null,
            "costsByEnergyType": [
                {
                    "type": "heating",
                    "value": 11,
                    "unit": "EUR",
                    "estimated": false,
                    "comparedCost": {
                        "lastYearValue": 10.3,
                        "period": {
                            "month": 7,
                            "year": 2022
                        },
                        "smiley": "MAD",
                        "comparedPercentage": 5,
                        "comparedValue": "1"
                    }
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "estimated": false,
                    "comparedCost": null
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "estimated": false,
                    "comparedCost": null
                }
            ]
        },
    ],
    "co2Emissions": null,
    "consumptionsBillingPeriods": {
        ...
    },
    "costsBillingPeriods": {
        ...
    },
    "co2EmissionsBillingPeriods": {
        "currentBillingPeriod": null,
        "previousBillingPeriod": null
    }
}

@Ludy87
Copy link
Owner

Ludy87 commented Aug 7, 2023

Thanks for the log.

I think I've found the error, I'll test it in the coming days - I'm actually on vacation

Ista has a bad understanding of json objects, numbers are partial strings and elsewhere they are floats again.

In your case it's - I think - due to "additionalValue": null, normally should be the value here, but in yours unit kwh is usually Einheiten (It's just a guess on my part the tests will show)

@Ludy87 Ludy87 added Bug: Confirmed! Something isn't working and removed check for Bug it is checked whether there is an Bug labels Aug 7, 2023
@arittner
Copy link
Author

arittner commented Aug 7, 2023

Ista has a bad understanding of json objects, numbers are partial strings and elsewhere they are floats again.

Ista has a bad understanding of running software in general (remembering the several months when the company collapsed after the ransomware attack).

Great, thank you for your effort. I'm looking forward to the solution. Have a nice holiday!

@Ludy87
Copy link
Owner

Ludy87 commented Aug 8, 2023

Hello @arittner, change the lib version in the package /config/custom_components/ecotrend_ista/manifest.json from pyecotrend_ista==2.0.19 to pyecotrend_ista==2.0.20

@arittner
Copy link
Author

arittner commented Aug 8, 2023

Hi!

Unfortunately, no change.

2023-08-08 12:05:45.789 INFO (SyncWorker_7) [homeassistant.util.package] Attempting install of pyecotrend_ista==2.0.20
...
2023-08-08 12:06:29.902 INFO (MainThread) [homeassistant.setup] Setting up ecotrend_ista
2023-08-08 12:06:29.902 DEBUG (MainThread) [custom_components.ecotrend_ista] Set up the ista EcoTrend Version 2 component
2023-08-08 12:06:29.902 INFO (MainThread) [homeassistant.setup] Setup of domain ecotrend_ista took 0.0 seconds
...
2023-08-08 12:06:30.170 DEBUG (MainThread) [custom_components.ecotrend_ista] Configure based on config entry 1f2bc45c4ad8daaf4f2005a9819d1ba7
2023-08-08 12:06:35.370 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: ecotrend_ista
...
2023-08-08 12:06:37.269 DEBUG (MainThread) [custom_components.ecotrend_ista.coordinator] Manually updated ecotrend_ista-1f2bc45c4ad8daaf4f2005a9819d1ba7 data
2023-08-08 12:06:37.269 DEBUG (MainThread) [custom_components.ecotrend_ista.coordinator] Finished fetching ecotrend_ista-1f2bc45c4ad8daaf4f2005a9819d1ba7 data in 3.287 seconds (success: True)
2023-08-08 12:06:37.305 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ecotrend_ista
2023-08-08 12:06:38.021 DEBUG (MainThread) [custom_components.ecotrend_ista.sensor] heating None kWh
2023-08-08 12:06:38.022 DEBUG (MainThread) [custom_components.ecotrend_ista.sensor] heating 11.0 EUR
2023-08-08 12:06:38.022 DEBUG (MainThread) [custom_components.ecotrend_ista.sensor] heating None None
2023-08-08 12:06:38.039 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 77.86s
...

@arittner
Copy link
Author

arittner commented Aug 8, 2023

The current JSON (generated with the script and pyecotrend-ista-2.0.20):

{
    "consumptionUnitId": "1e4ca141-f4d8-4352-975e-05ae374170d7",
    "resident": {
        "movedOut": false,
        "moveOutDate": null,
        "invalid": false,
        "invalidDate": null
    },
    "consumptions": [
        {
            "date": {
                "month": 7,
                "year": 2023
            },
            "readings": [
                {
                    "type": "heating",
                    "value": "37,0",
                    "unit": "kWh",
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": {
                        "lastYearValue": 34.0,
                        "period": {
                            "month": 7,
                            "year": 2022
                        },
                        "smiley": "MAD",
                        "comparedPercentage": 9,
                        "comparedValue": "3,0"
                    },
                    "comparedCost": null,
                    "averageConsumption": {
                        "averageConsumptionValue": "58,8",
                        "residentConsumptionValue": "37,0",
                        "averageConsumptionPercentage": 100,
                        "residentConsumptionPercentage": 63,
                        "additionalAverageConsumptionValue": "0",
                        "additionalResidentConsumptionValue": "0",
                        "additionalAverageConsumptionPercentage": 0,
                        "additionalResidentConsumptionPercentage": 0
                    }
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": null,
                    "comparedCost": null,
                    "averageConsumption": null
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": null,
                    "comparedCost": null,
                    "averageConsumption": null
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": null,
                    "comparedCost": null,
                    "averageConsumption": null
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "additionalValue": null,
                    "additionalUnit": "kWh",
                    "estimated": false,
                    "comparedConsumption": null,
                    "comparedCost": null,
                    "averageConsumption": null
                }
            ],
            "exception": null,
            "documentNumber": null
        },
    ],
    "costs": [
        {
            "date": {
                "month": 7,
                "year": 2023
            },
            "exception": null,
            "costsByEnergyType": [
                {
                    "type": "heating",
                    "value": 11,
                    "unit": "EUR",
                    "estimated": false,
                    "comparedCost": {
                        "lastYearValue": 10.3,
                        "period": {
                            "month": 7,
                            "year": 2022
                        },
                        "smiley": "MAD",
                        "comparedPercentage": 5,
                        "comparedValue": "1"
                    }
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "estimated": false,
                    "comparedCost": null
                },
                {
                    "type": null,
                    "value": null,
                    "unit": null,
                    "estimated": false,
                    "comparedCost": null
                }
            ]
        },
    ],
    "co2Emissions": null,
    "consumptionsBillingPeriods": {
    ...
    },
    "costsBillingPeriods": {
    ...
    },
    "co2EmissionsBillingPeriods": {
        "currentBillingPeriod": null,
        "previousBillingPeriod": null
    }
}

@Ludy87
Copy link
Owner

Ludy87 commented Aug 8, 2023

sorry for using you as a tester.

please change the version to pyecotrend_ista==2.0.21

@arittner
Copy link
Author

arittner commented Aug 8, 2023

sorry for using you as a tester.

No problem ;-)

grafik

grafik

Now, it looks fine :-)

Great, thank you!

@arittner
Copy link
Author

arittner commented Aug 8, 2023

Btw., it would be nice to have the other values as entities, but this is maybe something for another feature request, e.g.:

                    "averageConsumption": {
                        "averageConsumptionValue": "58,8",
                        "residentConsumptionValue": "37,0",
                        "averageConsumptionPercentage": 100,
                        "residentConsumptionPercentage": 63,

and

                    "comparedConsumption": {
                        "lastYearValue": 34.0,
                        "period": {
                            "month": 7,
                            "year": 2022
                        },
                        "smiley": "MAD",
                        "comparedPercentage": 9,
                        "comparedValue": "3,0"
                    },

and

                    "comparedCost": {
                        "lastYearValue": 10.3,
                        "period": {
                            "month": 7,
                            "year": 2022
                        },
                        "smiley": "MAD",
                        "comparedPercentage": 5,
                        "comparedValue": "1"
                    }

@Ludy87
Copy link
Owner

Ludy87 commented Aug 8, 2023

sorry for using you as a tester.

No problem ;-)

grafik

grafik

Now, it looks fine :-)

Great, thank you!

Warum steht bei dir Warmwasser? Es ist doch die Heating entity 🤔

@arittner
Copy link
Author

arittner commented Aug 8, 2023

Fernwärme ;-) - da ist Heizung und Warmwasser zusammen und ich habe es dann so in HA umbenannt. Da es für ista auch keine Unterscheidung gibt, haben die wohl gelost, auf welche Stelle sie das schreiben.

@Ludy87
Copy link
Owner

Ludy87 commented Aug 8, 2023

Wenn ich dran denke, werde ich dem Tribe Lead PM eine Nachricht schicken, dass das eventuell gefixt wird.

@Ludy87 Ludy87 linked a pull request Aug 8, 2023 that will close this issue
@Ludy87 Ludy87 removed the wait in examination label Aug 8, 2023
@Ludy87 Ludy87 closed this as completed in #99 Aug 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug: Confirmed! Something isn't working bug Something isn't working outdated Version 2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants