Skip to content

WIP: add model and serial to caseta devices#14037

Closed
mdonoughe wants to merge 3 commits intohome-assistant:devfrom
mdonoughe:caseta-registry
Closed

WIP: add model and serial to caseta devices#14037
mdonoughe wants to merge 3 commits intohome-assistant:devfrom
mdonoughe:caseta-registry

Conversation

@mdonoughe
Copy link
Copy Markdown
Contributor

Description:

This depends on gurumitts/pylutron-caseta#25 which has not been merged yet, and I have not actually tested it on my environment yet.

This should add model numbers and serial numbers to lutron_caseta devices and enable the entity registry.

Related issue (if applicable): N/A

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): N/A

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

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

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

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

  • Tests have been added to verify that the new code works.

@property
def unique_id(self):
"""Return the unique ID of the device (model + serial)."""
return "{}.{}".format(self._device_model, self._device_serial)
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.

Wouldn't a serial be enough to provide a unique id?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Probably. I don't know if it's the serial number for that model or the serial number for all devices they've produced. It's just an integer value.

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.

It must be the serial for the devices. Let's stick with just the serial.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm worried about the super improbable case where somebody buys both dimmer switch 1234 and binary switch 1234, but probably serial is fine.

@mdonoughe
Copy link
Copy Markdown
Contributor Author

This does seem to work. I've created a Docker image mdonoughe/home-assistant:0.67.1-caseta-registry where I've hacked in the updated code and when I run it I get entries in my entity_registry.yaml and the option to rename things in the UI.

return self._device_name

@property
def model(self):
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.

This property can be removed now.

@andrey-git
Copy link
Copy Markdown
Contributor

@mdonoughe Any updates on this PR?

@mdonoughe
Copy link
Copy Markdown
Contributor Author

It needs a new release of pylutron_caseta before it will work.

@balloob
Copy link
Copy Markdown
Member

balloob commented May 18, 2018

Let's close this PR and you can open a new one when a new release has been done.

@balloob balloob closed this May 18, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants