Page 1 of 1

Python Plugin: (near) Realtime Earthquake Notifications

Posted: Sunday 26 November 2017 13:27
by febalci
Especially for you guys living around active earthquake zones, this plugin will inform you with the latest earthquakes within the given parameters, magnitude, location and distance of the epicenter to your house.

Image Image Image

The plugin itself establishes a long-lived websocket connection to EMSC-seismicportal (www.seismicportal.eu/) and whenever an earthquake happens anywhere in the world, EMSC pushes the related message to the plugin. And since you will not be interested in all but only your surrounding, you can give radius and magnitude parameters.

Please note that this plugin is in beta at its best, and somewhat has a dirty code :oops: . If you test it and find any problems please inform me so that i can fix it. And also, if anyone of you guys are interested in tidying up the code, you are more than welcome. The code also shows a simple websocket connection in its simplest terms so you are free to copy whatever part you are interested for any other websocket plugin project.

For Turkish, Italian and Greek friends (mostly the mediterranean coasts) in which earthquakes are almost daily, i believe this plugin might be of some value.

Regards...
Plugin address: https://github.com/febalci/DomoticzEarthquake

Re: Python Plugin: (near) Realtime Earthquake Notifications

Posted: Monday 29 January 2018 22:26
by febalci
Seeing some scripts lately on earthquake notification i just wanted to remind you of this plugin which is buried in the dusty shelves of history...

Re: Python Plugin: (near) Realtime Earthquake Notifications

Posted: Wednesday 07 February 2018 11:46
by assenzuid
When using this plugin, i get the following error message in my log.

Code: Select all

'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.

Re: Python Plugin: (near) Realtime Earthquake Notifications

Posted: Wednesday 07 February 2018 12:46
by febalci
assenzuid wrote: Wednesday 07 February 2018 11:46 When using this plugin, i get the following error message in my log.

Code: Select all

'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
That's because the plugin is written for stable version since there's a Plugin Framework change to beta versions. As stated in http://www.domoticz.com/forum/viewtopic.php?t=18588 if you change:

Code: Select all

def onMessage(self, Connection, Data, Status, Extra):
line in plugin.py to:

Code: Select all

def onMessage(self, Connection, Data):
and:

Code: Select all

def onMessage(Connection, Data, Status, Extra):
    global _plugin
    _plugin.onMessage(Connection, Data, Status, Extra)
lines again in plugin.py to:

Code: Select all

def onMessage(Connection, Data):
    global _plugin
    _plugin.onMessage(Connection, Data)
Or, the other way round; depending on your domoticz version. Are you using 3.8153 stable or beta??

Re: Python Plugin: (near) Realtime Earthquake Notifications

Posted: Wednesday 07 February 2018 16:21
by assenzuid
febalci wrote: Wednesday 07 February 2018 12:46
assenzuid wrote: Wednesday 07 February 2018 11:46 When using this plugin, i get the following error message in my log.

Code: Select all

'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
That's because the plugin is written for stable version since there's a Plugin Framework change to beta versions. As stated in http://www.domoticz.com/forum/viewtopic.php?t=18588 if you change:

Code: Select all

def onMessage(self, Connection, Data, Status, Extra):
line in plugin.py to:

Code: Select all

def onMessage(self, Connection, Data):
and:

Code: Select all

def onMessage(Connection, Data, Status, Extra):
    global _plugin
    _plugin.onMessage(Connection, Data, Status, Extra)
lines again in plugin.py to:

Code: Select all

def onMessage(Connection, Data):
    global _plugin
    _plugin.onMessage(Connection, Data)
Or, the other way round; depending on your domoticz version. Are you using 3.8153 stable or beta??
I use the beta (3.8891)
I will try the solotion above.

Re: Python Plugin: (near) Realtime Earthquake Notifications

Posted: Tuesday 27 February 2018 14:04
by febalci
Handled the function of iso utc to local datetime conversion to result with a Domoticz Crash. Hope now it will be stable...

Re: Python Plugin: (near) Realtime Earthquake Notifications

Posted: Wednesday 16 December 2020 0:43
by mojso
Hi

Does this plugin still work or not