Lua code to delete Alerts

Can anyone help write a lua code to use in a scene to delete all the Alerts? Currently we have a max of 50?

The alerts are stored in a file and there are several posts on this forum how to play with that.

Cheers Rene

Hi Rene
Thanks for getting back to me. I have searched the forum with no success asking “Removing Alerts files”, “lua code to delete Alerts”, also just asking “Alerts” . Most of the replies are about help or questions dealing with the app Vera Alerts. If you could point me in
the right search terms you used that would be much appreciated.
Regards

Does this help?

http://forum.micasaverde.com/index.php/topic,36244.msg269431.html#msg269431

The alerts.json and the content of the /etc/cmh/persist folder are the two contents to delete and then run a luup reload to get rid of the alerts. The longer history might be from the server which I am not sure if you can delete.

Thanks for the help directing me to posts that are addressing the issue of deleting the mass alerts from PIR and door/window sensors.
From reading through all the pages I found the lua code suggested below but it is only deleting the 10 Alert Notifications on the Dashboard page.
Is there any type of code to delete the Alerts in the User
Accounts drop down location? or Code to manually run that deletes more then 50 at a time?
I contacted support to no avail.

Quote from: MLEBAUGH on February 12, 2016, 03:28:55 pm
Try this:

I have a manually-triggered scene called ‘Reload Luup’ which runs the following lua code:

os.execute(“rm /etc/cmh/alerts.json”)
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”, “Reload”, {}, 0)

A browser refresh after that should make all your alerts disappear.

http://forum.micasaverde.com/index.php?topic=34695.0

MLEBAUGH,

Thanks for answer, but thats not what i meant.
This code is for deleting the last 10 alerts which are there in the dashboard view.
But i want simply delete ALL alerts in the Tab : Users and account info, and then tab Alerts.
There i have thousents of alerts and want simply delete them all

So… No lua code can be written to delete 100 or even 200 alerts?
We have the option to delete 10, 25 or 50 but sadly Customer support was of no help…

I know, old thread but… After having a controller for several years. I highly suspect this Alerts file eventually causes the controller to slow and then start to fail. You can manually delete the 50 messages at a time to help extend the time but I find if you don’t get around in time to deleting the Alerts, you only have one option. A factory reset.

I’ve had to do this twice. The controller seems to last around a year (could be even half a year, depending on the number of entries). It seems to be extendable by doing random power cycles, but eventually the ever growing log cancer will prevent the controller from linking to the online servers. But it is still accessible locally.

Factory reset, sounds bad, but it actually isn’t as long as you remember to create a system backup of all your devices. You can even make the backup right before you perform the system reset. (Although you should make a backup when you have a good system config and not wait until the controller starts to bog down.)

The system backup you make before the factory reset doesn’t seem to include the alerts log. So if you are able to make a good backup. After you factory reset. Just restore your backup and voila everything will be there like it once was, but no more bogging down until a year later when you have to redo it all over again.

Also want to clarify this file must be located somewhere else. When this clog occurs, you can check the storage and memory capacities and they do not show anywhere near being full for my device. So it is not a limitation of hardware storage capacity. Definitely seems to be a software issue.

But yes I do agree with the OP, I would love to have something to delete all of the Alerts at once.

I found the alerts.json file at /etc/cmh/ on my Vera Plus. I only had a few alerts. I edited the file to leave only the

{ “alerts”: [ ] }

The I did the reload. It seems to have removed all the alerts.