{"action":"created","issue":{"url":"https://api.github.com/repos/home-assistant/home-assistant/issues/2608","repository_url":"https://api.github.com/repos/home-assistant/home-assistant","labels_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/2608/labels{/name}","comments_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/2608/comments","events_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/2608/events","html_url":"https://github.com/home-assistant/home-assistant/pull/2608","id":167194276,"number":2608,"title":"Fixes two bugs in with the netatmo components","user":{"login":"pablogsal","id":11718525,"avatar_url":"https://avatars.githubusercontent.com/u/11718525?v=3","gravatar_id":"","url":"https://api.github.com/users/pablogsal","html_url":"https://github.com/pablogsal","followers_url":"https://api.github.com/users/pablogsal/followers","following_url":"https://api.github.com/users/pablogsal/following{/other_user}","gists_url":"https://api.github.com/users/pablogsal/gists{/gist_id}","starred_url":"https://api.github.com/users/pablogsal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pablogsal/subscriptions","organizations_url":"https://api.github.com/users/pablogsal/orgs","repos_url":"https://api.github.com/users/pablogsal/repos","events_url":"https://api.github.com/users/pablogsal/events{/privacy}","received_events_url":"https://api.github.com/users/pablogsal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-23T17:28:47Z","updated_at":"2016-07-24T23:53:27Z","closed_at":"2016-07-23T19:43:26Z","pull_request":{"url":"https://api.github.com/repos/home-assistant/home-assistant/pulls/2608","html_url":"https://github.com/home-assistant/home-assistant/pull/2608","diff_url":"https://github.com/home-assistant/home-assistant/pull/2608.diff","patch_url":"https://github.com/home-assistant/home-assistant/pull/2608.patch"},"body":"**Description:**\r\n\r\nFor #2600 i have simply remove the dependency on the 'NETATMO' component in the /sensors/netatmo.py because that leads to a circular dependency relation. (See #2600).\r\n\r\nFor #2601 I checked if the user has a netatmo camera or a netatmo sensor and then only launch discover on the components that the user has specify in the configuration file.\r\n\r\nComments about efficiency:\r\n  \r\nTo search for netatmo components I perform a linear search over the keys of the 'config' dictionary because we do not know in which \"camera\" or \"sensor\" the netatmo camera/sensor is. So we need to obtain those (key,value) pairs where 'camera' is a substring of key and then for any of theese we check if value['platform'] == 'netatmo'. But we have to take care also if the value is a list of cameras (so another nested loop here). ** As hash tables do not support substring search we need the linear probe in the nested structure of the config dict**. \r\n\r\n**Related issue (if applicable):** \r\n\r\nfixes #2600\r\nfixes #2601 \r\n\r\n**Pull request in [home-assistant.io](https://github.com/home-assistant/home-assistant.io) with documentation (if applicable):** home-assistant/home-assistant.io#\r\n\r\n**Example entry for `configuration.yaml` (if applicable):**\r\n\r\n**Checklist:**\r\n\r\nIf user exposed functionality or configuration variables are added/changed:\r\n  - [ ] Documentation added/updated in [home-assistant.io](https://github.com/home-assistant/home-assistant.io)\r\n\r\nIf code communicates with devices, web services, or a:\r\n  - [ ] Local tests with `tox` run successfully. **Your PR cannot be merged unless tests pass**\r\n  - [ ] New dependencies have been added to the `REQUIREMENTS` variable ([example][ex-requir]).\r\n  - [ ] New dependencies are only imported inside functions that use them ([example][ex-import]).\r\n  - [ ] New dependencies have been added to `requirements_all.txt` by running `script/gen_requirements_all.py`.\r\n  - [ ] New files were added to `.coveragerc`.\r\n\r\nIf the code does not interact with devices:\r\n  - [ ] Local tests with `tox` run successfully. **Your PR cannot be merged unless tests pass**\r\n  - [ ] Tests have been added to verify that the new code works.\r\n\r\n[ex-requir]: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/keyboard.py#L16\r\n[ex-import]: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/keyboard.py#L51\r\n"},"comment":{"url":"https://api.github.com/repos/home-assistant/home-assistant/issues/comments/234811284","html_url":"https://github.com/home-assistant/home-assistant/pull/2608#issuecomment-234811284","issue_url":"https://api.github.com/repos/home-assistant/home-assistant/issues/2608","id":234811284,"user":{"login":"pablogsal","id":11718525,"avatar_url":"https://avatars.githubusercontent.com/u/11718525?v=3","gravatar_id":"","url":"https://api.github.com/users/pablogsal","html_url":"https://github.com/pablogsal","followers_url":"https://api.github.com/users/pablogsal/followers","following_url":"https://api.github.com/users/pablogsal/following{/other_user}","gists_url":"https://api.github.com/users/pablogsal/gists{/gist_id}","starred_url":"https://api.github.com/users/pablogsal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pablogsal/subscriptions","organizations_url":"https://api.github.com/users/pablogsal/orgs","repos_url":"https://api.github.com/users/pablogsal/repos","events_url":"https://api.github.com/users/pablogsal/events{/privacy}","received_events_url":"https://api.github.com/users/pablogsal/received_events","type":"User","site_admin":false},"created_at":"2016-07-24T23:53:27Z","updated_at":"2016-07-24T23:53:27Z","body":"For the camera problem yes, but there is another deeper problem with the circular redundancy:\r\n\r\nAs the API data is generated in the component, the sensor has a dependency on the component that cannot be broken but then hass raises the error of the component not completed because it has not yield True.\r\n\r\nSome idea of how to break the circular dependency?"}}
{"actor":{"display_login":"pablogsal"}}