Python Plugin: (near) Realtime Earthquake Notifications

Python and python framework
Post Reply
febalci
Posts: 310
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Python Plugin: (near) Realtime Earthquake Notifications

Post by febalci » Sunday 26 November 2017 14:27

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

febalci
Posts: 310
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: (near) Realtime Earthquake Notifications

Post by febalci » Monday 29 January 2018 23:26

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...

assenzuid
Posts: 156
Joined: Friday 13 November 2015 10:11
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: Python Plugin: (near) Realtime Earthquake Notifications

Post by assenzuid » Wednesday 07 February 2018 12: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''.

febalci
Posts: 310
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: (near) Realtime Earthquake Notifications

Post by febalci » Wednesday 07 February 2018 13:46

assenzuid wrote:
Wednesday 07 February 2018 12: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??

assenzuid
Posts: 156
Joined: Friday 13 November 2015 10:11
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: Python Plugin: (near) Realtime Earthquake Notifications

Post by assenzuid » Wednesday 07 February 2018 17:21

febalci wrote:
Wednesday 07 February 2018 13:46
assenzuid wrote:
Wednesday 07 February 2018 12: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.

febalci
Posts: 310
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: (near) Realtime Earthquake Notifications

Post by febalci » Tuesday 27 February 2018 15:04

Handled the function of iso utc to local datetime conversion to result with a Domoticz Crash. Hope now it will be stable...

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests