Earthquake info from KNMI

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.

Moderator: leecollings

Kedi
Posts: 595
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Earthquake info from KNMI

Post 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
Logic will get you from A to B. Imagination will take you everywhere.
janpep
Posts: 288
Joined: Thursday 14 March 2024 10:11
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Earthquake info from KNMI

Post 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.
Dz on Ubuntu VM on DS718+ behind FRITZ!Box.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
janpep
Posts: 288
Joined: Thursday 14 March 2024 10:11
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Earthquake info from KNMI

Post 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.
Last edited by janpep on Wednesday 17 December 2025 13:59, edited 1 time in total.
Dz on Ubuntu VM on DS718+ behind FRITZ!Box.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
Kedi
Posts: 595
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Earthquake info from KNMI

Post 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.
Logic will get you from A to B. Imagination will take you everywhere.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest