Template Assistance

So I’ve got a few tables, and I’ve created an alert to fire when the state of the battery (binary sensor) is under a certain percentage. if everything is connected, it works great. Problem is, if the tablet is offline for whatever reason, the sensor reports “unknown”, and the alert gets triggered. I’m trying to write a template to only report “true” when the state (battery level) is under a certain percent.
Here’s the template, so far:

‘{% if states.sensor.n7x1_battery_level.state %}{{ states.sensor.n7x1_battery_level.state | int < 15 }}{% endif %}’

Currently, if “sensor.n7x1_battery_level” == “unknown” the template reports “true”. How would I exclude “unknown”, so the template reports “false”?

why are you using a binary sensor? you should really just be using a template_sensor with the sensor set to the battery percent.

I think I’ve confused myself, and over-complicated the issue. I just want to create an alert (with the alert component), when the sensor “sensor.n7x1_battery_level” is below 15%. What’s the recommended way to do that?