Skip to content

Fix issues with generic thermostat#11805

Merged
MartinHjelmare merged 2 commits into
home-assistant:devfrom
ciotlosm:fix_issues_generic_thermostat
Jan 22, 2018
Merged

Fix issues with generic thermostat#11805
MartinHjelmare merged 2 commits into
home-assistant:devfrom
ciotlosm:fix_issues_generic_thermostat

Conversation

@ciotlosm
Copy link
Copy Markdown
Contributor

@ciotlosm ciotlosm commented Jan 19, 2018

Description:

  • Fixes issues
  • Improves away_mode to be optional based on away_temp setting in config

Related issue (if applicable):
fixes #11757, fixes #11798, fixes #11763

Pull request in home-assistant.github.io with documentation (if applicable):
home-assistant/home-assistant.io#4462

Checklist:

  • The code change is tested and works locally.

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@MartinHjelmare MartinHjelmare changed the title Fixes for #11757 #11798 #11763 Fix issues with generic thermostat Jan 20, 2018
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good! Some minor comments below.

self._target_temp = self.min_temp
_LOGGER.warning('Undefined target temperature, \
falling back to %s', self._target_temp)
_LOGGER.warning('Undefined target temperature,'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use double quotes for log messages.

self._is_away = True if str(
old_state.attributes[ATTR_AWAY_MODE]) == STATE_ON else False
if old_state.attributes[ATTR_AWAY_MODE] is not None:
self._is_away = True if str(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

self._is_away = str(
    old_state.attributes[ATTR_AWAY_MODE]) == STATE_ON

if self._initial_operation_mode is None:
if old_state.attributes[ATTR_OPERATION_MODE] == STATE_OFF:
self._enabled = False
if old_state.attributes[ATTR_OPERATION_MODE] is not None:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Join this with the statement on the previous line using AND.

self._active = True
_LOGGER.info('Obtained current and target temperature. '
'Generic thermostat active.')
'Generic thermostat active. %s, %s',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use double quotes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

visually indented line with same indent as next logical line

@ciotlosm
Copy link
Copy Markdown
Contributor Author

@MartinHjelmare updates changes. With your help I also found a useless if that was covered by the next one, so I removed it as well.

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

🎉

@MartinHjelmare MartinHjelmare merged commit c8d26d9 into home-assistant:dev Jan 22, 2018
@balloob balloob mentioned this pull request Jan 26, 2018
@home-assistant home-assistant locked and limited conversation to collaborators May 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

4 participants