There are two ways to get an entity’s state value. Here’s one way:
states.input_number.whatever.state
Here’s the other way:
states('input_number.whatever')
The second way, using the states() function, is the preferred way. Why? Because if you mistype the entity’s name, or the entity simply doesn’t exist, the states() function will gracefully handle the mistake. If you mistype the first way, it will result in an error.
In your example, you sort of used a combination of both, which was a mistake, but the states() function handled it gracefully (no error message, the condition simply failed).
Please consider marking my post (above) with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has an accepted solution. This helps users find answers to similar questions.