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

Update for image_processing.platerecognizer_doorbell_main_proxy fails #69

Open
totalitarian opened this issue Nov 17, 2022 · 3 comments

Comments

@totalitarian
Copy link

totalitarian commented Nov 17, 2022

Any idea what would cause this?

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/platerecognizer/image_processing.py:224
Integration: platerecognizer (documentation)
First occurred: 16 November 2022 at 21:27:27 (884 occurrences)
Last logged: 16:02:06

Update for image_processing.platerecognizer_doorbell_main_proxy fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 373, in decode
    raise JSONDecodeError("Extra data", s, end, len(s))
simplejson.errors.JSONDecodeError: Extra data: line 1 column 4 - line 1 column 15 (char 3 - 14)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/platerecognizer/image_processing.py", line 206, in process_image
    ).json()
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Extra data: line 1 column 4 (char 3)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update
    raise exc
  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 163, in async_update
    await self.async_process_image(image.content)
  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 144, in async_process_image
    return await self.hass.async_add_executor_job(self.process_image, image)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/platerecognizer/image_processing.py", line 224, in process_image
    _LOGGER.error(f"platerecognizer api response: {response}")
UnboundLocalError: local variable 'response' referenced before assignment

This is my config

  - platform: platerecognizer
    api_token: xxxxxxx
    regions:
      - gb
    save_file_folder: /config/images/platerecognizer/
    save_timestamped_file: True
    always_save_latest_file: True
    watched_plates:
      - xx67xxx
    mmc: True
    detection_rule: strict
    region: strict
    server: https://myhostname.com/v1/plate-reader/
    source:
      - entity_id: camera.doorbell_main_proxy
@robmarkcole
Copy link
Owner

This will occur if the server returns no response at

This is not well handled

@totalitarian
Copy link
Author

Thanks but which server?

@totalitarian
Copy link
Author

Oh I get it now, you only need that for paid account. Simplified my config and now it works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants