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

Add entity registry support to ecobee integration #27088

Merged
merged 5 commits into from Oct 1, 2019

Conversation

@marthoc
Copy link
Contributor

commented Oct 1, 2019

Description:

Add the unique_id property to binary sensor, climate, sensor and weather platforms to add support for the entity registry.

Related issue (if applicable): N/A

Pull request with documentation for home-assistant.io (if applicable): N/A

Example entry for configuration.yaml (if applicable):

N/A

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

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

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

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
marthoc added 2 commits Oct 1, 2019
Add unique id for binary sensor, climate, and sensor.
@project-bot project-bot bot added this to Needs review in Dev Oct 1, 2019
"""Return a unique identifier for this sensor."""
for sensor in self.data.ecobee.get_remote_sensors(self.index):
if sensor["name"] == self.sensor_name:
if "code" in sensor:

This comment has been minimized.

Copy link
@balloob

balloob Oct 1, 2019

Member

https://www.ecobee.com/home/developer/api/documentation/v1/objects/RemoteSensor.shtml

id seems to always be unique. Any reason why you would prefer code over id ?

This comment has been minimized.

Copy link
@marthoc

marthoc Oct 1, 2019

Author Contributor

id seems to be unique based to the particular thermostat installation, and seems to be assigned sequentially based on when the sensor is added to the thermostat. code is printed on the actual sensor itself, so appears to be a better unique_id since the sensor could be paired to a different/new thermostat but would still identify itself to Home Assistant by its own unique identifier.

Sensors that do not have the 'code' property are built into the thermostat itself. Now that I think about it, in that case it actually may be better to use the thermostat's serial number suffixed with the device class ("-occupancy", "-humidity", or "-temperature") as a truly unique id that won't change based on the installation.

This comment has been minimized.

Copy link
@marthoc

marthoc Oct 1, 2019

Author Contributor

Thinking about this further, I think it is best to use id for those sensors that are built into the thermostat - given that they are built in I think that the id assigned remains constant so it is a good unique identifier. My stance on using code for the remote sensors remains the same.

This comment has been minimized.

Copy link
@balloob
@frenck frenck added the Hacktoberfest label Oct 1, 2019
@MartinHjelmare MartinHjelmare moved this from Needs review to Review in progress in Dev Oct 1, 2019
Dev automation moved this from Review in progress to Reviewer approved Oct 1, 2019
@balloob
balloob approved these changes Oct 1, 2019
@balloob balloob merged commit ee45431 into home-assistant:dev Oct 1, 2019
11 checks passed
11 checks passed
CI Build #20191001.67 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing a9398a3...6581bcc
Details
codecov/project 94.32% (target 90%)
Details
Dev automation moved this from Reviewer approved to Done Oct 1, 2019
@balloob

This comment has been minimized.

Copy link
Member

commented Oct 1, 2019

Thanks !

@lock lock bot locked and limited conversation to collaborators Oct 2, 2019
@marthoc marthoc deleted the marthoc:ecobee-entity-registry-support branch Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
5 participants
You can’t perform that action at this time.