DeebotUniverse / docs

https://deebot.readthedocs.io
GNU General Public License v3.0
33 stars 9 forks source link

Advanced UI Deebot N8 #252

Open xDuk3x opened 11 months ago

xDuk3x commented 11 months ago

HI there,

i tried to Install the Deebot N8 with Deebot 4 Home Assistant and the examples from the Deebot.readthedocs.io (Advanced). I can control everything also start the Vacuum but it only moves a little bit back from the charging station and thats it. It stand still and the brushes are turning.

Any idea what could be wrong, here a snipped from the templates session. I used the letters instead of the room names maybe this is a Problem ?

Best Regards xDuk3x

template:
  unique_id: deebot_hugo_queue
  trigger:
    - platform: state
      entity_id: input_text.deebot_hugo_queue
  sensor:
    # Add for each room the following. Change room_name accordingly
    - unique_id: deebot_hugo_queue_living_room
      name: deebot_hugo_queue_living_room
      # room_name must match the room name provided by the vacuum
      state: >
        {% set room_name = "F" %}
        {% set queue = trigger.to_state.state.split(",") %}
        {{ queue.index(room_name)+1 if room_name in queue else 0 }}
edenhaus commented 10 months ago

Please activate debug logs and verify what actual params are send to the bot

Unthred commented 10 months ago

I have the same problem. I have followed the instructions from deebot.readthedocs.io the advanced ones. Everything seems to be reporting properly, I can see all the sensors etc, it updates its status when cleaning or docked etc. All the buttons work... Stop, Pause, Return Home etc, with the exception of Start. It does the same regardless if there is a room selected or not. Even not using the advanced UI with room queues and just doing a send_command with spot_area it does the same thing.

I assumed it was my scripts that was breaking it but I have spent quite a while ensuring they are correct. Or at least I think they are. I will give you as much info as I can to help debug the issue. My Rooms are:

kitchen : 9
sunroom: 2
lounge: 13
bathroom: 10
study: 8
corridor: 12

I have turned on debugging in the logger like so:

default: info
logs:
    homeassistant.components.vacuum: debug
    custom_components.deebot: debug
    deebot_client: debug

I selected 2 rooms, corridor 12 and sunroom 2, and pressed start, it comes about the length of itself and stops, vacuum still sucking and brushes spinning. It will stay there until I hit the return home button. After turning on the logging I googled the first error

2023-09-27 15:17:23.518 DEBUG (MainThread) [deebot_client.mqtt_client] Command clean does not support p2p handling (yet)

and it suggested I update deebot.client so I logged into my HA box and ran pip install deebot-client

It reported back all the various packages it installed to update deebot-client but this has made no difference I have attached the log which will hopefully give you a clue as to what is wrong. DeebotErrorLog.txt

I am very happy to help debug this issue so please let me know if there is anything I can do.

Thanks

xDuk3x commented 10 months ago

Hey edenhaus attached the log. I found the same error as unthred in the Log home-assistant.log

edenhaus commented 10 months ago

Hey edenhaus attached the log. I found the same error as unthred in the Log home-assistant.log

I think the problem in your case it, that you send a room cleaning command without rooms: {'rooms': '', 'cleanings': 1} So please make sure to select at least one room.

@Unthred In your logs the rooms are set correctly. When it happens again please search your log for async_send_command spot_area and see if the rooms are sended correctly

xDuk3x commented 10 months ago

i tried to select multiple rooms ore just one. Found the same error in the Log. above the error is following:

2023-10-03 08:29:36.970 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'B' when rendering '{%- set queue_split = states(queue).split(",") -%} {%- set rooms = state_attr(vacuum_bot, "rooms")-%} {%- set data = namespace(rooms=[]) -%} {%- for room_name in queue_split -%} {%- set data.rooms = data.rooms + [rooms[room_name]] -%} {%- endfor -%} {{ data.rooms | join(",") }}' 2023-10-03 08:29:36.972 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'G' when rendering '{%- set queue_split = states(queue).split(",") -%} {%- set rooms = state_attr(vacuum_bot, "rooms")-%} {%- set data = namespace(rooms=[]) -%} {%- for room_name in queue_split -%} {%- set data.rooms = data.rooms + [rooms[room_name]] -%} {%- endfor -%} {{ data.rooms | join(",") }}' 2023-10-03 08:29:36.975 DEBUG (MainThread) [custom_components.deebot.vacuum] async_send_command spot_area with {'rooms': ',', 'cleanings': 1}

I think there is problem with the Naming of the rooms from the configuration.yaml - I used the Names of the rooms which are shown in the app

IMG_22DBBB1E908A-1

Unthred commented 10 months ago

Hey edenhaus attached the log. I found the same error as unthred in the Log home-assistant.log

I think the problem in your case it, that you send a room cleaning command without rooms: {'rooms': '', 'cleanings': 1} So please make sure to select at least one room.

@Unthred In your logs the rooms are set correctly. When it happens again please search your log for async_send_command spot_area and see if the rooms are sended correctly

Hey @edenhaus thanks soooooo much for this integration and for responding!

I must have been going cross-eyed when I wrote that. I had been sending the correct commands, must have put up the wrong log.

Anyways mine is now working and I didn't change anything in HA or your marvellous integration. What I did notice though is that my maps sometimes get messed up. When I went into the ecovacs app I saw that it was almost like there want a duplicate map on top of the original one. So in case it helps others here is what I did to fix things.

1) Restored the map in ecovacs app 2) Fixed up the map, like splitting areas and merging areas and ensuring everything had a name 3) Called services deebot.refresh like so to get a fresh list of rooms

service: deebot.refresh
data:
  category: rooms
target:
  entity_id: vacuum.kaggi_ii

4) in the Developer tools - Templates I put this so I could check the right data is being sent to the vacuum

rooms = {{ states.vacuum.kaggi_ii.attributes['rooms'] }}
queue = {{ states('input_text.deebot_kaggi_ii_queue') }}

{% set queue_split = states('input_text.deebot_kaggi_ii_queue').split(',') %}
{% set rooms = state_attr('vacuum.kaggi_ii', 'rooms') %} 
{% set data = namespace(rooms=[]) %}
{% for room_name in queue_split %}
  {% set data.rooms = data.rooms + [rooms[room_name]] %}
{% endfor %} 
{{ data.rooms | join(',') }}

rooms = {{ rooms }}
queue_split = {{ queue_split }}
data = {{ data }}

This way as I press the buttons I have for the rooms I can check things are being split correctly before it gets sent to the vacuum.

Hope this makes sense

edenhaus commented 10 months ago

Unfortunately, some models are losing randomly (at least to me) the map. The advanced UI is and will always be an example. It's a copy of my current frontend setup, but it's far from perfect, and I built it for my needs. I also have tested it only for my setup @xDuk3x I don't use the a,b,c room naming style, but I think it should work too. The names must be identical to the rooms attribute of the vacuum entity and not with the app.

xDuk3x commented 10 months ago

@edenhaus so i tried the naming from the attributes, with no better results. Here are the attributes:

fan_speed_list:
  - quiet
  - normal
  - max
  - max_plus
battery_level: 97
battery_icon: mdi:battery-charging-100
fan_speed: max
friendly_name: Hugo
supported_features: 13180
last_error: 'NoError: Robot is operational (0)'
rooms:
  default:
    - 1
    - 2
    - 5
    - 4
    - 3
    - 6

After some trying i found out that when i change the name in the app to names instead of letters. Everything works fine. So it could be a error in the code for the a,b,c naming style.

Thanks you so much for your help.

Best Regards

edenhaus commented 10 months ago

The a,b,c naming style is not supported by the advanced UI example. You code directly using the id's of the default., 1 is a, 2 is b and so on