Using payload for state

Hya,

by configuration.yaml, i have the following:

 - platform: mqtt
    state_topic: "BSTC91100/Notify/status"
    command_topic: "BSTC91100/Notify/status"

one of my devices sends the following payloads to the mqtt broker:

BSTC91100/Notify/status, either 0, 1, 2 or 3

How shall i declare the payload, and how can i use it for state, i.e

color: |
            [[[
              if (states['binary_sensor.tc91100'].state == 'on') return 'orangered'; 
              if (states['binary_sensor.tc91100'].state == 'off') return 'lime';
              else return 'slategrey';
            ]]]

replacing the

states['binary_sensor.tc91100'].state == 'on')

for the returned payload?

Tnx in advance