zigul / HomeAssistant-CEZdistribuce

CEZ Distribuce - Home Assistant Sensor
Apache License 2.0
33 stars 15 forks source link

New URL from where to get info #24

Closed Kantyna closed 10 months ago

Kantyna commented 10 months ago

Hello, so today at about 10:50 the sensor became N/A. I have looked for whats the issue and it seems like CEZ distribuce moved their data to new URL and discontinued the original. Can you please fix that?

Old url: https://www.cezdistribuce.cz/pro-zakazniky/spinani-hdo New url: https://www.cezdistribuce.cz/pro-zakazniky/potrebuji-vyresit/stavajici-pripojeni/casy-spinani-nizkeho-tarifu

I am still new to HA and I want to thank you so much, this integration saved me a lot of money and I want to use it further...

Jirka

zigul commented 10 months ago

I will look at it next weekend.

tkupka commented 10 months ago

It's possible for concrete EAN: https://dip.cezdistribuce.cz/irj/portal/anonymous/casy-spinani?path=switch-times/signals

{"ean":"123456"}

or with graphQL: https://www.cezdistribuce.cz/api/graphql

[
  {
    "operationName": "hdoData",
    "variables": {
      "code": "A1B6DP1",
      "area": "stred"
    },
    "query": "query hdoData($code: String, $area: String) {\n  hdoData(code: $code, area: $area) {\n    result {\n      description\n      kod\n      kod_povelu\n      povel\n      timelines {\n        description\n        intervals {\n          left\n          width\n          text\n          __typename\n        }\n        __typename\n      }\n      __typename\n    }\n    resultPrint {\n      description\n      kod\n      kod_povelu\n      povel\n      rows {\n        day\n        intervals\n        __typename\n      }\n      __typename\n    }\n    queryDescription\n    __typename\n  }\n}\n"
  }
]

I haven't found a grapgQL schema to get a rid of parsing the intervals

brebtatv commented 10 months ago

To fix, change line 12 in https://github.com/zigul/HomeAssistant-CEZdistribuce/blob/main/custom_components/cezdistribuce/downloader.py

of

BASE_URL = "https://www.cezdistribuce.cz/distHdo/adam/containers/"

on

BASE_URL = "https://www.cezdistribuce.cz/webpublic/distHdo/adam/containers/"

pokornyIt commented 10 months ago

The problem solved in version 0.4.8