Skip to content
xannor edited this page Sep 21, 2022 · 3 revisions

This integration, and its supporting libraries, support some basic logging functionality. The defaults are to log only minimal necessary information to conserve space, and reduce processing time. However, then things do not go as planned debug logs are invaluable for fixing issues.

There are 4 basic log levels used:

  • Error - critical failures or issues, these should always show up in logs, and may include stack traces when core errors occur. These are vital for finding and correcting errors, and any issue requests without them would rely on the ability to reproduce the error, which is not generally possible.

  • Warning - Usually notifications of either an unexpected, but handled, result, or a configuration issue. Mostly this means a setting was ignored or a value was changed that the config was dependent on, but the code adjusted for this. These are not critical, but could cause things to be less performant if left unattended

  • Info - Like Warning these are non-critical notices, usually meant to help trace issues but reporting what is working

  • Debug - These are general, raw, low level notices necessary for debugging issues. These are extremely useful for reproducing a devices state with actually having the devices. Having this level of logging info provided with issues greatly reduces the time needed to fix an issue, however these are unfiltered values, and could very likely contain sensitive information so should be scrubbed before being posted with an issue.

to turn on debug logging, you need to edit the configuration.yaml of home assistant and either add or modify the

logger:
    default: info
    logs:

adding async_reolink.rest: debug to the end of the list so the support libs know to output debugging information.

logger:
    default: info
    logs:
        async_reolink.rest: debug

This will include async_reolink.rest entries in the logs which will include the request sent to all devices and the replies received. You can view these entries from the log viewer by specifying load full logs, or via the homassistant.log file that is usually located in the config folder.

The entries that are most usefull are stack traces, and communications data.

Stack traces tend to look like the following:

Unexpected error fetching reolink_rest-192.168.2.88 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'

Anytime async_reolink or reolink_rest is in the line, it means the stack passed through my code and would probably be of use.

Also debug data, when debugging is enbled, may be present and can be usefull for repdoucing the "state" prior to an error or issue, which helps speed up resolution.

022-09-15 00:52:52.004 DEBUG (MainThread) [async_reolink.rest.connection.data] xxx.xxx.xxx.xxx->[{'cmd': 
022-09-15 00:52:52.004 DEBUG (MainThread) [async_reolink.rest.connection.data] xxx.xxx.xxx.xxx-<[{'cmd': 

These lines represent request being sent -> and replys being received <-, however becase this is raw data, sensitive information like UUID, passwords, network configuration, etc can be presentm and must be manually scrubbed before posting as that is data you DO NOT WANT public.

Clone this wiki locally