This will never work because the template does not update fast enough.
That template will only update when switch.ladron_pasillo_0_enchufe_1 and sensor.luz_pasillo_off_on changes state. It also will only update every time 1 minute passes.
Your logic is looking for updates less than 6 seconds.
The only way to make this work is to have a trigger based template sensor update once a second with the same logic you have above.
Are you using a trigger based template sensor? Because it doesn’t look like you are. It looks like you just made a template sensor with the same template.
To be clear, if you don’t specify a time_pattern trigger anywhere in your configuration, your template will not rerender every second.
You have to alter your template to provide a value for an else condition. Otherwise it will be unavailable.
I also suggest you post the states for all sensors in your template. Even the template for the entity sensor.luz_pasillo_off_on, because your template seems odd.