Oled display rotation based on a sensor

hi, i use a wemos d1 mini and a ssd1306 oled display and i would like the oled display to rotate based on a tilt switch.
I have already tried the global function but esp-home fails to compile the program because it does not see the variable as an integer.
I also tried other things but nothing worked.

I wanted to make rotating the display it would change the page and rotate the text.

globals:
  - id: rotation
    type: int
    initial_value: '0'

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    reset_pin: D0
    address: 0x3C
    rotation: id(rotation)
    id: oled
    pages:
      - id: page1...

Sorry for my English

I believe if you want an integer it should not be in quotes ie initial_value: 0

If I don’t put it in quotes it still gives another error.
the problem is that in the display configuration line “id (rotation)” is not seen as an integer.

Yet you don’t post logs. Old saying in computer forums - no log, no issue.