Hmc5883l freezes

hi ive connected hmc5883l to esp32 and integrated it into homeassistant but it puts out one value and dont change whe i move sensor

esphome:
  name: obrotnica
  friendly_name: Obrotnica

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "EBq3O1EJi3zXTjivWY0tf80MpZ6KOD/k6t0b5PbiWuo="

ota:
  - platform: esphome
    password: "a6ea68663aea8c46c8cd50df3fc344e5"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Obrotnica Fallback Hotspot"
    password: "mVaiG3rNPYUX"

captive_portal:
  
i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a
    

switch:
  - platform: gpio
    pin: 
      number: GPIO18
      inverted: true
    name: "Zachod"
  - platform: gpio
    pin: 
      number: GPIO19
      inverted: true
    name: "Wschod"
sensor:
  - platform: hmc5883l
    address: 0x1E
    heading:
      name: "HMC5883L Heading"
    oversampling: 1x
    range: 130uT
    update_interval: 5s

dont know what is wrong

[10:35:58][D][hmc5883l:133]: Got x=-31.46µT y=-43.98µT z=-57.96µT heading=144.4°
[10:35:58][D][sensor:094]: 'HMC5883L Heading': Sending state 144.41701 ° with 1 decimals of accuracy
[10:36:03][D][hmc5883l:133]: Got x=-31.46µT y=-43.98µT z=-57.96µT heading=144.4°
[10:36:03][D][sensor:094]: 'HMC5883L Heading': Sending state 144.41701 ° with 1 decimals of accuracy
[10:36:08][D][hmc5883l:133]: Got x=-31.46µT y=-43.98µT z=-57.96µT heading=144.4°
[10:36:08][D][sensor:094]: 'HMC5883L Heading': Sending state 144.41701 ° with 1 decimals of accuracy

on different esp it works for a while and it stops working