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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add device name to sensor name for mobile_app #31756

Merged
merged 2 commits into from Feb 12, 2020

Conversation

dshokouhi
Copy link
Member

@dshokouhi dshokouhi commented Feb 12, 2020

Breaking change

Not a breaking change because once the entity is registered and rename this won't impact it.

Proposed change

Add the device name to the sensor name so they are easy to distinguish. Especially useful when you are logging into more than 1 device at a time because the sensor names will be like sensor.battery_level and sensor.battery_level_2. We will still hit the same issue if the device name is the same but it should help clear up some confusion about what device it is.

Fixes home-assistant/iOS#478
Fixes home-assistant/android#381

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml
mobile_app:

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 馃 Silver
  • 馃 Gold
  • 馃弳 Platinum

@probot-home-assistant
Copy link

Hey there @robbiet480, mind taking a look at this pull request as its been labeled with a integration (mobile_app) you are listed as a codeowner for? Thanks!

@dshokouhi
Copy link
Member Author

CC: @balloob there was some discussion in #devs_apps about this on discord so wanted your opinion on this change too

@@ -58,7 +60,7 @@ def should_poll(self) -> bool:
@property
def name(self):
"""Return the name of the mobile app sensor."""
return self._config[ATTR_SENSOR_NAME]
return self._name
Copy link
Member

Choose a reason for hiding this comment

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

For the name, I think the format Sensor Name (Device Name) works better too. That's a suggestion, not a directive, so i'm open to leaving it as is.

Copy link
Member

Choose a reason for hiding this comment

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

I think that we should Device Name Sensor Name, since we've been adding logic to strip off start of names if they match the container name. (ie Living Room area card will rename Living Room Lights -> Lights)

Copy link
Member

Choose a reason for hiding this comment

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

Also we have a unique ID, let the user do their thing :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup I agree we not only have unique ID but we also have the entity registered to the device so its not too difficult to find from device page. I think users are just confused by the generic name it gets when the sensor gets registered.

So the format I chose is good? Not sure if we have a official format to follow :)

Copy link
Member

Choose a reason for hiding this comment

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

What Paulus says goes, i'm fine with it.

@TomBrien
Copy link
Member

Would also close home-assistant/iOS#478

Dev automation moved this from Needs review to Reviewer approved Feb 12, 2020
@JBassett
Copy link
Contributor

Also close home-assistant/android#381

@balloob balloob merged commit 43256eb into home-assistant:dev Feb 12, 2020
Dev automation moved this from Reviewer approved to Done Feb 12, 2020
@lock lock bot locked and limited conversation to collaborators Feb 13, 2020
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.

Battery and wifi sensors have generic names Ask for device name during onboarding
6 participants