Picture-elements : Change picture based on state of door sensor

I have a xiaomi door sensor. What I want to do is to visualize the door open and close by changing the pictures in picture-elements of Lovelace UI. Here’s the code but it’s not working as expected. Can anybody help?

  - entity: binary_sensor.door_window_sensor_xxxxxxxxxxx
    state-image:
      'off': /local/maindoor_close.png
      'on': /local/maindoor_open.png
    style:
      left: 7.5%
      top: 45%
    tap_action:
      action: none
    type: image

I think it is state_image, not state-image.

Thank you so much. I’ve spent days to try different options but turns out that it’s such a stupid mistake.

It works like a charm now.