xannor / ha_reolink_rest

ReoLink REST/Web Camera Integration for Home Assistant
24 stars 3 forks source link

Retrying setup: 5 is not a valid PTZControlValues #4

Closed nicaruspl closed 1 year ago

nicaruspl commented 2 years ago

I added nvr by Reolink device and have an error: Retrying setup: 5 is not a valid PTZControlValues.

image

xannor commented 2 years ago

Could you provide more info please, NVR channel, and camera type.

nicaruspl commented 2 years ago

NVR: Model RLN16-410 Firmware: 3.0.0.186._22062406 Cameras : RLC 810A, RLC 510A, RLC 811A, RLC 823A

xannor commented 2 years ago

According to the document I have from ReoLink the PtzCntrl ability response should only have a value of 0,1, or 2. I am wondering if either I am accidentally loading the wrong field, or the NVR is sending something different (I have seen the responses on the cameras change when "Beta" features are enabled or not, and this was not documented either.)

Could you add debugging to your logs in your configuration.yaml

logger:
  logs:
    async_reolink.rest: debug

upload as a private gist and tag my username in a comment to it. (I want it private because this will expose "sensitive" camera and login information that I don't want leaked into a public help ticket, or you could take the time to scrub your login info, uuids, and ip addresses)

I am in the process of rewriting my ability handing code anyway and I want to make sure I don't miss anything.

xannor commented 2 years ago

I finally got a new version up, though this is "very" alpha, please give it a go and see if you still get this issue. If you get a different one, please close this and open a new issue.

Dattamick commented 2 years ago

Got new issue, new issue was already closed but still same issue despite update only now mentioning integer.

xannor commented 2 years ago

Please enable debugging and provide logs with data and error stack. I dont have an NVR so I have to try to recreate the issue with data only.

Dattamick commented 2 years ago

are you able to provide directions on how I would go about that? I am relatively new, but this is the only integration ive struggled with and not solved myself. Thank you for your help

Dattamick commented 2 years ago

I was able to find this in the logs

Log Details (ERROR) This error originated from a custom integration. Logger: custom_components.reolink_rest Source: custom_components/reolink_rest/entity.py:660 Integration: Reolink IP Device (documentation, issues) First occurred: 2:04:52 AM (151 occurrences) Last logged: 2:57:49 PM

Unexpected error fetching reolink_rest-Security Camera System data: 'list' object is not an iterator Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data return await self.update_method() File "/config/custom_components/reolink_rest/init.py", line 76, in _update_data return await entity_data.async_update() File "/config/custom_components/reolink_rest/entity.py", line 454, in async_update result = await self._execute_commands(commands, command_channel=command_channel) File "/config/custom_components/reolink_rest/entity.py", line 314, in _execute_commands or self._process_ptz_responses( File "/config/custom_components/reolink_rest/entity.py", line 660, in _process_ptz_responses channel = response.channel_id File "/usr/local/lib/python3.10/site-packages/async_reolink/rest/commands/ptz.py", line 227, in channel_id if (value := next(_list, None)) is None: TypeError: 'list' object is not an iterator

Dattamick commented 2 years ago

New error after most recent update -

Logger: custom_components.reolink_rest Source: util/dt.py:118 Integration: Reolink IP Device (documentation, issues) First occurred: 12:56:01 PM (3 occurrences) Last logged: 12:56:17 PM

Unexpected error fetching reolink_rest-Security Camera System data: 'int' object has no attribute 'value' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data return await self.update_method() File "/config/custom_components/reolink_rest/init.py", line 81, in _update_data return await entity_data.async_update() File "/config/custom_components/reolink_rest/entity.py", line 453, in async_update result = await self._execute_commands(commands, command_channel=command_channel) File "/config/custom_components/reolink_rest/entity.py", line 309, in _execute_commands self._processes_responses(response) File "/config/custom_components/reolink_rest/entity.py", line 261, in _processes_responses self.time_difference = dt.utcnow() - dt.as_utc(time) File "/usr/src/homeassistant/homeassistant/util/dt.py", line 118, in as_utc return dattim.astimezone(UTC) File "/usr/local/lib/python3.10/site-packages/async_reolink/api/commands/system.py", line 81, in utcoffset (start, end) = self._get_start_end(__dt.year) File "/usr/local/lib/python3.10/site-packages/async_reolink/api/commands/system.py", line 71, in _get_start_end year, (self._start.to_datetime(year), self._end.to_datetime(year)) File "/usr/local/lib/python3.10/site-packages/async_reolink/api/system/typings.py", line 71, in to_datetime delta += timedelta(days=self.weekday.value - WeekDays.MONDAY.value) AttributeError: 'int' object has no attribute 'value'

xannor commented 2 years ago

I have a new, better tested, version (v0.6.6), let me know if this works better.

Dattamick commented 2 years ago

thank you for your hard work. newest error after updating.

Unexpected error fetching reolink_rest-Security Camera System data: Subscripted generics cannot be used with class and instance checks Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data return await self.update_method() File "/config/custom_components/reolink_rest/init.py", line 82, in _update_data return await entity_data.async_update() File "/config/custom_components/reolink_rest/entity.py", line 475, in async_update result = await self._execute_commands(commands, command_channel=command_channel) File "/config/custom_components/reolink_rest/entity.py", line 335, in _execute_commands or self._process_ptz_responses( File "/config/custom_components/reolink_rest/entity.py", line 690, in _process_ptz_responses self.ptz[channel].update_presets(response.presets) File "/config/custom_components/reolink_rest/entity.py", line 217, in update_presets if value is not None and not isinstance(value, Mapping[int, ptz.Preset]): File "/usr/local/lib/python3.10/typing.py", line 994, in instancecheck return self.subclasscheck(type(obj)) File "/usr/local/lib/python3.10/typing.py", line 997, in subclasscheck raise TypeError("Subscripted generics cannot be used with" TypeError: Subscripted generics cannot be used with class and instance checks

xannor commented 2 years ago

I published a new release v0.6.7 let me know if this works for you.

Dattamick commented 2 years ago

This seems to have done most of the trick. I get a photo update every 10 seconds, but no live feed when I click on them. Whats strange is with this enabled I no longer can access my logs, but when I revert they show up again. No clue whats happening there, may be something else on my end.

xannor commented 2 years ago

If the cameras are RTSP, and especially if they are 4K (H265), Home Assistant does not support their streams natively anymore, you have to use a RTSP to WebRTC proxy. I have a camera that falls into this category, and with a rPI not a lot of luck with the proxy.

Dattamick commented 2 years ago

Thank you. Can you direct me to a guide for that process? I found the integration and the directions there, but am not sure how to get the server URL

xannor commented 2 years ago

Ther server ur, i believe, is the address where you are running the proxy software. I currently have been using the addon version from here https://github.com/allenporter/stream-addons but it does not seem to work well on a Pi so I may have to install the proxy to another system with a bit more power in it. I had the same problem in the past with FFMPEG conversions.

xannor commented 1 year ago

After some testing, and limited time. I think I am going to put this on hiatus, I would recommend using the built in version as it has fundamentally surpassed what I have built and will have better support than I can provide.