jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
191 stars 46 forks source link

v0.9.0 changes existing device names and sensor in HA #207

Closed Clam58 closed 1 year ago

Clam58 commented 1 year ago

Just updated to v0.9.0 and noticed many of my devices/entities in HA (Home Assistant 2023.4.3, Supervisor 2023.04.0, Operating System 9.5, Frontend 20230411.0 - latest) have been renamed e.g. what was named “living room lights” is now called “Aurora Zigbee Dimmer”. As I have dozens like this it is a lot of manual editing to revert. Was this change as expected, if not, can it be “fixed” without me manually editing each entity affected?

Thanks

syepes commented 1 year ago

This is an expected change, as before the HE Name, Label and Type where used differently https://github.com/jason0x43/hacs-hubitat/commit/917d6c1f6ece15dd05e9bb1474ebac08dcbf744b

I had to drop all my previous devices and let the integration recreate them.

@jason0x43 Should add a small note about the behavior / breaking change

Clam58 commented 1 year ago

Thanks for clarifying this as expected.

Up to now I’ve used the device label in Hubitat to match the entity name in HA. I’ve left the device name to match its type, which gives me what I want in the Hubitat UI, and was consistent in HA. Is there a case for mapping through the label if present in Hubitat, reverting to the name if not?

Regards

syepes commented 1 year ago

Let me look at this later today and if its a bug i'll send a pr.

@jason0x43 do you think it would be possible to add an option to allow the users to select if they want to use the HE name or label as HA name, what do you think?

jason0x43 commented 1 year ago

Based on Hubitat's behavior, I think we should return the Hubitat label property as the HA name if label is defined, and use the Hubitat name property otherwise.

jason0x43 commented 1 year ago

That will allow users who don't define labels to use name, and users that have have defined labels won't need to change anything.

jason0x43 commented 1 year ago

@Clam58 Give v0.9.1 a try.

syepes commented 1 year ago

That seams like a good compromise, we just need to check it has been defined or not

jason0x43 commented 1 year ago

we just need to check it has been defined or not

It's actually always defined (I just tested it). The label property returned by Maker API has the desired behavior by itself -- it will be the device's label property if the user has set a label, otherwise it will be the device's name property. So we could go back to always using the Hubitat label property for HA's name.

Clam58 commented 1 year ago

@Clam58 Give v0.9.1 a try.

Yes, that does exactly what I want.

Thanks!

jhstroebel commented 1 year ago

Should this change rename things back? I think I'm on v0.9.1, but my names are still the "name" field, which is very useless...

syepes commented 1 year ago

@jason0x43 Reload the integration or restart it, it should refresh all you devices

jhstroebel commented 1 year ago

Tried... Entities look fine, but Device names are still all messed up.

jason0x43 commented 1 year ago

Ah, I think I see the issue.

jason0x43 commented 1 year ago

@jhstroebel Give v0.9.2 a try.

jhstroebel commented 1 year ago

That did it. Thank you!

jhstroebel commented 1 year ago

Actually, another place...

The initial exclude menu in configuration pulls the new labels, but the "Switches -> Lights" and the "Lights -> Switches" options still are pulling the name instead of the label.

Not a massive issue for me at the moment.

I very much appreciate your quick change for v0.9.2 to get those changed! THANK YOU!

syepes commented 1 year ago

Do we still use the name if no user defined labels have been defined?

jason0x43 commented 1 year ago

Yes -- that's how the Maker API works. The value it sends for a device's "label" property will be the label from the Hubitat device page if the user has set one, or the name otherwise.