diff --git a/homeassistant/components/mazda/sensor.py b/homeassistant/components/mazda/sensor.py index c688ac62637..715b274b6f5 100644 --- a/homeassistant/components/mazda/sensor.py +++ b/homeassistant/components/mazda/sensor.py @@ -116,7 +116,8 @@ def _fuel_distance_remaining_value(data, unit_system): def _odometer_value(data, unit_system): """Get the odometer value.""" - return round(unit_system.length(data["status"]["odometerKm"], LENGTH_KILOMETERS)) + # In order to match the behavior of the Mazda mobile app, we always round down + return int(unit_system.length(data["status"]["odometerKm"], LENGTH_KILOMETERS)) def _front_left_tire_pressure_value(data, unit_system): diff --git a/tests/components/mazda/test_sensor.py b/tests/components/mazda/test_sensor.py index 763e1490e89..2284101fa84 100644 --- a/tests/components/mazda/test_sensor.py +++ b/tests/components/mazda/test_sensor.py @@ -63,7 +63,7 @@ async def test_sensors(hass): assert state.attributes.get(ATTR_ICON) == "mdi:speedometer" assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == LENGTH_KILOMETERS assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.TOTAL_INCREASING - assert state.state == "2796" + assert state.state == "2795" entry = entity_registry.async_get("sensor.my_mazda3_odometer") assert entry assert entry.unique_id == "JM000000000000000_odometer"