BOSWatch 3
Python Script to receive and decode German BOS Information with rtl_fm and multimon-NG
 
Loading...
Searching...
No Matches
plugin.telegram.BoswatchPlugin Class Reference

Public Member Functions

 __init__ (self, config)
 Do not change anything here!
 
 onLoad (self)
 Called by import of the plugin.
 
 setup (self)
 Called before alarm Remove if not implemented.
 
 fms (self, bwPacket)
 Called on FMS alarm.
 
 pocsag (self, bwPacket)
 Called on POCSAG alarm.
 
 zvei (self, bwPacket)
 Called on ZVEI alarm.
 
 msg (self, bwPacket)
 Called on MSG packet.
 
 teardown (self)
 Called after alarm Remove if not implemented.
 
 onUnload (self)
 Called by destruction of the plugin Remove if not implemented.
 
- Public Member Functions inherited from plugin.pluginBase.PluginBase
 parseWildcards (self, msg)
 Return the message with parsed wildcards.
 

Data Fields

 sender
 
- Data Fields inherited from plugin.pluginBase.PluginBase
 config
 

Additional Inherited Members

- Protected Member Functions inherited from plugin.pluginBase.PluginBase
 _cleanup (self)
 Cleanup routine calls onUnload() directly.
 
 _run (self, bwPacket)
 start an complete running turn of an plugin.
 
 _getStatistics (self)
 Returns statistical information's from last plugin run.
 
- Protected Attributes inherited from plugin.pluginBase.PluginBase
 _pluginName
 
 _bwPacket
 
 _sumTime
 
 _cumTime
 
 _setupTime
 
 _alarmTime
 
 _teardownTime
 
 _runCount
 
 _setupErrorCount
 
 _alarmErrorCount
 
 _teardownErrorCount
 
- Static Protected Attributes inherited from plugin.pluginBase.PluginBase
list _pluginsActive = []
 

Constructor & Destructor Documentation

◆ __init__()

plugin.telegram.BoswatchPlugin.__init__ (   self,
  config 
)

Do not change anything here!

Reimplemented from plugin.pluginBase.PluginBase.

139 def __init__(self, config):
140 r"""!Do not change anything here!"""
141 super().__init__(__name__, config) # you can access the config class on 'self.config'
142

Member Function Documentation

◆ onLoad()

plugin.telegram.BoswatchPlugin.onLoad (   self)

Called by import of the plugin.

Reimplemented from plugin.pluginBase.PluginBase.

143 def onLoad(self):
144 r"""!Called by import of the plugin"""
145 bot_token = self.config.get("botToken")
146 chat_ids = self.config.get("chatIds", default=[])
147
148 if not bot_token or not chat_ids:
149 logger.error("botToken oder chatIds fehlen in der Konfiguration!")
150 return
151
152 # Konfigurierbare Parameter mit Fallback-Defaults
153 max_retries = self.config.get("max_retries")
154 initial_delay = self.config.get("initial_delay")
155 max_delay = self.config.get("max_delay")
156
157 self.sender = TelegramSender(
158 bot_token=bot_token,
159 chat_ids=chat_ids,
160 max_retries=max_retries,
161 initial_delay=initial_delay,
162 max_delay=max_delay
163 )
164
165 startup_message = self.config.get("startup_message")
166 if startup_message and startup_message.strip():
167 self.sender.send_message(startup_message)
168

◆ setup()

plugin.telegram.BoswatchPlugin.setup (   self)

Called before alarm Remove if not implemented.

Reimplemented from plugin.pluginBase.PluginBase.

169 def setup(self):
170 r"""!Called before alarm
171 Remove if not implemented"""
172 pass
173

◆ fms()

plugin.telegram.BoswatchPlugin.fms (   self,
  bwPacket 
)

Called on FMS alarm.

Parameters
bwPacketbwPacket instance

Reimplemented from plugin.pluginBase.PluginBase.

174 def fms(self, bwPacket):
175 r"""!Called on FMS alarm
176 @param bwPacket: bwPacket instance"""
177 msg = self.parseWildcards(self.config.get("message_fms", default="{FMS}"))
178 self.sender.send_message(msg)
179

◆ pocsag()

plugin.telegram.BoswatchPlugin.pocsag (   self,
  bwPacket 
)

Called on POCSAG alarm.

Parameters
bwPacketbwPacket instance

Reimplemented from plugin.pluginBase.PluginBase.

180 def pocsag(self, bwPacket):
181 r"""!Called on POCSAG alarm
182 @param bwPacket: bwPacket instance"""
183 msg = self.parseWildcards(self.config.get("message_pocsag", default="{RIC}({SRIC})\n{MSG}"))
184 self.sender.send_message(msg)
185
186 if bwPacket.get("lat") is not None and bwPacket.get("lon") is not None:
187 lat, lon = bwPacket.get("lat"), bwPacket.get("lon")
188 logger.debug("Koordinaten gefunden – sende Standort.")
189 self.sender.send_location(lat, lon)
190

◆ zvei()

plugin.telegram.BoswatchPlugin.zvei (   self,
  bwPacket 
)

Called on ZVEI alarm.

Parameters
bwPacketbwPacket instance

Reimplemented from plugin.pluginBase.PluginBase.

191 def zvei(self, bwPacket):
192 r"""!Called on ZVEI alarm
193 @param bwPacket: bwPacket instance"""
194 msg = self.parseWildcards(self.config.get("message_zvei", default="{TONE}"))
195 self.sender.send_message(msg)
196

◆ msg()

plugin.telegram.BoswatchPlugin.msg (   self,
  bwPacket 
)

Called on MSG packet.

Parameters
bwPacketbwPacket instance

Reimplemented from plugin.pluginBase.PluginBase.

197 def msg(self, bwPacket):
198 r"""!Called on MSG packet
199 @param bwPacket: bwPacket instance"""
200 msg = self.parseWildcards(self.config.get("message_msg"))
201 self.sender.send_message(msg)
202

◆ teardown()

plugin.telegram.BoswatchPlugin.teardown (   self)

Called after alarm Remove if not implemented.

Reimplemented from plugin.pluginBase.PluginBase.

203 def teardown(self):
204 r"""!Called after alarm
205 Remove if not implemented"""
206 pass
207

◆ onUnload()

plugin.telegram.BoswatchPlugin.onUnload (   self)

Called by destruction of the plugin Remove if not implemented.

Reimplemented from plugin.pluginBase.PluginBase.

208 def onUnload(self):
209 r"""!Called by destruction of the plugin
210 Remove if not implemented"""
211 pass

Field Documentation

◆ sender

plugin.telegram.BoswatchPlugin.sender