Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synology sensor quick return if attr is null #21709

Merged
merged 3 commits into from
Mar 9, 2019
Merged

Synology sensor quick return if attr is null #21709

merged 3 commits into from
Mar 9, 2019

Conversation

cmsimike
Copy link
Contributor

@cmsimike cmsimike commented Mar 6, 2019

Description:

There are some case where attr is null. Returning null doesn't change anything (in my case this is mapped to a volume that doesn't exist, not sure what others are seeing).

If you have confirmed you hass instance for C instead of F you do not see this error since in the C case you indirectly do the quick return and don't try to convert a None value.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

There are some case where attr is null. Returning null doesn't change anything (in my case this is mapped to a volume that doesn't exist, not sure what others are seeing). 

If you have confirmed you hass instance for C instead of F you do not see this error.
@@ -229,6 +229,9 @@ def state(self):
if self.var_id in temp_sensors:
attr = getattr(
self._api.storage, self.var_id)(self.monitor_device)

if attr == None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comparison to None should be 'if cond is None:'

@@ -229,6 +229,9 @@ def state(self):
if self.var_id in temp_sensors:
attr = getattr(
self._api.storage, self.var_id)(self.monitor_device)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

@ghost ghost assigned balloob Mar 6, 2019
@balloob balloob merged commit d8ac761 into home-assistant:dev Mar 9, 2019
@ghost ghost removed the in progress label Mar 9, 2019
@balloob balloob mentioned this pull request Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants