I’m trying to send url "http://192.168.1.140:80/motion.cgi?MotionDetectionEnable=1&ConfigReboot=No&user=XXUSERXX&pwd=XXPASSXX" when a group (family) leaves home.
Then I want to send url "http://192.168.1.140:80/motion.cgi?MotionDetectionEnable=0&ConfigReboot=No&user=XXUSERXX&pwd=XXPASSXX" when a group (family) is home.
At one time I was looking into sending a CGI command to one of my Foscams to shut off the IR that keeps coming on and I was going to do it with an external script and cURL. I never got around to it but that might be a starting point to look at.
Exactly as @rpitera said, you would use cURL to send the command. Within hass you can do an external script, or you could also do shell_commands (which I do to send curl commands to my sonos speakers).
Another option would be to use command_line switches, although that would be more complicated to trigger with an automation rule. a command_line switch allows you to run shell command (i.e., curl) with a toggle switch (and you may be able to automate the triggering of that switch via an automation rule).