There are two ways to answer that question.
One is empirically: By observing how others appear to perceive and interact with their environment, and by assuming that they are doing that for the same reasons I do: because they are thinking. But plants also have senses, memories, and communicate with each other. There is quite a bit of scientific research in this area. This video summarizes some of it:
https://www.youtube.com/watch?v=Xm5i53eiMkU
So based on that, I would have to assume that plants are sentient, and I should avoid harming them the same as any other sentient being.
The other way is through a logical deduction: By assuming that there is a relationship between the brain and the mind, and that others that have a similar biology as me would likewise have a similar consciousness. So as we move down the evolutionary tree, the CNS gets simpler, and so does the consciousness, until we get to beings who's nervous system is so simple that they likely are not. We don't really know where that point is, but we could reasonably assume that a living being with no nervous system likely has no consciousness either.