FaserF / ha-rewe

Rewe Discounts Homeassistant Integration
GNU General Public License v3.0
15 stars 4 forks source link

Cannot retrieve Data #19

Closed jones1894 closed 11 months ago

jones1894 commented 12 months ago

The problem

The sensor in Home Assistant is not available since 2 days ago. The logs suggest it's a problem with retrieving data from server.

What version of Home Assistant Core has the issue?

2023.10.05

What version of Rewe Integration has the issue?

2023.06.0

What type of installation are you running?

Home Assistant OS

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.rewe.sensor
Source: custom_components/rewe/sensor.py:137
Integration: Rewe Discounts (documentation, issues)
First occurred: 24. Oktober 2023 um 21:15:11 (3 occurrences)
Last logged: 06:02:55

Cannot retrieve discounts for: 240733 - Maybe a typo or the server rejected the request.
Cannot retrieve discounts for: 240340 - Maybe a typo or the server rejected the request.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/simplejson/__init__.py", line 514, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/simplejson/decoder.py", line 386, in decode
    obj, end = self.raw_decode(s)
               ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/simplejson/decoder.py", line 416, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/rewe/sensor.py", line 137, in async_update
    data = await hass.async_add_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rewe/sensor.py", line 204, in fetch_rewe_discounts
    data = self._session.get(url).json()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Additional information

No response

FaserF commented 11 months ago

Since my marked id works without any issues, would you mind sharing your market ID with me? Right now I am unable to reproduce the isse

jones1894 commented 11 months ago

Hi, I noticed it is working again. I really can't say why. I tried to reboot Home Assistant an nothing worked, and then all of a sudden it was back on... Maybe it was a temporary issue on the Rewe API Side.

FaserF commented 11 months ago

Yeah most likely it was a temporary issue with the rewe API itself

simonstamm commented 9 months ago

I actually have the same error. I'm on HA 2024.1.0 and wanted to setup your integration. Is it working for somebody else and this HA version?

Edit: Should be related to this issue https://github.com/foo-git/rewe-discounts/issues/14. Edit2: Got it solved. It was the ecdh curve. Will open a PR.

FaserF commented 9 months ago

Thanks, fixed with your PR and release 2024.01.0

foo-git commented 8 months ago

In case this issue should pop up again, check out foo-git/rewe-discounts#14 as I added just now a second code path in a testing branch using a different Rewe API which might solve it.