Template filter test

I am having problems with the syntax to test trigger.payload as a number. I am using the following in a template in a mqtt trigger that will turn a light on to a particular brightness as defined by the payload. I want to test for a number because the payload may be alpha also.

    brightness: "{% if trigger.payload is number %} trigger.payload {% endif %}"

If I substitute trigger.payload for actual integers the syntax works. Just not with the trigger.payload variable.

Any help is greatly appreciated. Thanks