Page 4 of 4

Re: Earthquake info from KNMI

Posted: Friday 12 December 2025 19:32
by Kedi
You might add

Code: Select all

if magnitude == "" then magnitude = "0" end
after

Code: Select all

local magnitude = fields[11] or "0"
otherwise I get an error later on if field[11] is empty

Re: Earthquake info from KNMI

Posted: Friday 12 December 2025 22:13
by janpep
Kedi wrote: Friday 12 December 2025 19:32 You might add

Code: Select all

if magnitude == "" then magnitude = "0" end
My first thought is that if something is missing you can't just give it a value (0) unless it's very clear that it's a dummy number.
My second thought is that the last update for "Oud Annerveen" gave a magnitude of '-' , which is perfectly showing up in my dashboard.
So the - makes clear for me that it is apparently unknown and my humble opinion better that make it 0.
I will have further look into this later and combine this with a more close look to some earlier mentions like the "with more robust error handling and a new URL" from HvdW.
At this moment it is not high on my priority list. I still have some other things to look at.

Re: Earthquake info from KNMI

Posted: Tuesday 16 December 2025 20:09
by janpep
otherwise I get an error later on if field[11] is empty
I now had the time for a closer look.
I want to add and point out, that you are referring to the error you get in the script of HvdW that he posted some time ago. The script with more robust error handling.
Here is a new Earthquake script with more robust error handling and a new URL.
He called it a NEW script and indeed he made drastic changes, but left my name in top. Unfortunately, this was not accompanied by any explanation. Nor was a reason given for a different URL. At first glance, I noticed that the existence of the alert device was being checked every minute. While that is certainly robust, I found it a bit redundant. Furthermore, I did not understand the reason for the different URL. And since everything was working fine for me, I did not really feel motivated to investigate.

In my script there is no field[11] and no error! :-)
I did not find a reason to make the script more complex as it is functioning well here and as I expect it goes.
Since no further explanation has been given, I do not feel the need to discuss it further here. I simply wanted to showcase my project.
I am still working with my own script. The last one as I have posted earlier.
I am sure HvdW is willing to help you out with the error in his script.

Re: Earthquake info from KNMI

Posted: Wednesday 17 December 2025 13:58
by Kedi
Sorry my error. I did not notice that I got the better script from HvdW.
In case of an "controlled explosion" there is no magnitude, that's why the error came.
I already correct it in the source as written above.