Skip to content

Improve Honeywell US climate component#5313

Merged
balloob merged 6 commits into
home-assistant:devfrom
titilambert:honeywell
Mar 2, 2017
Merged

Improve Honeywell US climate component#5313
balloob merged 6 commits into
home-assistant:devfrom
titilambert:honeywell

Conversation

@titilambert
Copy link
Copy Markdown
Contributor

@titilambert titilambert commented Jan 14, 2017

Description:

This patch import the US Honeywell component. It adds the operation mode, fan mode and away mode
It adds also some other attributes:

  • fan: return the current fan state (idle, or running)
  • away_mode return the current away mode state (true or false)
  • state: return the current operation mode (idle, off, heat, cool)

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

Checklist:

If the code communicates with devices, web services, or third-party tools:

  • Documentation added/updated in home-assistant.github.io
  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

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.

@mention-bot
Copy link
Copy Markdown

@titilambert, thanks for your PR! By analyzing the history of the files in this pull request, we identified @turbokongen, @fabaff and @kk7ds to be potential reviewers.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (92 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (98 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (81 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (149 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

undefined name 'CONF_AWAY_TEMPERATURE'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

undefined name 'CONF_AWAY_TEMPERATURE'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

undefined name 'CONF_AWAY_TEMPERATURE'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

too many blank lines (2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (85 > 79 characters)

@arsaboo
Copy link
Copy Markdown
Contributor

arsaboo commented Jan 16, 2017

Will this work with the Honeywell Lyric thermostats?

@titilambert
Copy link
Copy Markdown
Contributor Author

titilambert commented Jan 16, 2017

@arsaboo I don't think so, my thermostat is not a Lyric thermostat :/

@titilambert titilambert force-pushed the honeywell branch 3 times, most recently from b621fa5 to aedb06d Compare January 17, 2017 00:56
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

redefinition of unused 'ATTR_FAN_MODE' from line 9

@titilambert titilambert force-pushed the honeywell branch 10 times, most recently from ca7cafb to 39c5d4e Compare January 17, 2017 02:47
@titilambert titilambert changed the title [WIP] Improve Honeywell US climate component Improve Honeywell US climate component Feb 16, 2017
@titilambert
Copy link
Copy Markdown
Contributor Author

:/ Need to fix tests before

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (82 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (82 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (82 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

too many blank lines (2)

@titilambert
Copy link
Copy Markdown
Contributor Author

titilambert commented Feb 17, 2017

Tests fixed !

)
except socket.error:
_LOGGER.error(
_LOGGER.exception(
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.

We should not use .exception. This will cause a stacktrace to be printed for the users although the error message already tells them what is going on.

client = somecomfort.SomeComfort(username, password)
except somecomfort.AuthError:
_LOGGER.error('Failed to login to honeywell account %s', username)
_LOGGER.exception('Failed to login to honeywell account %s', username)
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.

Same

return False
except somecomfort.SomeComfortError as ex:
_LOGGER.error('Failed to initialize honeywell client: %s', str(ex))
_LOGGER.exception('Failed to initialize honeywell client: %s', str(ex))
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.

Same

except StopIteration:
_LOGGER.error("Did not receive any temperature data from the "
"evohomeclient API.")
_LOGGER.exception("Did not receive any temperature data from the "
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.

Same

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.

This whole method actually seems very weird. Why would temperatures throw a StopIteration error and how will we know that we have already assigned a value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good questions... I don't know... the code was here 6 month ago (ada4de3#diff-896a11ee424d43689886053ccedb92d9R178) maybe @turbokongen can help us with this ?

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.

My bad, didn't realize it wasn't you. (still weird ;-) )

temperature)
except somecomfort.SomeComfortError:
_LOGGER.error('Temperature %.1f out of range', temperature)
_LOGGER.exception('Temperature %.1f out of range', 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.

_LOGGER.error

def current_operation(self: ClimateDevice) -> str:
"""Return current operation ie. heat, cool, idle."""
return getattr(self._device, ATTR_SYSTEM_MODE, None)
oper = getattr(self._device, ATTR_CURRENT_OPERATION, 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.

Will this do I/O inside the event loop? (which is not allowed)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, we need to run self._device.refresh() to update this value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And I'm confirming it, using tcpdump

@titilambert
Copy link
Copy Markdown
Contributor Author

This whole method actually seems very weird. Why would temperatures throw a StopIteration error and how will we know that we have already assigned a value?

Good questions... I don't know... the code was here 6 month ago (ada4de3#diff-896a11ee424d43689886053ccedb92d9R178) maybe @turbokongen can help us with this ?

@balloob
Copy link
Copy Markdown
Member

balloob commented Mar 2, 2017

Top! 🐬

@balloob balloob merged commit 31bf5b8 into home-assistant:dev Mar 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants