roleoroleo / yi-hack_ha_integration

Home Assistant custom integration for Yi cameras: yi-hack-MStar, yi-hack-Allwinner, yi-hack-Allwinner-v2, yi-hack-v5 and sonoff-hack
GNU General Public License v3.0
219 stars 32 forks source link

Enhance entity naming (similar to HA native entity naming) #137

Closed TheZoker closed 10 months ago

TheZoker commented 10 months ago

This PR sets custom names for all the entities.

Before: 23 11 26_16-14-44_AYqed

After: 23 11 26_16-17-28_QBvNk

Home Assistant will hide the device name in the entity name. Renaming the device will also work and will update the entity IDs. This change should bring the entity ids of this integration to work similar like native HA integration naming schema.

As you can see in this example, I renamed the device to Yi Home and this is the result of HAs automatic entity renaming: image

roleoroleo commented 10 months ago

Thank you for your pr. What happens if you have two or more cams?

TheZoker commented 10 months ago

Hi @roleoroleo

This should not be a problem. By default the integration still takes the cryptic device ID for the name and the entity ids.

image

So if you have two different cameras, the IDs will still be different.

roleoroleo commented 10 months ago

Tested, it works properly. What about labels in lines 31 and 55 of custom_components/yi_hack/switch.py? "Switch" instead of "Switch On", is a typo?

TheZoker commented 10 months ago

Glad to hear :)

Ah sorry, yes it was a type. I fixed it. PR should be ready to merge 🎉

roleoroleo commented 10 months ago

Thank you again for your time.

TheZoker commented 10 months ago

Thanks for considering my changes and merging the PR 🙂 And thanks for the integration and the firmware, really appreciate it!