dbuezas / icsee-ptz

44 stars 7 forks source link

Integration is not working #2

Closed alexreddy78 closed 12 months ago

alexreddy78 commented 1 year ago

Dear Developer,

Do I need to install cameras to HA via ONVIF or else or just use your integration and it will connect to my icsee camera on the network automatically? I did installation but logger shows following and nothing is working.

Logger: homeassistant.helpers.integration_platform Source: loader.py:850 First occurred: 19:27:27 (7 occurrences) Last logged: 19:28:20

Unexpected error importing icsee_ptz/system_health.py Unexpected error importing icsee_ptz/media_source.py Unexpected error importing icsee_ptz/group.py Unexpected error importing icsee_ptz/logbook.py Unexpected error importing icsee_ptz/hardware.py Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/integration_platform.py", line 50, in _async_process_single_integration_platform_component platform = integration.get_platform(platform_name) File "/usr/src/homeassistant/homeassistant/loader.py", line 833, in get_platform cache[full_name] = self._import_platform(platform_name) File "/usr/src/homeassistant/homeassistant/loader.py", line 850, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'custom_components.icsee-ptz.diagnostics'

alexreddy78 commented 1 year ago

Updates:

I remove password from the config yaml and service is working, perfectly! But still error in the logger plus additional one apper

Logger: root Source: custom_components/icsee-ptz/init.py:33 Integration: icsee-ptz First occurred: 19:51:21 (14 occurrences) Last logged: 20:00:23

Uncaught thread exception Traceback (most recent call last): File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/local/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/config/custom_components/icsee-ptz/init.py", line 33, in runner task = q.get(timeout=5) File "/usr/local/lib/python3.10/queue.py", line 179, in get raise Empty _queue.Empty

dbuezas commented 1 year ago

Hi, thanks for the report. So it worked without password? Interesting, my 4 cameras all need the password in the url. I'll take a look at my logs, i bet it's also showing them with my cameras and I didn't realize.

dbuezas commented 1 year ago

And happy to hear it worked for you! I used to use onvif for ptz, but one camera didn't support it. That's why I made this, and now I ptz all my cameras woth this because it works better and it is simpler.

alexreddy78 commented 1 year ago

And happy to hear it worked for you! I used to use onvif for ptz, but one camera didn't support it. That's why I made this, and now I ptz all my cameras woth this because it works better and it is simpler.

Thanks a lot! Yes integration is Super! Simple! No need for ONVIF ;)

probably I do not need password as my camera is not set for them ;)

Will wait for update from your side, reading error on logs.

REGARDS

hellad commented 1 year ago

Dear developer.

Thank you for your efforts!

I'd like to know what type of cameras does your integration possibly support - only listed in Readme file? I tried to use it with my ASECAM 4K 30x zoom PTZ camera but without success. I see following error message in log: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dvrip.py", line 115, in connect self.socket.connect((self.ip, self.port)) ConnectionRefusedError: [Errno 111] Connection refused

This camera supports control via ONVIF but with different mobile app - CamHiPro. It's also possible to cotrol camera via Onvier.

It has following properties: ONVIF version 2.04 Http port 80 rtsp port 554 rtmp port 1935 ONVIF server port 8080 NVC type Normal URI http://192.168.192.98:8080/onvif/device_service

Is there any chance in future to support this camera?

Regards

dbuezas commented 1 year ago

It should work, are you sure you put the right username and password?

icsee_ptz:
  my_cam_1:
    host: 192.168.178.27 # <-- only the ip, no http:// or path
    username: admin # <-- the username is typically admin, but may be something else.
    password: my_cam_password # <-- the password used in xmeye
    move_time: 1
    step: 10

To test connection, you can start the xmeye app in local mode with your phone and check that the ip, user and pass are all working

hellad commented 1 year ago

It seems like now I realize the root cause of error. In your Readme file thereis no line

username: admin # <-- the username is typically admin, but may be something else.

My config looks like this: icsee_ptz: ptz_asecam: host: !secret my_ptz_cam password: !secret my_ptz_cam_password move_time: 1 step: 10

dbuezas commented 1 year ago

The user defaults to admin anyway.

Btw, you can pass all those parameters to the service too (this way you don't need to restart home assistant each time)

hellad commented 1 year ago

Thank you for quick reply!

Unfortunatelly even with username defined in configuration.yaml I've got the same error:

This error originated from a custom integration.

Logger: root Source: custom_components/icsee_ptz/init.py:31 Integration: ICSee (documentation) First occurred: 19:09:10 (1 occurrences) Last logged: 19:09:10

Uncaught thread exception Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dvrip.py", line 115, in connect self.socket.connect((self.ip, self.port)) ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/local/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/config/custom_components/icsee_ptz/init.py", line 31, in runner cam.login() File "/usr/local/lib/python3.10/site-packages/dvrip.py", line 228, in login self.connect() File "/usr/local/lib/python3.10/site-packages/dvrip.py", line 127, in connect raise SomethingIsWrongWithCamera('Cannot connect to camera') dvrip.SomethingIsWrongWithCamera: Cannot connect to camera

I don't see the fields for username and password while calling service in my system. As for me the comment for Camera field is a little bit confusing since it actually requires IP address instead of name.

изображение

dbuezas commented 1 year ago

Oh, you'll have to use yaml mode

dbuezas commented 1 year ago

Screenshot_20230616-182256

hellad commented 1 year ago

when I switched to YAML mode I see camera: 192.168.192.98 instead of host: 192.168.192.98.

It looks like wrong field name conversion. изображение

dbuezas commented 1 year ago

It will put whatever you wrote in the field I think. Integrations have no control of that

hellad commented 1 year ago

For me it looks like predefined value for first parameter from your integration.

Nevertheless I tried to enter manually all parameters in YAML mode but with the same error :(

service: icsee_ptz.move data: host: 192.168.192.98 cmd: DirectionUp move_time: 1 step: 2 username: admin password: my_password_here

It's a pity that I'm not a programmer and not able to debug the error.

What destination port is used to send authorization request?

dbuezas commented 1 year ago

Can you login to the xmeye app with user and password? If so, are you sure they match those you put in your yaml?

hellad commented 1 year ago

I can't login with xmeye app. As I mentioned above I use other app - CamHi. xmeye app shows default port 34567. I guess my camera uses other API and ports. I can login with my credentials in web gui via http://192.168.192.98

At least it can be managed by ONVIF protocol. It provides 4K video stream via rtsp://192.168.192.98:554/11 link without authorization.

I looks like incompatible API for my camera

Anyway thank you for your time!

dbuezas commented 1 year ago

Oh, I see. Then you'll need to do ptz via onvif indeed