Roborock S5 Max, using both with HA and the Roborock App?

Oh, perfect!

No, I am not saying that something is wrong. Just that I read that the integration is wrong in the latest firmware version.

I have spent some hours getting this vacuum working fine (a little python script that allows to send to clean more than one room easily) and I was too scared to update the firmware without being sure that it works fine. :rofl: :rofl: :rofl: :sweat_smile:

I’ll update today. Thanks a lot

No problem. Hope it works for you too. :slight_smile:

Python script is not needed I think.
in scripts.yaml I just programmed this. Or is this language python? wasnt aware I did that :smiley:

vacuum_keuken:
  alias: "Stofzuigen - keuken"
  sequence:
    - service: vacuum.send_command
      data:
        entity_id: vacuum.bob
        command: app_segment_clean
        params: [16]

vacuum_keuken_en_eettafel:
  alias: "Stofzuigen - keuken en eettafel"
  sequence:
    - service: vacuum.send_command
      data:
        entity_id: vacuum.bob
        command: app_segment_clean
        params: [16,19]
        
vacuum_gang:
  alias: "Stofzuigen - gang"
  sequence:
    - service: vacuum.send_command
      data:
        entity_id: vacuum.bob
        command: app_segment_clean
        params: [18]

To find out what number corresponds with what room, you can just send it to one, and look where it goes :slight_smile: Change the name accordingly.
You can also give multiple rooms in one script.

PS.
I dont know if you will need to get a new token after firmware update. I got mine with this firmware just ~2 weeks ago.

The python script is for not writing a home assistant script for each room variation.

I can send, for example, living room and bathroom on the fly, but the next one, living room and kitchen, without having to declare so many scripts. With a single python script I can do all possible variations.

The bottom buttons represent each room, clicking these buttons concatenate the app_segment numbers and then start cleaning with the string generated

2 Likes

Thanks for the write-up. I have it added to HA as well now using the Mi-Home token.

Am I right that without custom firmware (not yet available) you are unable to get the map in HA? Trying to figure this out, zoned cleaning with map would be great!

Beside this with the Roborock app you can create an account at google home.
Mi Home account is not able to create an googlehome account for Roborock s5 max (yet)

I still like to know if it is possible to add the Roborock app to HA?
I do see in Roborock app an DID is that like a token?
Somebody succeeded allready?

You can get tokens from the roborock app, but there are lots of reports that the token often changes with that app, sometimes even at a 24 hr interval. So not really usable at all for the moment.

Mi home app only change token when you reset the wifi settings and sometimes with a firmware update.

More information in this topic: New Roborock S5 Max Vacuum Cleaner

Thanks for the answer.

How do you do that? I haven’t been able to get the token from the roborock app? Changes of the token or not.

As far as I know it’s exactly the same method as with the mi app. Didn’t try it myself as the token changes all the time.

@DendelX - Can you share the code you used to create this card? i.e.

  • Lovelace
  • Config
  • Scripts
  • etc.

I have changed the card since y post it but I can share my config now. Now I use the @3_14 custom component that create a live map camera, great!!.

The card is Vacuum Card and you can find it in hacs:

This is the card now:

Lovelace code is:

cards:
  - actions:
      - icon: 'mdi:play-circle'
        name: Comenzar
        service: python_script.enviar_aspiradora
        service_data:
          room: limpiar
      - icon: 'mdi:cancel'
        name: Cancelar
        service: python_script.enviar_aspiradora
        service_data:
          room: cancelar
      - icon: 'mdi:tools'
        name: Mantenimiento
        service: script.turn_on
        service_data:
          entity_id: script.roborock_punto_mantenimiento
    entity: vacuum.roborock_s5_max
    map: camera.xiaomi_cloud_map_extractor
    stats:
      cleaning:
        - attribute: cleaned_area
          subtitle: Cleaning area
          unit: m2
        - attribute: cleaning_time
          subtitle: Cleaning time
          unit: minutes
      default:
        - attribute: filter_left
          subtitle: Filtro
          unit: horas
        - attribute: side_brush_left
          subtitle: C. Lateral
          unit: horas
        - attribute: main_brush_left
          subtitle: C. Central
          unit: horas
        - attribute: sensor_dirty_left
          subtitle: Sensores
          unit: horas
    type: 'custom:vacuum-card'
  - type: horizontal-stack
    cards:
      - type: 'custom:button-card'
        icon: 'mdi:television'
        name: SALON
        styles:
          card:
            - height: 45px
            - font-size: 10px
            - margin: 5px
        tap_action:
          action: call-service
          service: python_script.enviar_aspiradora
          service_data:
            room: 18
      - type: 'custom:button-card'
        icon: 'mdi:fridge'
        name: COCINA
        styles:
          card:
            - height: 45px
            - font-size: 10px
            - margin: 5px
        tap_action:
          action: call-service
          service: python_script.enviar_aspiradora
          service_data:
            room: 20
      - type: 'custom:button-card'
        icon: 'mdi:door'
        name: RECIBIDOR
        styles:
          card:
            - height: 45px
            - font-size: 10px
            - margin: 5px
        tap_action:
          action: call-service
          service: python_script.enviar_aspiradora
          service_data:
            room: 16
      - type: 'custom:button-card'
        icon: 'mdi:human-male-female'
        name: BAÑO
        styles:
          card:
            - height: 45px
            - font-size: 10px
            - margin: 5px
        tap_action:
          action: call-service
          service: python_script.enviar_aspiradora
          service_data:
            room: 19
      - type: 'custom:button-card'
        icon: 'mdi:washing-machine'
        name: AMARILLA
        styles:
          card:
            - height: 45px
            - font-size: 10px
            - margin: 5px
        tap_action:
          action: call-service
          service: python_script.enviar_aspiradora
          service_data:
            room: 17
  - entities:
      - type: divider
      - entity: input_text.rooms_limpiar
        name: Habitaciones
      - automation.limpieza_automatica
      - cover.puerta_robocochera
    type: entities
type: 'custom:vertical-stack-in-card'



The last 2 entities in card “Limpieza Automática” and “Puerta Robocochera” only are a automation based on alarm system to clean each day when all people leaves home and an esphome controlled garage door for the vacuum cleaner (hidden under the kitchen cabinets). You can delete it.

The buttons, call a python script that I made, this python script concatenate rooms ids, (don’t be cruel, my python is very basic).

This is the enviar_aspiradora.py python_script:

room = data.get('room');
entity = 'vacuum.roborock_s5_max';

input_text = hass.states.get('input_text.rooms_limpiar').state;

if room == 'limpiar':
  input_text_lista = set(input_text.split(','));
  input_text_lista_int = [int(i) for i in input_text_lista];
  service_data = {'entity_id': entity, 'command': 'app_segment_clean', 'params': input_text_lista_int}
  hass.services.call('vacuum', 'send_command', service_data, False)
  service_data = {'entity_id': 'input_text.rooms_limpiar', 'value': ''}
  hass.services.call('input_text', 'set_value', service_data, False)
elif room == 'cancelar':
  service_data = {'entity_id': 'input_text.rooms_limpiar', 'value': ''}
  hass.services.call('input_text', 'set_value', service_data, False)
else: 
  if input_text == '':
    service_data = {'entity_id': 'input_text.rooms_limpiar', 'value': room}
    hass.services.call('input_text', 'set_value', service_data, False)
  else:
    input_text = input_text + ',{}'.format(room)
    service_data = {'entity_id': 'input_text.rooms_limpiar', 'value': input_text}
    hass.services.call('input_text', 'set_value', service_data, False)
  

I hope it is useful

7 Likes

Thanks so much - I will tackle over the next few days.

Hey Folks

I’ve added S5 Max to Home assistant on a very basic level… But i want to further integrate with homekit and show maps and do various things? Is it possible? Just shows as a switch currently in homekit… So no notifications on finish or other controls.

Can anyone guide on how to make this integration full with maps, scripts, zones etc so that we can do automation etc? But new to this so some good scripts copy/paste will help :slight_smile:

Thanks

I found this recently and wanted to share incase it helps anyone with ideas on how to implement w/o API. https://developer.aliyun.com/mirror/npm/package/homebridge-xiaomi-roborock-vacuum/v/0.2.1

Did not expect homekit to get a roborock (app) implementation before HA

2 Likes

how is going the integration of roborock in HA?? i’m interested to can keep both app working: the one that is configure in roborock and try to get the token of this app to share it with HA.
any idea?

1 Like

I wish it were actually HomeKit and not just Siri shortcuts. But yeah…I’m surprised this doesn’t work better with HA.

Yeah especially with how popular the s5+and s4 are. Would love to integrate this.

1 Like

If I connect the roborock to the xiaomi app, this no longer works with the roborock app and therefore with Alexa. Via xiaomi app, alexa does not detect it.

Could you please share the custom app to get token.

Thank!