openURL: using cookies  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

openURL: using cookies

Post 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
Debian buster on NUC and three RPi with buster.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: openURL: using cookies

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: openURL: using cookies  [Solved]

Post 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.
Debian buster on NUC and three RPi with buster.
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: openURL: using cookies

Post 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
Debian buster on NUC and three RPi with buster.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: openURL: using cookies

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest