How to HTTPRequest with Rule?


#1

I am trying to send a simple HTTPRequest to my home automation system to turn a virtual switch on when motion is detected using this format:

http://username:password@domoticz-ip<:port>/json.htm?api-call

But I get the following in the Event Log:
Error from Server in MoonwareCore.RulManager_onFireAction @ 03.03.2016 21:33:47.764
Rule: id=6, name=‘PantryMotionDetected’, action='HTTPRequest’
Exception Detail:Invalid URI: The hostname could not be parsed.

I am able to send HTTP Json posts from Domoticz to turn on motion detection in Netcam studio, but can’t seem to sent them.

Any help to resolve this would be appreciated.


#2

Hi! Running NCS X (Server). I am testing this also, but no luck. I have to pass this to the developers. However, would it be possible to use RunApp to a nn.html page including a redirection of http to your system? Just an idea for the moment ;).

The - The hostname could not be parsed.- usually when that happens it is problem with a character that is not accepted.

To get rid of parsed problem add a “/” at the end
http://domoticz-ip<:port>/json.htm?api-call/

Doing so no error …

-Henrik


#3

I did have an extra character “>”, but once I took it out it appears to try, but it is unauthorized. I tried turning off my firewall and opening ports 8124 and 8100 on my router, but no luck. I am not running as a service.

Error from Server in MoonwareCore.CallHttp@ time/date stamp
http://192.168.0.63:8690/json.htm?type=command&param=switchlight&idx=39&switchcmd=on: Unauthorized


#4

Yes, I can runapp and get it to work with a script, but would like to do the api-call directly without the script if possible. There may be a token on the domoticz side that I need to put in as well.


#5

Got it…it was a security issue with Domoticz, switched to basic-auth and the api-call works now.

Thanks, for the help.


#6

Excellent! Thanks for feedback -Henrik