Page 1 of 1

openURL: using cookies

Posted: Sunday 23 February 2020 10:45
by Number8
Hello,
I'd like to know whether Asynchronous openURL supports the cookie mecanism, and if yes can I have some directions to make it work?
I'd like to migrate some bash code using curl to dzvents.
Here is the current bash code to log to the device

Code: Select all

#Login to webinterface of plug
curl --silent -X POST -d "username=$PLUGUSER&password=$PLUGPASSWORD" -b "AIROS_SESSIONID=$SESSIONID" $PLUGIP6OUTLETS/login.cgi	
#Retrieve all data from JSON-output
SENSOR=$(curl --silent -b "AIROS_SESSIONID=$SESSIONID" $PLUGIP6OUTLETS/sensors) 
Thank you
Running 4.11214 on RPi

Re: openURL: using cookies

Posted: Sunday 23 February 2020 16:46
by waaren
Number8 wrote: Sunday 23 February 2020 10:45 I'd like to know whether Asynchronous openURL supports the cookie mechanism,
I never managed to get it working so to stay on the safe side. I'd say no.
With the new customEvents you can get the result of the the curl commands async by starting an OS script in the background and send the result back to dzVents with
**< domoticzIP : domoticz port >**/json.htm?type=command&param=customevent&event=MyEvent&data=myData

Re: openURL: using cookies  [Solved]

Posted: Sunday 23 February 2020 18:05
by Number8
thanks waaren. You answer will save me headaches, this is a nice workaround. I haven't upgraded v4.11214 to the latest beta. Do you think it is safe to upgrade my main production system? In any case I will perform an image backup as I always do.

Re: openURL: using cookies

Posted: Monday 30 March 2020 21:42
by Number8
Number8 wrote: Sunday 23 February 2020 18:05 With the new customEvents you can get the result of the the curl commands async by starting an OS script in the background.
@waaren: may I ask you what would be you prefered option to do that? Bash, LUA, Python?
Thank you

Re: openURL: using cookies

Posted: Monday 30 March 2020 22:18
by waaren
Number8 wrote: Monday 30 March 2020 21:42 May I ask you what would be you preferred option to do that? Bash, LUA, Python?
My preference for such an approach would be a Shell script (Bash or any other). Reason is that Lua would also require an OS shell to perform the action and me not being fluent enough in Python.