Xiaomi Miio Vacuum integration in seconds

Hi all,

I was wondering why the Xiaomi Miio vacuum integration in Home Assistant is showing the maintenance sensors in seconds (see here)? When using the Xiaomi Home/Roborock app on my phone it shows all the maintenance items in hours, why does the Home Assistant integration converts this to (useless) seconds?

If you find another way to show the sensors in hours please share it with me! :smiley:

Kind regards,
Darryl

A fix for this is in progress.

Ah ok great, I’ll just wait! Thanks!

Damn, the PR was never merged. How are people handlinkg this instead? Create your new sensors and calculate the time in hours on the fly?

Yeah the team have made the decision never to change values reported by an API. That is up to the end user. So it will never be merged.

You have to create your own template sensors:

template:
  - sensor:
      - name: "Downstairs Filter Left"
        icon: "mdi:air-filter"
        unit_of_measurement: "hrs"
        state: "{{ (states('sensor.robovac_downstairs_filter_left')|float(0)/3600)|round(0) }}" 

      - name: "Downstairs Main Brush Left"
        icon: "mdi:ruler"
        unit_of_measurement: "hrs"
        state: "{{ (states('sensor.robovac_downstairs_main_brush_left')|float(0)/3600)|round(0) }}"

      - name: "Downstairs Sensor Clean Left"
        icon: "mdi:contactless-payment"
        unit_of_measurement: "hrs"
        state: "{{ (states('sensor.robovac_downstairs_sensor_dirty_left')|float(0)/3600)|round(0) }}" 

      - name: "Downstairs Side Brush Left"
        icon: "mdi:weather-hurricane"
        unit_of_measurement: "hrs"
        state: "{{ (states('sensor.robovac_downstairs_side_brush_left')|float(0)/3600)|round(0) }}"