Send url when home/not home (automation help)

Hi!

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.

Anyone that can help me with this automation?

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.

Use: group.all_devices to check if any one of your tracked device is home. If home then trigger URL

Yeah, I don’t think the trigger is going to be the issue here as much as the actual transmission of the command to the cam.

Just as I thought to do, but how to send /activate a URL string. Any config example?

Exakt! My question is how to send a command (url). Works fine to do it in chrome, bur how to automate it in HA? Any example?

You’d do it via an external script using cURL.

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).

Shell Command:

Command Line Switch:

Script:

Actually I said that. :smiley:

1 Like

Yup, that’s what I meant, haha. No idea who the other guy is. :wink:

1 Like