swartjean / ha-eskom-loadshedding

Fetches loadshedding data from Eskom
Apache License 2.0
71 stars 19 forks source link

Changing the EskomsePush API key #27

Closed wimdebruyn closed 1 year ago

wimdebruyn commented 1 year ago

@swartjean , thank you for a great integration. I am using it to disconnect and reconnect my Inverter system from the grid before and after loadshedding.

Eskomsepush has changed their API token issuing system, requiring all API tokens to be changed before end of November. Is it possible to add a feature to the configure flow to change the API token?

Dyltong commented 1 year ago

Agreed, thanks @swartjean great integration.

I am having the same issue as @wimdebruyn

Either a way to update the key in the interface or instructions on how to do it another way would be appreciated.

swartjean commented 1 year ago

Hi @wimdebruyn @Dyltong, thanks for the good feedback and glad that you guys are getting some use out of the integration 👍

Yes, this is something that I have been meaning to add to the integration configuration options - I will hopefully get to it during the week and release a new version. Will post an update here as soon as it's ready.

For now the only way to update your API key is to remove and re-install the integration by going through the initial configuration steps again. I believe that your entity names, etc. should all still stay the same after reinstallation so it shouldn't affect your automations. Let me know if there are any unexpected issues.

Dyltong commented 1 year ago

thanks @swartjean

Yes, I confirm that I removed and reinstalled the API yesterday and all the entity names, ID's etc remained the same.

louispires commented 1 year ago

My Legacy API also expired now, got a new one and couldn't change it.

Would be a nice feature indeed

jlwainwright commented 1 year ago

For the life of me not able to find my new API. I knew it came in, but inbox searches return nothing! Could someone help with the email address that it was sent from?

Elroc commented 1 year ago

For the life of me not able to find my new API. I knew it came in, but inbox searches return nothing! Could someone help with the email address that it was sent from?

Came from noreply@customers.gumroad.com

louispires commented 1 year ago

After changing my API 7 hours ago, I realized it wasnt working.

Logs: `Logger: homeassistant.components.sensor Source: custom_components/eskom_loadshedding/sensor.py:120 Integration: Sensor (documentation, issues) First occurred: 15:18:40 (8 occurrences) Last logged: 22:27:37

Error adding entities for domain sensor with platform eskom_loadshedding Error while setting up eskom_loadshedding platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 692, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 789, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 586, in _async_write_ha_state attr.update(self.extra_state_attributes or {}) File "/config/custom_components/eskom_loadshedding/sensor.py", line 120, in extra_state_attributes time_updated = datetime.strptime(stage_updated, time_format) TypeError: strptime() argument 1 must be str, not None `

swartjean commented 1 year ago

Hi @louispires, I'm not sure what to make of that - it looks like the entity was trying to fetch state attributes before they were populated, which would usually point to something going wrong with the request. Can you double check that you are not out of quota for the day?

I should release an update for the API key configuration this weekend.

louispires commented 1 year ago

@swartjean Yeah I figured maybe the API was not ready yet - Just tried it out now and it Immediately worked.

So all good!

Thanks

swartjean commented 1 year ago

I've released this in v1.1.2 - should hopefully make the process easier for users that need to switch keys.