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

Netatmo thermostat #3888

Merged
merged 6 commits into from Oct 18, 2016
Merged

Netatmo thermostat #3888

merged 6 commits into from Oct 18, 2016

Conversation

gieljnssns
Copy link
Contributor

@gieljnssns gieljnssns commented Oct 15, 2016

Description:

This PR is to integrate the Netatmo Smart Thermostat in Home Assistant.
Sorry for the second PR, I messed up the first one. #3836

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

Example entry for configuration.yaml (if applicable):

climate:
  platform: netatmo

Checklist:

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

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

  • 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.

@gieljnssns
Copy link
Contributor Author

Just one test fails with tox

ERROR: InvocationError: '/Users/giel/Github/home-assistant/.tox/typing/bin/mypy --silent-imports homeassistant'
________________________________________________________________________________________________ summary _________________________________________________________________________________________________
  py34: commands succeeded
  py35: commands succeeded
  lint: commands succeeded
  requirements: commands succeeded
ERROR:   typing: commands failed

Really don't know how to fix this.

@gieljnssns
Copy link
Contributor Author

local testing tox -e py34:
tests/components/notify/test_group.py::TestNotifyGroup::test_entity_data_passes_through PASSED

testing true Travis:
tests/components/notify/test_group.py::TestNotifyGroup::test_entity_data_passes_through FAILED

=================================== FAILURES ===================================
_______________ TestNotifyGroup.test_entity_data_passes_through ________________
self = <tests.components.notify.test_group.TestNotifyGroup testMethod=test_entity_data_passes_through>
    def test_entity_data_passes_through(self):
        """Test sending a message with data to merge to a notify group."""
        notify_data = {'hello': 'world'}
        self.service.send_message('Hello', title='Test notification',
                                  data=notify_data)
        self.hass.block_till_done()
        data = self.events[-1].data
>       assert {
            'message': 'Hello',
            'target': ['unnamed device'],
            'title': 'Test notification',
            'data': {'hello': 'world', 'test': 'message'}
        } == data
E       AssertionError: assert {'data': {'he...notification'} == {'data': {'hel...notification'}
E         Common items:
E         {'data': {'hello': 'world', 'test': 'message'},
E          'message': 'Hello',
E          'title': 'Test notification'}
E         Left contains more items:
E         {'target': ['unnamed device']}
E         Full diff:
E         {'data': {'hello': 'world', 'test': 'message'},
E         'message': 'Hello',
E         -  'target': ['unnamed device'],
E         'title': 'Test notification'}
tests/components/notify/test_group.py:76: AssertionError
------------------------------ Captured log call -------------------------------
selector_events.py          49 DEBUG    Using selector: EpollSelector
common.py                  346 DEBUG    Configuration for notify, Validated: [{'platform': 'demo', 'name': 'demo1'}, {'platform': 'demo', 'name': 'demo2'}], Original [{'platform': 'demo', 'name': 'demo1'}, {'platform': 'demo', 'name': 'demo2'}]
core.py                    448 INFO     Bus:Handling <Event service_registered[L]: domain=notify, service=demo1_test_target_name>
core.py                    448 INFO     Bus:Handling <Event service_registered[L]: domain=notify, service=demo1>
core.py                    448 INFO     Bus:Handling <Event service_registered[L]: domain=notify, service=demo2_test_target_name>
core.py                    448 INFO     Bus:Handling <Event service_registered[L]: domain=notify, service=demo2>
core.py                    448 INFO     Bus:Handling <Event component_loaded[L]: component=notify>
core.py                    448 INFO     Bus:Handling <Event call_service[L]: domain=notify, service_data=message=Hello, data=hello=world, title=Test notification, service_call_id=140081838848544-1, service=demo1>
core.py                    448 INFO     Bus:Handling <Event call_service[L]: domain=notify, service_data=message=Hello, data=test=message, hello=world, target=unnamed device, title=Test notification, service_call_id=140081838848544-2, service=demo2>
core.py                    448 INFO     Bus:Handling <Event notify[L]: data=test=message, hello=world, message=Hello, target=['unnamed device'], title=Test notification>
core.py                    448 INFO     Bus:Handling <Event service_executed[L]: service_call_id=140081838848544-2>
core.py                    448 INFO     Bus:Handling <Event notify[L]: data=test=message, hello=world, message=Hello, title=Test notification>
core.py                    448 INFO     Bus:Handling <Event service_executed[L]: service_call_id=140081838848544-1>
core.py                    448 INFO     Bus:Handling <Event homeassistant_stop[L]>
============== 1 failed, 1324 passed, 54 skipped in 55.50 seconds ==============
ERROR: InvocationError: '/home/travis/build/home-assistant/home-assistant/.tox/py34/bin/py.test -v --timeout=30 --duration=10 --cov --cov-report='
___________________________________ summary ____________________________________
ERROR:   py34: commands failed
The command "tox" exited with 1.

@jabesq jabesq mentioned this pull request Oct 16, 2016
8 tasks
@balloob
Copy link
Member

balloob commented Oct 16, 2016

You can ignore tests.components.notify.test_group.TestNotifyGroup. It's flaky.

@@ -37,6 +38,7 @@
vol.Required(CONF_PASSWORD): cv.string,
vol.Required(CONF_SECRET_KEY): cv.string,
vol.Required(CONF_USERNAME): cv.string,
vol.Optional(CONF_DEVICES, default=DEFAULT_DEVICES): cv.ensure_list,
Copy link
Member

Choose a reason for hiding this comment

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

I do not see a use case for making this configurable. It also should get validated against all valid values (which I guess are DEFAULT_DEVICES?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was my solution for #2601 before the hotfix #3837.
I'm going to remove this.

"""Get the latest data from NetAtmo API and updates the states."""
self._data.update()
self._target_temperature = self._data.thermostatdata.setpoint_temp
self._away = (True if self._data.setpoint_mode == 'away' else False)
Copy link
Member

Choose a reason for hiding this comment

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

self._away = self._data.setpoint_mode == 'away'

@gieljnssns
Copy link
Contributor Author

You can ignore tests.components.notify.test_group.TestNotifyGroup. It's flaky.

How do I do this?
And is there something to ignore this:

ERROR: InvocationError: '/Users/giel/Github/home-assistant/.tox/typing/bin/mypy --silent-imports homeassistant'

when i do local testing?

@balloob balloob merged commit 3b424b0 into home-assistant:dev Oct 18, 2016
@balloob
Copy link
Member

balloob commented Oct 18, 2016

For future development, you can run just the linting tox or even just the commands for linting. See https://home-assistant.io/developers/development_testing/#testing-tips

Thanks for your contribution! 🐬

@gieljnssns gieljnssns deleted the netatmo-thermostat branch October 18, 2016 06:56
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 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.

None yet

3 participants