cathiele / homeassistant-goecharger

Home Assistant custom_component for controlling the go-eCharger EV-Charger
MIT License
89 stars 29 forks source link

[Q] Configure charger which is not always connected #42

Open PulsarFX opened 3 years ago

PulsarFX commented 3 years ago

In the github readme you state:

setup your Charger in the configuration.yaml (for always connected chargers):

goecharger:
 chargers:
   - name: charger1
     host: <ip of your charger>
   - name: charger2
     host: <ip or hostname of charger 2>

What does the config look like for not always connected chargers? ;)

jmtatsch commented 3 years ago

My charger is offline frequently due to weak wifi signal. No need to configure anything differently. This module handles it gracefully. Just don't expect your input amperage changes to get through after reconnection.

PulsarFX commented 3 years ago

Gracefully? It spams my whole log with errors :-D

Unable to fetch state for Charger 111111
14:38:53 – (FEHLER) go-eCharger (benutzerdefinierte Integration) - 
Die Nachricht ist zum ersten Mal um 18. Juli 2021, 22:27:20 aufgetreten und erscheint 13805 mal 

with this content:

2021-07-18 22:36:10 ERROR (MainThread) [custom_components.goecharger] Unable to fetch state for Charger 111111
2021-07-18 22:36:10 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 419, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 453, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 425, in _stringify_state
state = self.state
File "/config/custom_components/goecharger/sensor.py", line 191, in state
return self.coordinator.data[self._chargername][self._attribute]
KeyError: '111111'

it seems to be no difference wheter I use the new or the old config style.

cathiele commented 3 years ago

now there is really no difference of the configuration for permanently or non permanently connected chargers. i understand that it is not very helpful for non conntected chargers to report the network timeout :-) will see what i can do to improve this.

cathiele commented 2 years ago

I think about an config option like:

alwaysonline: true|false

to prevent logging of possibly disconnected chargers. What do you think about this?

PulsarFX commented 2 years ago

I'd expect it to not throw errors if it is not available. Maybe a flag could indicate a successful connection to the charger. If not connected, all values would be zeroed.

PulsarFX commented 2 years ago

Can I help with something to get this issue solved?