I would get rid of any template sensors you’ve created related to this sensor. If you’re using the sensor using the Tuya integration, you should have a device that creates three entities, a binary sensor, battery and Tamper. See image below. No need for any additional yaml code.