Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor icon indicating copy to clipboard operation
Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor copied to clipboard

Add unique_id

Open gjohansson-ST opened this issue 3 years ago • 8 comments

I am guessing based on the other PR that you want the merge into dev and not master.

Besides all the formatting changes (I do this in Home Assistant dev environment so it runs black etc. for me) it implements unique id so one can format the entity after it's in HA.

Let me know if you don't want the formatting but I notice also the imports etc. are not to HA preference so I would not mind to do a follow-up PR to "clean" it a bit to standard.

gjohansson-ST avatar May 28 '22 18:05 gjohansson-ST

Yup, I prefer to keep code changes on dev branch until a release.

Shouldn't unique_id be generated automatically instead of being provided in yaml?

Imports would probably benefit form a little bit of isort but I have mixed feelings about black, as it tends to split lines in places I prefer to keep inline

PiotrMachowski avatar May 28 '22 19:05 PiotrMachowski

Shouldn't unique_id be generated automatically instead of being provided in yaml?

Not for yaml as they need to be persistent between reboots (or it would create a new entity every time) hence why someone needs to manually type something unique.

Imports would probably benefit form a little bit of isort but I have mixed feelings about black, as it tends to split lines in places I prefer to keep inline

I know what you mean 😄

Before I reformat all your stuff here let me know how you want it, worst case I just use notepad or something to add the bits in 😆

gjohansson-ST avatar May 28 '22 19:05 gjohansson-ST

Not for yaml as they need to be persistent between reboots (or it would create a new entity every time) hence why someone needs to manually type something unique.

Well, it doesn't have to be randomly generated. My idea would be to use some existing parameter (maybe host?) to generate it.

Before I reformat all your stuff here let me know how you want it, worst case I just use notepad or something to add the bits in 😆

Maybe let's leave it as it is for now, your changes are small enough to be possible to be done in notepad 😜

PiotrMachowski avatar May 28 '22 19:05 PiotrMachowski

Ok, so moved back on the formatting thanks to notepad 😆

I still say it's better to have a manual unique id as host and all other parameters could change. Maybe not a big deal for this integration but on the other hand with all this config adding one more should not be a deal-breaker

gjohansson-ST avatar May 28 '22 21:05 gjohansson-ST

The problem is that most of users won't configure it when it has to provided manually. Host for a vacuum usually doesn't change even when it is not set as static because vacuum is connected to WiFi all the time. Additionally vacuum has to be reconfigured as well, so I would stick to generating unique_id using host.

PiotrMachowski avatar May 31 '22 09:05 PiotrMachowski

That's not a problem as then it would just be as today. It would be for more "advanced" users who knows what it is and how to use it. But it's your show so if you insist then I can change it 😃

gjohansson-ST avatar May 31 '22 16:05 gjohansson-ST

I plan to add config flow to this integration someday, using host will match it better as well

PiotrMachowski avatar May 31 '22 16:05 PiotrMachowski

Ok, I set it now so it's some text + the host to ensure it's unique in everyone's HA.

gjohansson-ST avatar Jun 03 '22 16:06 gjohansson-ST

just wondered if there was any further progress on this?

collse avatar Jun 29 '23 15:06 collse

HI, i've just installed the xiaomi cloud map extractor. The unique id is still missing

I want to configure it (rename it, change the icon and so on) but i can't. Should I define it manually ?

Moreover, in the last release home assistant provide an image entity. Maybe defining a camera isn't needed anymore.

agentdouble avatar Jul 14 '23 22:07 agentdouble

@akanegally you can change entity id by setting name in the config. You can also change icon in yaml (documentation).

Maybe defining a camera isn't needed anymore.

I think you have misunderstood how image entities work

PiotrMachowski avatar Jul 14 '23 22:07 PiotrMachowski