home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.21k stars 30.57k forks source link

OpenALPR Local always unknown state #24012

Closed det-peralta closed 4 years ago

det-peralta commented 5 years ago

Home Assistant release with the issue: 0.93.1

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io

Component/platform: OpenALPR Local

Description of problem: The image_processing component always displays unknown, even if i change the picture on generic camera, no errors outputs.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

camera:
  - platform: generic
    still_image_url: http://plates.openalpr.com/h786poj.jpg
    name: cam_test

image_processing:
  - platform: openalpr_local
    region: eu
    source:
      - entity_id: camera.cam_test

Traceback (if applicable):

2019-05-20 23:47:20 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=image_processing, service=scan, service_data=entity_id=image_processing.openalpr_cam_test>
2019-05-20 23:47:20 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1878487472] Sending {'id': 39, 'type': 'result', 'success': True, 'result': None}

Additional information:

dawsmac commented 5 years ago

I am getting the same issue, I am running on docker. I am sure I had this working last year with my foscam that I no longer have. I might be wrong but is this due to the camera feed now firing out in rstp/h684 (Reolink) I have seen some noise on the openalrp saying local ver not supporting this?

image_processing:
  - platform: openalpr_local
    region: gb
    source:
      - entity_id: camera.garden
  - platform: generic
    stream_source: rtsp://******:*******@192.168.1**.***//h264Preview_01_main
    still_image_url: http://192.168.1***.1***/cgi-bin/api.cgi 
  cmd=Snap&channel=0&rs=AB123&user=*******&password=*********
    name: Garden
    verify_ssl: false
det-peralta commented 5 years ago

ok, i just tested. This is working on Home Assistant Docker but doesnt work on Hass.io. Same code on HA Docker:

image

det-peralta commented 5 years ago

I am getting the same issue, I am running on docker. I am sure I had this working last year with my foscam that I no longer have. I might be wrong but is this due to the camera feed now firing out in rstp/h684 (Reolink) I have seen some noise on the openalrp saying local ver not supporting this?

image_processing:
  - platform: openalpr_local
    region: gb
    source:
      - entity_id: camera.garden
  - platform: generic
    stream_source: rtsp://******:*******@192.168.1**.***//h264Preview_01_main
    still_image_url: http://192.168.1***.1***/cgi-bin/api.cgi 
  cmd=Snap&channel=0&rs=AB123&user=*******&password=*********
    name: Garden
    verify_ssl: false

I tested in docker with rtsp feed, and my ha just hangs.

dawsmac commented 5 years ago

Happy to be proven wrong, openalpr 2.3.1 and above support RTSP and MPEG feeds from the camera but if you wish to get a newer ver we need to pay openalpr for a lic? i did also read about up dating openCV and this will enable the RTSP feed...

Just my 2pence worth :)

lolouk44 commented 5 years ago

I'm having issues getting the integration to work too. I can call OpenALPR via the command line and pass an image as a parameter, that works. I've tried passing a recorded video (avi) as an argument, that fails.

Happy to provide logs as requested

lolouk44 commented 5 years ago

if it helps, I'm getting a lot of these:

2019-07-17 21:39:40 ERROR (MainThread) [homeassistant.helpers.entity] Update for image_processing.openalpr_side fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 375, in async_device_update
    await self.async_update()
  File "/usr/src/app/homeassistant/components/image_processing/__init__.py", line 132, in async_update
    await self.async_process_image(image.content)
  File "/usr/src/app/homeassistant/components/openalpr_local/image_processing.py", line 187, in async_process_image
    stdout, _ = await alpr.communicate(input=image)
  File "/usr/local/lib/python3.7/asyncio/subprocess.py", line 187, in communicate
    loop=self._loop)
  File "/usr/local/lib/python3.7/asyncio/subprocess.py", line 138, in _feed_stdin
    self.stdin.write(input)
  File "/usr/local/lib/python3.7/asyncio/streams.py", line 305, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 671, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <WriteUnixTransport closed=True reading=False 0x7f3274682ba8>; the handler is closed

Not really sure what to make of it...

det-peralta commented 5 years ago

Still with the same problem

GrandNewbien commented 5 years ago

Same issue here, it actually crashes HA if active.

ercsey commented 5 years ago

I'm using Hass.io in docker with Ubuntu and I'm getting this error.

Update for image_processing.openalpr_amcrest_camera fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 439, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 136, in async_update
    await self.async_process_image(image.content)
  File "/usr/src/homeassistant/homeassistant/components/openalpr_local/image_processing.py", line 194, in async_process_image
    stderr=asyncio.subprocess.DEVNULL,
  File "/usr/local/lib/python3.7/asyncio/subprocess.py", line 217, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1529, in subprocess_exec
    bufsize, **kwargs)
  File "/usr/local/lib/python3.7/asyncio/unix_events.py", line 190, in _make_subprocess_transport
    **kwargs)
  File "/usr/local/lib/python3.7/asyncio/base_subprocess.py", line 37, in __init__
    stderr=stderr, bufsize=bufsize, **kwargs)
  File "/usr/local/lib/python3.7/asyncio/unix_events.py", line 764, in _start
    universal_newlines=False, bufsize=bufsize, **kwargs)
  File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'alpr': 'alpr'

With the command line it's working fine. Any idea what am I doing wrong? Thank you.

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Lee-BS-AMS commented 4 years ago

Anyone ever solve this?

ercsey commented 4 years ago

Same error here. Any solution?

Sloth-on-meth commented 3 years ago

same here. anyone ever solve this?