Page 1 of 1

How to use 'clearlightlog' in lua script

Posted: Wednesday 04 October 2023 0:46
by RonkA
I have some scripts in use that use a textdevice to show some values every 20 seconds on the dashboard.

The problem this gives is that many thousands of entry's in the logs are created to remove these i mannualy have to clear the log every view days.
i have tried to atomate the removal but couldn't get it to work; in the end I got some reply from someone from the board that this could'nt be done and i had to just live with it.. :|

So here i try, try again...

I found that what i want to happen i could do via:

Code: Select all

http://192.168.178.2:7080/json.htm?type=command&param=clearlightlog&idx=223
and it works!!

Code: Select all

{
	"status" : "OK",
	"title" : "ClearLightLog"
}
It's a start, but its not automated yet..

Now my question:
I have a LUA script that runs every day at 23:58; I would like add the clearlightlog function too it. (because my Domoticz runs from a Dockercontainer the ip used in the script wil be 127.17.0.2)

Can this be done in just LUA? (without curl)

Re: How to use 'clearlightlog' in lua script

Posted: Wednesday 04 October 2023 7:16
by Kedi

Re: How to use 'clearlightlog' in lua script

Posted: Wednesday 04 October 2023 8:48
by waltervl
In Lua it is also possible to open an URL with for example

Code: Select all

commandArray['OpenURL']='http://192.168.178.2:7080/json.htm?type=command&param=clearlightlog&idx=223' 
See https://www.domoticz.com/wiki/LUA_commands

But for new scripting users perhaps dzvents is easier.

Re: How to use 'clearlightlog' in lua script

Posted: Thursday 05 October 2023 0:36
by RonkA

Code: Select all

commandArray['OpenURL']='http://192.168.178.2:7080/json.htm?type=command&param=clearlightlog&idx=223' 
Didnt clear the log.. tried the HTTP-request from the wiki:

Code: Select all

domoticz.openURL('http://127.17.0.2:80/json.htm?type=command&param=clearlightlog&idx=222')
And it does the trick.. i just couldnt find it myself.
Thanks the both of you.

Re: How to use 'clearlightlog' in lua script

Posted: Thursday 05 October 2023 9:31
by waltervl
Then you probably did not use a lua but a DzVents script already? But OK, glad it works with DzVents