DeebotUniverse / Deebot-4-Home-Assistant

Home Assistant integration for deebot vacuums
https://deebot.readthedocs.io/integrations/home-assistant/
GNU General Public License v3.0
179 stars 41 forks source link

X1 e Omni - Action ok but States no updating #278

Open JeedHome44 opened 1 year ago

JeedHome44 commented 1 year ago

Checks

The problem

Hello,

I can send action to my X1 e Omni but states not updating. when i reload Deebot Integration, states update.

Can you do a 1 minute cron to reload integration ?

Diagnostics information

i don't know what is it

Anything in the logs that might be useful for us?

No response

Additional information

No response

mrbungle64 commented 1 year ago

@JeedHome44

Diagnostics information

i don't know what is it

https://www.home-assistant.io/integrations/diagnostics/

edenhaus commented 1 year ago

Please add the diagnostic information and debug logs

JeedHome44 commented 1 year ago

Sorry i don't find where is it :(

JeedHome44 commented 1 year ago

Where can i have diagnostic ? I don't find it !

I think Home Assistant disconnect when i go to the Ecovacs App in my iPhone.

edenhaus commented 1 year ago

Please follow the link above for instructions

JeedHome44 commented 1 year ago

image

Is it this information ?

JeedHome44 commented 1 year ago

Hello,

It works perfectly with Deebot refresh fonction. I do multi automation to have reload states when i change one like this:

- id: 'XXXXXXXX'
  alias: Deebot X1 Eau Refresh
  description: ''
  trigger:
  - platform: state
    entity_id:
    - select.pumba_water_amount
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: select.pumba_water_amount
      state: low
    - condition: state
      entity_id: select.pumba_water_amount
      state: medium
    - condition: state
      entity_id: select.pumba_water_amount
      state: high
    - condition: state
      entity_id: select.pumba_water_amount
      state: ultrahigh
  action:
  - service: deebot.refresh
    data:
      part: Water
    target:
      device_id: YYYYYYYYYYY
  mode: single
github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

KapUttyy commented 1 year ago

I have the exact same issue with my Deebot X1 Omni.

Here in Germany the Internet Connection with DSL-connections are forced to drop every 24h. At the exact same time of the forced disconnect at 02:35:10 the following warning is in the debug-log: 2023-01-02 02:35:05.613 DEBUG (MainThread) [gmqtt.client] [QoS query IS EMPTY] 2023-01-02 02:35:10.113 WARNING (MainThread) [gmqtt.mqtt.protocol] [EXC: CONN LOST] Traceback (most recent call last): File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 854, in _read_ready__data_received data = self._sock.recv(self.max_size) ConnectionResetError: [Errno 104] Connection reset by peer 2023-01-02 02:35:10.114 DEBUG (MainThread) [gmqtt.mqtt.handler] [CMD 0xe0] b'' 2023-01-02 02:35:10.115 WARNING (MainThread) [gmqtt.mqtt.protocol] [TRYING WRITE TO CLOSED SOCKET] 2023-01-02 02:35:10.118 INFO (MainThread) [gmqtt.client] [RECONNECT] ignored error while disconnecting, trying to reconnect anyway 2023-01-02 02:35:16.649 INFO (MainThread) [gmqtt.mqtt.protocol] [CONNECTION MADE] 2023-01-02 02:35:16.667 DEBUG (MainThread) [gmqtt.mqtt.handler] [CMD 0x20] b'\x00\x00' 2023-01-02 02:35:16.667 DEBUG (MainThread) [gmqtt.mqtt.handler] [CONNACK] flags: 0x0, result: 0x0

3 Minutes later the following error at 02:38:08 the following Error is printed in the Debug-Log: `2023-01-02 02:38:08.730 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "", line 3, in raise_from File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse response.begin() File "/usr/local/lib/python3.10/http/client.py", line 318, in begin version, status, reason = self._read_status() File "/usr/local/lib/python3.10/http/client.py", line 287, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen retries = retries.increment( File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 550, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/local/lib/python3.10/site-packages/urllib3/packages/six.py", line 769, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "", line 3, in raise_from File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse response.begin() File "/usr/local/lib/python3.10/http/client.py", line 318, in begin version, status, reason = self._read_status() File "/usr/local/lib/python3.10/http/client.py", line 287, in _read_status raise RemoteDisconnected("Remote end closed connection without" urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) File "/usr/src/homeassistant/homeassistant/components/tado/init.py", line 83, in lambda now: tadoconnector.update(), File "/usr/src/homeassistant/homeassistant/util/init.py", line 192, in wrapper result = method(args, kwargs) File "/usr/src/homeassistant/homeassistant/components/tado/init.py", line 176, in update self.update_devices() File "/usr/src/homeassistant/homeassistant/components/tado/init.py", line 186, in update_devices devices = self.tado.getDevices() File "/usr/local/lib/python3.10/site-packages/PyTado/interface.py", line 170, in getDevices data = self._apiCall(cmd) File "/usr/local/lib/python3.10/site-packages/PyTado/interface.py", line 81, in _apiCall response = self._http_session.request(method, url, timeout=self.timeout, File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 547, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))`

As there is also tado in the second error, maybe this is not Deebot related, but the first error is at the exact same time as my disconnect and correlates with the other debug info from Deebot-Integration. Maybe the connection should be renewed automatically in a configurable interval. The integration stops working after this disconnect, as new calls do not update correctly after the disconnect.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

edenhaus commented 1 year ago

@Utty88 The tado exceptions has nothing to do with this integration. This integration can handle reconnection automatically. Are you getting a new ip after the reconnect?

KapUttyy commented 1 year ago

@edenhaus yes, I get a new IPv4 after every reconnect. I have now solved the issue with the shell_command integration. I have created a shell command to restart the integration every day at 6:30am triggered by an automation. That works fine for the moment for me.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

edenhaus commented 1 year ago

Ok we leave this as workaround. Normally a reconnect should work, but in your case you get a new ip and probably ecovacs is not allowing the same token on another ip adress.

Adding a check for a new ip for your edge case is a over kill. At least for now, where I'm short on time. Please feel free to add it yourself if you want a proper solution

KapUttyy commented 1 year ago

As I am an IT guy, but not a developer, I am not able to add this with a pull request, which is really unfortunate. As speaking for germany I am pretty sure that this is not an edge case as with DSL connections the 24h disconnect with assigning new IPs is pretty standard here since the beginning of the broadband internet era.

matteoopc commented 1 year ago

@edenhaus yes, I get a new IPv4 after every reconnect. I have now solved the issue with the shell_command integration. I have created a shell command to restart the integration every day at 6:30am triggered by an automation. That works fine for the moment for me.

can you share the command? Thank you

KapUttyy commented 1 year ago

Sure, here it is:

This here has to be in the configuration.yaml. You have to figure out your individual AddOn ID and place it there. I don't remember anymore how to figure that out... You also have to create an API-KEY and to replace your own called URL for the HA.

shell_command:
  restart_deebot: curl -X POST "https://[URL]/api/config/config_entries/entry/[Individual-AddOn-ID]/reload" --oauth2-bearer "[API-KEY]"

My Automation in HA is the following:

trigger:
  - platform: state
    entity_id:
      - sensor.fritz_box_7590_ax_external_ip
    for:
      hours: 0
      minutes: 10
      seconds: 0
condition: []
action:
  - service: shell_command.restart_deebot
    data: {}
mode: single

It triggers 10 minutes after my external IP changed and calls the custom shell command.

Hope you can use that ;-)

matteoopc commented 1 year ago

Certo, ecco qui:

Questo qui deve essere nel file Configuration.yaml. Devi capire il tuo ID AddOn individuale e inserirlo lì. Non ricordo più come capirlo... Devi anche creare una API-KEY e sostituire il tuo URL chiamato per l'HA.

shell_command:
  restart_deebot: curl -X POST "https://[URL]/api/config/config_entries/entry/[Individual-AddOn-ID]/reload" --oauth2-bearer "[API-KEY]"

La mia automazione in HA è la seguente:

trigger:
  - platform: state
    entity_id:
      - sensor.fritz_box_7590_ax_external_ip
    for:
      hours: 0
      minutes: 10
      seconds: 0
condition: []
action:
  - service: shell_command.restart_deebot
    data: {}
mode: single

Si attiva 10 minuti dopo la modifica del mio IP esterno e chiama il comando della shell personalizzata.

Spero che tu possa usarlo ;-)

Thank you. I have a doubt, how do I create the API key?

KapUttyy commented 1 year ago

Thank you. I have a doubt, how do I create the API key?

If you click on your Profilename in the left corner all the way down, and scroll all the way down through your profile configuration page. You can create Longterm Access Tokens. That's it.

matteoopc commented 1 year ago

Grazie. Ho un dubbio, come creo la chiave API?

Se fai clic sul nome del tuo profilo nell'angolo sinistro fino in fondo e scorri fino in fondo la pagina di configurazione del tuo profilo. Puoi creare token di accesso a lungo termine. Questo è tutto.

Works! Thank you!!!