imou_life icon indicating copy to clipboard operation
imou_life copied to clipboard

APIError: DV1026: The device does not support the call of this function

Open TheBisk opened this issue 1 year ago • 13 comments

Version of the custom_component

1.0.14

Configuration

This error originated from a custom integration.

Logger: custom_components.imou_life Source: custom_components/imou_life/coordinator.py:44 Integration: Imou Life (documentation, issues) First occurred: 13:57:23 (5 occurrences) Last logged: 14:57:23

APIError: DV1026: The device does not support the call of this function. Traceback (most recent call last): File "/config/custom_components/imou_life/coordinator.py", line 42, in _async_update_data return await self.device.async_get_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/imouapi/device.py", line 414, in async_get_data await sensor_instance.async_update() File "/usr/local/lib/python3.11/site-packages/imouapi/device_entity.py", line 294, in async_update data = await self.api_client.async_api_getDeviceCameraStatus(self._device_id, self._name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/imouapi/api.py", line 355, in async_api_getDeviceCameraStatus return await self._async_call_api(api, payload) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/imouapi/api.py", line 227, in _async_call_api raise APIError(error_message) imouapi.exceptions.APIError: DV1026: The device does not support the call of this function.

Device info

Device info IPC-C26E-V2 by Imou Firmware: Eng_P_V2.680.0000000.28.R.20210911 Hardware: 6G071B2PAZ8DAE2

TheBisk avatar Dec 27 '23 14:12 TheBisk

Hi, was this working with the previous version of the integration? Just to understand if it is a new error after having upgraded to 1.0.14 or not :-) Thanks!

user2684 avatar Dec 27 '23 14:12 user2684

Yes, it was working with the previous version. It is the first time that I see this kind of error. Thanks for your work user2684.

TheBisk avatar Dec 28 '23 10:12 TheBisk

Ok, that function which is throwing the error has been indeed modified with 1.0.14 so it must be related. Strange because I tested with with a few models and had no problems, but I didn't have your model. Can you please share diagnostic and debug logs (https://github.com/user2684/imou_life?tab=readme-ov-file#troubleshooting) so I can try to understand what's going on? If you need a temporary workaround meanwhile you can always manually downgrade to 1.0.13. Many thanks

user2684 avatar Dec 29 '23 08:12 user2684

Ok, that function which is throwing the error has been indeed modified with 1.0.14 so it must be related. Strange because I tested with with a few models and had no problems, but I didn't have your model. Can you please share diagnostic and debug logs (https://github.com/user2684/imou_life?tab=readme-ov-file#troubleshooting) so I can try to understand what's going on? If you need a temporary workaround meanwhile you can always manually downgrade to 1.0.13. Many thanks

Thanks, how can I put an earlier version? I have the same problem. Thanks

Diegocampy avatar Jan 16 '24 12:01 Diegocampy

same problem with 1.0.15 Questo errore ha avuto origine da un'integrazione personalizzata.

Logger: custom_components.imou_life Source: custom_components/imou_life/entity.py:81 Integration: Imou Life (documentation, issues) First occurred: 14:46:43 (2 occurrences) Last logged: 14:46:44

APIError: DV1026: The device does not support the call of this function. Traceback (most recent call last): File "/config/custom_components/imou_life/entity.py", line 79, in async_added_to_hass await self.sensor_instance.async_update() File "/usr/local/lib/python3.11/site-packages/imouapi/device_entity.py", line 294, in async_update data = await self.api_client.async_api_getDeviceCameraStatus(self._device_id, self._name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/imouapi/api.py", line 355, in async_api_getDeviceCameraStatus return await self._async_call_api(api, payload) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/imouapi/api.py", line 227, in _async_call_api raise APIError(error_message) imouapi.exceptions.APIError: DV1026: The device does not support the call of this function.

Diegocampy avatar Jan 31 '24 13:01 Diegocampy

Hi @Diegocampy was it working with previous version? Thanks

user2684 avatar Feb 04 '24 10:02 user2684

Hi @Diegocampy was it working with previous version? Thanks

No, same problem

Diegocampy avatar Feb 04 '24 10:02 Diegocampy

Ok so it means it did not stop working because of the change. I expect then that this happens because on some models a different API is called but without knowing which one is impossible to fix :-/

user2684 avatar Feb 17 '24 15:02 user2684

I have noticed the same problem since I upgraded the other week. Don't know which version I had before, or it there was the same error. Device is IMOU Ranger 2

"device": {
        "device_id": "**REDACTED**",
        "name": "Garage",
        "catalog": "IPC",
        "given_name": "Garage",
        "model": "IPC-A26H-V2",
        "firmware": "Eng_P_V2.680.0000000.28.R.20210911",
        "manufacturer": "Imou",
        "status": "1",
        "sleepable": false
      },

Debug log:

2024-04-26 13:43:29.673 DEBUG (MainThread) [imouapi] [Garage] update requested
2024-04-26 13:43:32.646 DEBUG (MainThread) [imouapi] [Garage] updating Motion detection, value is OFF {}
2024-04-26 13:43:34.663 ERROR (MainThread) [custom_components.imou_life] APIError: DV1026: The device does not support the call of this function.
Traceback (most recent call last):
  File "/config/custom_components/imou_life/coordinator.py", line 42, in _async_update_data
    return await self.device.async_get_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/imouapi/device.py", line 414, in async_get_data
    await sensor_instance.async_update()
  File "/usr/local/lib/python3.12/site-packages/imouapi/device_entity.py", line 294, in async_update
    data = await self.api_client.async_api_getDeviceCameraStatus(self._device_id, self._name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/imouapi/api.py", line 355, in async_api_getDeviceCameraStatus
    return await self._async_call_api(api, payload)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/imouapi/api.py", line 227, in _async_call_api
    raise APIError(error_message)
imouapi.exceptions.APIError: DV1026: The device does not support the call of this function.
2024-04-26 13:43:34.664 DEBUG (MainThread) [custom_components.imou_life] Finished fetching imou_life data in 4.991 seconds (success: False)

I have one more camera which is working fine without any error in the logg

Strixx76 avatar Apr 26 '24 12:04 Strixx76

I do wonder if there are also changes from the Imou side on APIs of old models since this errors are becoming more frequent and difficult to troubleshoot. It shouldn't be the case though since this would make the devices not backward compatible and should break the app as well theoretically speaking...

user2684 avatar Apr 27 '24 10:04 user2684

I just had a very quick glance in the code trying to find what is wrong. But since I don't have had the time to learn the API it is hard. One thing I am missing is to be able to see a log entry of which switch it is that is throwing the error. I can only see the entities that successfully was updated.

And a second thing I noticed is that as soon as one entity is failing the exception is thrown casing the rest to not be updated. Maybe the there should be a logic for handling this in async_get_data()?. Maybe you could even do all the individual updates as asyncio jobs, and then only log the ones failing?

Strixx76 avatar May 02 '24 08:05 Strixx76

So I have done some more testing and added some extra logging to imouapi (ugly and not ready for a pull request) and found out that the switch that is throwing the error is the Status indicator (breathingLight). There is a status indicator on the camera, and it is possible to change it from the native app. So I investigated the API (getDeviceCameraStatus) and I have now discovered that the description in the API documentation is partly wrong.

If the "enableType is device-level enable" you must omit the channelId parameter. That is what is casing the error. After removing it my camera is working perfectly fine in the development environment. This also applies to setDeviceCameraStatus. The strange thing is that this only applies for one of my cameras. There rest is working fine without this fix.

Since this is not an issue with the imou_life integration, but the api package, do you want me to create an issue in that repo instead?

Strixx76 avatar May 02 '24 20:05 Strixx76

Continuing on https://github.com/user2684/imouapi/issues/10 for this specific topic

user2684 avatar May 12 '24 09:05 user2684

Closing this and working on https://github.com/user2684/imouapi/issues/10

user2684 avatar Sep 28 '24 09:09 user2684