PiotrMachowski / Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor

This custom integration provides a way to present a live view of a map for Xiaomi (Roborock/Viomi/Roidmi/Dreame) vacuums without a need for rooting.
MIT License
1.13k stars 122 forks source link

Xiaomi Mop 2 Pro+ (dreame.vacuum.p2041o) has NULL value attributes #424

Open balintpekker opened 1 year ago

balintpekker commented 1 year ago

Checklist

The problem

When using the Xiaomi Mop 2 Pro+ along with the Map Extractor, upon changing to cleaning state, the following values are presented as attributes, but they are having a NULL value:

Also, the following values can be seen as the vacuum position:

vacuum_position: 
x: 32767
'y': 32767
a: 0

Note: The vacuum position can be updated with the following call, which used as an automation for when the vacuum is cleaning, showing the proper values for the vacuum (this was originally used to update the path on the map periodically, to see the movement of the vacuum live):

alias: EVENT - Vacuum Map Update
description: Updates vacuum map while it is running, so it can be seen live.
trigger:
 - platform: state
   entity_id:
     - vacuum.dreame_p2041o_aed6_robot_cleaner
action:
 - repeat:
     while:
       - condition: or
         conditions:
           - condition: state
             entity_id: vacuum.dreame_p2041o_aed6_robot_cleaner
             state: cleaning
           - condition: state
             entity_id: vacuum.dreame_p2041o_aed6_robot_cleaner
             state: mopping
           - condition: state
             entity_id: vacuum.dreame_p2041o_aed6_robot_cleaner
             state: returning
     sequence:
       - service: xiaomi_miot.call_action
         data:
           entity_id: vacuum.dreame_p2041o_aed6_robot_cleaner
           siid: 6
           aiid: 1
           params:
             - piid: 2
               value: "{\"req_type\":1,\"frame_type\":\"I\",\"force_type\":1}"
       - delay:
           hours: 0
           minutes: 0
           seconds: 5
           milliseconds: 0
mode: single

What version of an integration has described problem?

Xiaomi Miot Auto v0.0.7, Xiaomi MIoT v1.4.3

What was the last working version of an integration?

No response

What vacuum model do you have problems with?

dreame.vacuum.p2041o

What version of Home Assistant do you use?

Home Assistant 2023.4.5

What type of installation are you running?

Home Assistant OS

Camera's configuration

camera:
  - platform: xiaomi_cloud_map_extractor
    host: !secret xiaomi_vacuum_host
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    colors:
      color_map_outside: [0, 0, 0, 0]
      color_map_wall: [0, 0, 0, 0]
      color_map_wall_v2: [34, 35, 36]
      color_path: [255, 255, 255]
      color_charger: [8, 120, 36]
      color_robo: [220, 220, 220]
      color_scan: [0, 0, 0, 0]
      color_unknown: [0, 0, 0, 0]
      color_obstacle: [0, 0, 0, 0]
      color_grey_wall: [0, 0, 0, 0]
      color_ignored_obstacle: [0, 0, 0, 0]
      color_zones: [109, 37, 37]
      color_zones_outline: [0, 0, 0, 0]
      color_virtual_walls: [109, 37, 37]
      color_no_go_zones: [109, 37, 37, 0.5]
      color_no_go_zones_outline: [0, 0, 0, 0]
      color_no_mop_zones: [109, 37, 37, 0.5]
      color_no_mop_zones_outline: [0, 0, 0, 0]
    room_colors:
      1: [48, 52, 53] # Living Room
      2: [48, 52, 53] # Hallway
      3: [48, 52, 53] # Bathroom
      4: [48, 52, 53] # Office
      5: [48, 52, 53] # Storage
    sizes:
      charger_radius: 4
      vacuum_radius: 6.5
    draw:
      - charger
      - path
      - goto_path
      - predicted_path
      - no_go_zones
      - no_mopping_zones
      - vacuum_position
      - virtual_walls
      - zones
    map_transformation:
      scale: 2
      trim:
        top: 0
        bottom: 0
        left: 0
        right: 0
      rotate: 90
    auto_update: true
    scan_interval:
      seconds: 10
    attributes:
      - calibration_points
      - charger
      - cleaned_rooms
      - country
      - goto
      - goto_path
      - goto_predicted_path
      - image
      - is_empty
      - map_name
      - no_go_areas
      - no_mopping_areas
      - obstacles
      - ignored_obstacles
      - obstacles_with_photo
      - ignored_obstacles_with_photo
      - path
      - room_numbers
      - rooms
      - vacuum_position
      - vacuum_room
      - vacuum_room_name
      - walls
      - zones
    force_api: dreame
    country: "de"
    store_map_raw: true

Errors shown in the HA logs (if applicable)

No response

Additional information

The MiOT specification for this vacuum can be found here.