Can I call a service every second using an automation? How is that possible? If not, is there a workaround for this? Can I make it happen?
yes you can;
trigger:
- platform: time_pattern
seconds: "/1"
But why do you want to spam your server?
I want to use this for face detection, but only when motion is detected. The component scans every x seconds but this will eventually crash the server if you keep it running for a day. So you have to manually trigger the service. If I was using an automation to only trigger it once, then the face would not be detected as the person could be looking down until he steps in the front door. So, I need to have a scan interval of 1 second until there is no motion detected. That means it would only scan for a total of 30 seconds.
I have a script running different services and automations while motion is detected, so I guess i will add this automation.turn_on and I guess this will start scanning for faces until automation.turn_off.
Thank you for your suggestion. Will try asap.
Then it would be better if you call a script (that repeats until condition not met) from a automation that triggers on motion.
Thank you! I confirm it works!
I did this on an automation, but on your second post you said it would be better if I did this in a script. Any reasons for why it is better?
Well the trigger I suggested runs every second, so it will check the conditions also every second. If you trigger on motion and then run a script, it will only check the conditions when there is motion. Less stress for the server.