Skip to content

Use API to discover Hue if no bridges specified#11909

Merged
pvizeli merged 2 commits into
devfrom
hue-discovery
Jan 25, 2018
Merged

Use API to discover Hue if no bridges specified#11909
pvizeli merged 2 commits into
devfrom
hue-discovery

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Jan 25, 2018

Description:

No longer require the user to configure the Hue bridge. If no bridges specified, query the Philips Hue discovery API and use those bridges instead.

API will only be queried if: user configured the hue component to be loaded but did not specify any bridge configs. API will not be queried if Hue is loaded via discovery (because then no entry in the config).

Phue is a bit weird as a dependency because it enforces reading/writing to a file. The config would be a lot easier if we could store all config for all bridges in 1 file.

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

Example entry for configuration.yaml (if applicable):

hue:

Checklist:

  • The code change is tested and works locally.

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.

Comment thread tests/common.py
"""Apply decorator."""
from unittest.mock import MagicMock, patch

def __enter__(self):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Rewriting MockDependency so that it can be used as both a decorator and a context manager.

@pvizeli pvizeli merged commit 3d9ff37 into dev Jan 25, 2018
@pvizeli pvizeli deleted the hue-discovery branch January 25, 2018 13:55
config = config.get(DOMAIN)
if config is None:
config = {}
conf = config.get(DOMAIN)
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.

Use an empty dictionary as default value.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point. I just copied that from the original code.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Damn you're on a roll with good code reviews Martin!

@balloob balloob mentioned this pull request Jan 26, 2018
matemaciek pushed a commit to matemaciek/home-assistant that referenced this pull request Jan 27, 2018
* upstream/master: (465 commits)
  Update pyhomematic to 0.1.38 (home-assistant#11936)
  Implement Alexa temperature sensors (home-assistant#11930)
  Fixed rfxtrx binary_sensor KeyError on missing optional device_class (home-assistant#11925)
  Allow setting climate devices to AUTO mode via Google Assistant (home-assistant#11923)
  fixes home-assistant#11848 (home-assistant#11915)
  Add "write" service to system_log (home-assistant#11901)
  Update frontend to 20180126.0
  Version 0.62
  Allow separate command and state OIDs and payloads in SNMP switch (home-assistant#11075)
  Add ERC20 tokens to etherscan.io sensor (home-assistant#11916)
  Report scripts and groups as scenes to Alexa (home-assistant#11900)
  Minor fix to configuration validation and related log line. (home-assistant#11898)
  Multi-Room Support for Greenwave Reality (home-assistant#11364)
  Added Xeoma camera platform (home-assistant#11619)
  Improve foscam library exception support (home-assistant#11701)
  Iota wallet (home-assistant#11398)
  New venstar climate component (home-assistant#11639)
  Update python-wink version and multiple wink fixes/updates. (home-assistant#11833)
  Use API to discover Hue if no bridges specified (home-assistant#11909)
  Clarify emulated hue warning (home-assistant#11910)
  ...
@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

Development

Successfully merging this pull request may close these issues.

4 participants