CJNE / ha-myenergi

Home Assistant integration for MyEnergi devices
MIT License
150 stars 33 forks source link

How to change API key in add-on? #400

Closed reedy closed 1 year ago

reedy commented 1 year ago

Is your feature request related to a problem? Please describe. I don't see any obvious way on how to change an API key after adding it.

Do I need to add a new integration entity (and then update every sensor/entity usage)? Can I just change it somewhere in config?

Describe the solution you'd like

Documenting how to change the API key would be good as a minimum.

Potentially even including a way on the "Configure" page to replace/override the API key would be very useful.

Describe alternatives you've considered

Additional context Security issues happen... myenergi may need to reset them some day, you may share it (accidentally or on purpose) with someone you no longer want to have access to the device(s)...

G6EJD commented 1 year ago

This is really easy to do, I’ve done it many times, I just remove the integration, then re-add then enter the new credentials and then everything comes back unaltered. No need for an option to do that.

reedy commented 1 year ago

That's fine, but probably worth at least documenting as such then :)

G6EJD commented 1 year ago

You can make the necessary readme amendments and submit it here as a change

reedy commented 1 year ago

I can, indeed. As I've submitted other PR's to it previously (and a different one today, too!) ;)

But the issue was originally posed from not knowing the answer.

Adding an option to do it would still make the workflow easier for users anyway. Removing stuff from HA, with unknown consequences of doing so isn't always the most appealing idea. You don't generally expect to have to delete something and re-add it to change a password, for example.

Hub Serial numbers could change too, in case of warranty replacements etc. Especially as they're now integrated into the eddi/zappi devices, but that will result in new/"different" sensors, and things needing updating. I'm not sure a workflow of being able to "change" it would make any sense though.

reedy commented 1 year ago

Screenshot 2023-09-08 at 12 28 13

AJediIAm commented 1 year ago

Compliments for the nice bug report and taking action to update the documentation. I always appreciate users who take their time to communicate their issues with the developers.

Updating IP address or credentials is commonly done by removing and adding a device in Home Assistant. This is not a MyEnergy specific problem. There are a number of feature requests on the HA Community Forum to facilitate these changes better which you can vote on.

reedy commented 1 year ago

Updating IP address or credentials is commonly done by removing and adding a device in Home Assistant. This is not a MyEnergy specific problem. There are a number of feature requests on the HA Community Forum to facilitate these changes better which you can vote on.

I've not looked how they store it, but https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/ actually lets you view (probably not the best idea, I know), and edit the Api key.

But now you mention it, I think that's the only such case of integrations I've used that does allow it like that... Everything else is write only at install/configure time... Which, as you say, seems to be the standard, for now at least.

I would completely understand not necessarily adding your own way to do/store this, for now. But obviously if/when something is implemented upstream, taking advantage of that wouldn't be a bad thing.

Compliments for the nice bug report and taking action to update the documentation. I always appreciate users who take their time to communicate their issues with the developers.

A FLOSS-y developer background makes me well versed in knowing that if you don't report an issue (unless someone else already has, of course), the developer will probably not know it is one. And similar, if it's things that within your competence to fix, or at least, attempt to do so, it's rarely not appreciated.

And in terms of documentation; better documentation helps everyone.

reedy commented 1 year ago

Closing this as resolved. The docs are updated, so until something better happens upstream in HA, I think this is good enough