You cannot just paste entities configured under the template integration into files like sensor.yaml and binary_sensor.yaml which are most likely included under the sensor and binary_sensor integrations respectively. They should be placed into configuration.yaml or a file properly split to be under the template integration.