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

@marthoc marthoc 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.

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:
Copy link
Member

Choose a reason for hiding this comment

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

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

ok!

@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 merged commit ee45431 into home-assistant:dev Oct 1, 2019
Dev automation moved this from Reviewer approved to Done Oct 1, 2019
@balloob
Copy link
Member

balloob commented Oct 1, 2019

Thanks !

@lock lock bot locked and limited conversation to collaborators Oct 2, 2019
@marthoc marthoc deleted the ecobee-entity-registry-support branch October 8, 2019 00:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants