How to use 'clearlightlog' in lua script Topic is solved

Moderator: leecollings

Post Reply
User avatar
RonkA
Posts: 96
Joined: Tuesday 14 June 2022 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2023.2
Location: Harlingen
Contact:

How to use 'clearlightlog' in lua script

Post 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)
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Kedi
Posts: 561
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: How to use 'clearlightlog' in lua script

Post by Kedi »

Logic will get you from A to B. Imagination will take you everywhere.
User avatar
waltervl
Posts: 5374
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to use 'clearlightlog' in lua script

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
RonkA
Posts: 96
Joined: Tuesday 14 June 2022 12:57
Target OS: NAS (Synology & others)
Domoticz version: 2023.2
Location: Harlingen
Contact:

Re: How to use 'clearlightlog' in lua script

Post 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.
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
User avatar
waltervl
Posts: 5374
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to use 'clearlightlog' in lua script

Post by waltervl »

Then you probably did not use a lua but a DzVents script already? But OK, glad it works with DzVents
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest