Set InsteonEntity name to be combo of description and address.#17262
Set InsteonEntity name to be combo of description and address.#17262balloob merged 12 commits intohome-assistant:devfrom wonderslug:insteon_entity_name_17194
Conversation
ie "LampLinc Dimmer 26453a" or "Keypad Dimmer 291abb_2" Using a centralized network name
|
Opened to clean up #17195 instead of rebase |
|
info about integration |
| name = '{:s}_{:d}'.format(self._insteon_device.id, | ||
| self._insteon_device_state.group) | ||
| name = '{:s} {:s}'.format(self._insteon_device.description, | ||
| addr) |
There was a problem hiding this comment.
Is name expected to be a human readable name? If so, can I suggest using the following:
name = '{:s} {:s} Group {:d}'.format(self._insteon_device.description,
self._insteon_device.address.human,
self._insteon_device_state.group)
This will create a name that looks like KeyPadLinc Dimmer 1A.2B.3C Group 5
There was a problem hiding this comment.
The Human address is great and will add it in. As well I'm looking at making it even more contextual, adding "Fan"/"Light" for a FanLinc or "Relay"/"Sensor" for an I/OLinc instead of the group number id. Ill post an update to the PR soon.
functions then just the group id.
|
@wonderslug Just to be clear, hopefully we don't break the Just out of curiosity, do you use a PLM or a Hub? |
|
@teharris1 Thanks. Im trying to catch anything which has multiple states under the device, but I don't have the thermostat in there yet and I'm not sure how its going to respond to one. Don't have one to play with. This IS a breaking change on entity id but only if there is an upgrade without moving to a release that uses the new entity registry first. It needs to be relabeled as so. But based on @balloob 's comment on the original PR and comment on the unique_id addition the idea was that we would wait until 84 to release to allow for the new registry to get well used and catch most users once the unique_id is being used and the entity_id is set in the registry. That would keep the one thats already been set and used just as if its a customized one. I actually have both the Hub and a PLM. Im doing a migration from Indigo to Hass and have the PLM on my Indigo and the hub, which has all the same devices registered, connected to by Hass. My goal is to get all my migration done using the Hub and then switch over to the PLM once I'm done. |
…n order to fix lib loading issue for lint
|
This still feels like a lot of work for what you are trying to accomplish. Can we look at adding a field to the The only states I can see having an issue are the The other option is to look at the |
I looked at this. The main issues are duplicate state types in the states list and the index in the states matters to define the what to label as. The motion sensor for example has three OnOffSensors being states with 0x01 as Motion, 0x02 as Light, and 0x03 as Battery. The Water Leak sensor has something similar. So the combination of which device has a state and which index is the state matters to the context of the label.
I think this might work. I will explore it a bit more. The debug I did so far looks promising. |
|
I moved the label lookup to a simple dict mapping. This should work fine and allow mapping to changes made in insteonplm. Any new state name added to insteonplm will need to be added, but I don't see that as happening often. |
|
@teharris1 Hey what do you think about updating the insteonplm lib to 0.15.0 as part of this PR since its been released now? |
|
A PR has already been merged with it. Update your branch to see it. |
|
Well then nevermind that then :) |
|
It supports python 3.7 and has some hub improvements so rather than wait for this more extensive PR it made sense to push it out quick. |
…assistant#17262) * Set InsteonEntity name to be combo of description and address. ie "LampLinc Dimmer 26453a" or "Keypad Dimmer 291abb_2" Using a centralized network name * Updated the name to have a more contextual references for device functions then just the group id. * Cleanup for hound * Removed the _generate_network_address function. Not used anymore * Cleanup for lint * clean for hound * Moved descriptor mapper to be a class variable of the InsteonEntity in order to fix lib loading issue for lint * Well, moved DescriptorMapper instance to a function variable now... * fix hound * Lint Cleanup * Clean up docstrings * Simplify Label lookup based on state name

Description:
The Insteon initial entity_id is currently only the unique address of the Insteon device. This adds the device description to the name to allow easier identification
ie "LampLinc Dimmer 26453a" or "Keypad Dimmer 291abb_2"
Cleans up the unique_id so there is no duplicated code
Related issue (if applicable): fixes #17194
**Pull request in home-assistant.io with documentation (if applicable): NA
Example entry for
configuration.yaml(if applicable):insteon:Checklist:
tox. Your PR cannot be merged unless tests passIf the code does not interact with devices: