Radioh / ha_twitch_helix

Home Assistant custom component to integrate with Twitch helix api.
MIT License
21 stars 2 forks source link

Change output from "sensor.channelname" to "sensor.twitchtv.channelname" #13

Closed pixelwave closed 2 years ago

pixelwave commented 2 years ago

Everything works perfectly but how can I change the output sensors from "sensor.channelname" to "sensor.twitchtv_channelname"?

Radioh commented 2 years ago

Hi, the component will output the name of the streamer as the entity id. I think you can change it from inside Home Assistant by clicking 'developer tool'. There is a small guide here: https://www.home-assistant.io/docs/configuration/customizing-devices/

Also looks like this from inside HA:

Capture1 - Copy Capture2 - Copy

pixelwave commented 2 years ago

Thats what I did for now. But renaming all of them might be cumbersome in the future. I had the same issue with the custom "discord_game" integration on HACS. That naming convention was later changed from "sensor.discordid" to "sensor.discorduser_discordid" which is handy when using automated fill lists etc.

Maybe a future improvement?

Radioh commented 2 years ago

Ok, cool. I agree with you. The reason it's this way is because the original core component generated the entity ids in the same way. In hindsight, I should probably have changed it, but I didn't really think much about it.

Though, I'm not sure how much of a breaking change it will be to change it now.

rasssta commented 2 years ago

Good timing. Just installed this component and was a bit annoyed by the same thing when configuring the lovelace card. Would be great if there was a (configurable/optional?) suffix. If "suffix" variable isn't set it could use sensor.channel and if it is set to "twitch_" it would be sensor.twitch_channel. Shouldn't break anything :)

Having a suffix would also greatly improve management of the cards, so you could use auto-entities or similar (matching on "sensor.twitch_") to avoid having to update both the component config and* the card where streamers are shown.

Thanks for the component btw!

rasssta commented 2 years ago

Or rather, prefix. Not suffix.

pixelwave commented 2 years ago

... sensor.twitchtv_channelname would be awesome! :)

... or in short sensor.ttv_channelname

Radioh commented 2 years ago

@rasssta - Sounds like a good idea! I'll see if I can implement it in one of the following days.

Radioh commented 2 years ago

The issue was automatically closed by merging a PR into the master branch. I created a new release https://github.com/Radioh/ha_twitch_helix/releases/tag/v.0.5.1

I've added "entity_prefix" as an optional config parameter. It will not override ids on already existing entities if you add it. It will only set it on new ones. Check it out and let me know if there is any issues. :)

pixelwave commented 2 years ago

Works like a charm! Thanks a lot. Already updated my integration ... :)

rasssta commented 2 years ago

Works here as well, thanks!