home-assistant-garmin_connect icon indicating copy to clipboard operation
home-assistant-garmin_connect copied to clipboard

Add user in sensor name

Open djiesr opened this issue 1 year ago • 13 comments

Add the name of the user in sensor entity id to know wath sensor fit with user

Exemple: sensor.weight

If the email of the account is [email protected] The sensor will be sensor.name_weight

To name or rename all sensor, it's a big work, I think it's more userfriendly if we have the name at start

Thanks

djiesr avatar Aug 13 '23 12:08 djiesr

Completely agree. And then it will be useful if pulling several users 👥

ezpl avatar Aug 15 '23 04:08 ezpl

Thought about this earlier too, it's easy to implement, but current users have a big task ahead. Will implement this soon.

cyberjunky avatar Aug 18 '23 05:08 cyberjunky

Thought about this earlier too, it's easy to implement, but current users have a big task ahead. Will implement this soon.

Fantastic, thanks 👍😀 Perhaps it could be an option in the configuration flow, so existing users could add another integration, get promoted to include user name in sensor name, then update existing dashboards, automations etc. when convenient?

Of course, hardliners could go ahead and update entity names manually anyway.

ezpl avatar Aug 18 '23 05:08 ezpl

Thanks! I think it's a good move for the futur. :)

djiesr avatar Aug 18 '23 22:08 djiesr

thanks alot. It is amazing plugin. I was surprised to find, it exist. thank you. It would be perfect to be able to integrate stats from family at home...

hynek2001 avatar Sep 24 '23 09:09 hynek2001

Thought about this earlier too, it's easy to implement, but current users have a big task ahead. Will implement this soon.

@cyberjunky Any news regarding that? I can try to help with a PR if it wasn't started and there's a direction on how to solve it

ronlut avatar Jan 07 '24 20:01 ronlut

Hi @ronlut it's a rather simple change, but I don't want to mess up all people's sensors, so looking into a way to do it without much disturbance.

cyberjunky avatar Jan 08 '24 08:01 cyberjunky

@cyberjunky I'll hopefully open a PR in the following days once I have a free hour 🙏 I'll handle #119 as well

ronlut avatar Jan 08 '24 20:01 ronlut

@cyberjunky I thought of adding two checkboxes when configuring the integration:

  1. Prepend domain name to sensor names
  2. Prepend username to sensor names

They will both be disabled default, but if the user checks them it will create all sensors with either domain/username prepended or both.

Started looking into it yesterday but I need to set up a proper debugging environment otherwise it's too much of a hassle to check each change. Are you using devcontainers when developing?

ronlut avatar Jan 10 '24 11:01 ronlut

@ronlut I do for newer integration, but didn't include the config in this one, will have a look. Maybe we just add those prepends by default, it's onetime stress/work but then we are treating it like all other home assistant integrations.

cyberjunky avatar Jan 10 '24 12:01 cyberjunky

@cyberjunky see this https://github.com/cyberjunky/home-assistant-garmin_connect/pull/120 I went with taking the username part of emails as full email felt too much in sensor names and entity ids..

I can add the config options to disable this behaviour to make it backward compatible LMKWYT

ronlut avatar Jan 10 '24 22:01 ronlut

@cyberjunky see this https://github.com/cyberjunky/home-assistant-garmin_connect/pull/120 I went with taking the username part of emails as full email felt too much in sensor names and entity ids..

I can add the config options to disable this behaviour to make it backward compatible LMKWYT

Would be great for me ❤️

LazyTarget avatar Jan 17 '24 00:01 LazyTarget

@cyberjunky see this #120 I went with taking the username part of emails as full email felt too much in sensor names and entity ids..

I can add the config options to disable this behaviour to make it backward compatible LMKWYT

Maybe this is better, or even have a entry field where people can fill in the name they want to prepend (this requires an extra data[] field to be stored, but yeah...)

cyberjunky avatar Jan 17 '24 08:01 cyberjunky