Lovelace doesn't react on Xiaomi motion sensor

I try to show on a floor plan the movement - change image depending from motion sensor:

  - enitity: sensor.motion_steps
    image: 'http://dshgmbh.ru/uploads/walking-man_black 200x300.png'
    state_filter:
      'off': brightness(80%) saturate(0.2)
      'on': brightness(130%) saturate(1.5)
    state_image:
      'off': 'http://dshgmbh.ru/uploads/Walking_man_green 200x300.png'
      'on': 'http://dshgmbh.ru/uploads/Walking_man_yellow 200x300.png'
    style:
      left: 55%
      padding: 10px
      top: 54%
      width: 7%
    type: image

This sensor works in another widget:

entities:
  - entity: binary_sensor.motion_sensor_158d0002b43093
  - entity: sensor.motion_steps
  - entity: binary_sensor.door_window_sensor_158d0002b825ef
    icon: 'mdi:door'
  - entity: sensor.kitchen_wall_button
title: Датчики Xiaomi
type: entities

but on the floor plan doesn’t works,
here is my configuration.yaml with that sensor:

        motion_steps:
            friendly_name: "Движение на лестнице"
            value_template: >
                {% if is_state('binary_sensor.motion_sensor_158d0002b43093', 'on') %}
                on
                {% elif %}
                off
                {% endif %}

It’s seems that ‘on’ state are good but ‘off’ state doesn’t recognize or wrong (undefined). Anywhere picture won’t to change.

{% elif %}

Else if what?

You have no if statement here.

Use {% else %} instead.

            value_template: >
                {% if is_state('binary_sensor.motion_sensor_158d0002b43093', 'on') %}
                  on
                {% else %}
                  off
                {% endif %}

i have tried both… elif or else doesn’t works

I think you may have left out vital information. Is this a binary sensor?

If so then the the template must evaluate to true or false. Not on or off. Like this:

 value_template:  "{{ is_state('binary_sensor.motion_sensor_158d0002b43093', 'on') }}"

Though it appears completely redundant to me and I have no idea why you would do this. Why not just use the original binary sensor rather than templating a sensor that has exactly the same state?

doesn’t works

What does not work?

What errors do you get in the log?

Why are you duplicating the binary sensor?

I have not any error about this. It works only on widget where I see state - on/off, but changing image (on floor plan) - doesn’t work.
Duplicate sensors? - I have tried different ways, try different approach to see an effect (cause it need to restart hass every time after changing - this take a time)
So, finaly - I have working Xiaomi door/window sensor (it change picture on the floor plane), but Xiaomi motion sensor still doesn’t works