Configurable URL for Motion API
This commit is contained in:
parent
d844e8ccb5
commit
e9a2f9dca0
|
@ -17,12 +17,23 @@ class MatrixModule(BotModule):
|
|||
- config list|set|get|write
|
||||
- detection status|connection|start|pause
|
||||
- action eventstart|eventend|snapshot|restart|quit|end
|
||||
- url get|set <motionurl>
|
||||
|
||||
Usage: '!cam <id> category command'
|
||||
|
||||
<id> is the numerical id of the camera. Use 0 for all cameras.
|
||||
If <id> is omitted, 0 is assumed."""
|
||||
|
||||
def get_settings(self):
|
||||
data = super().get_settings()
|
||||
data['motionurl'] = self.motionurl
|
||||
return data
|
||||
|
||||
def set_settings(self, data):
|
||||
super().set_settings(data)
|
||||
if data.get('motionurl'):
|
||||
self.motionurl = data['motionurl']
|
||||
|
||||
async def matrix_message(self, bot, room, event):
|
||||
args = event.body.split()
|
||||
args.pop(0)
|
||||
|
@ -30,6 +41,17 @@ class MatrixModule(BotModule):
|
|||
await bot.send_text(room, self.helptext, event)
|
||||
return
|
||||
|
||||
elif args[0] == 'url':
|
||||
if args[1] == 'set':
|
||||
newurl = args[2]
|
||||
bot.must_be_owner(event)
|
||||
self.motionurl = newurl
|
||||
bot.save_settings()
|
||||
await bot.send_text(room, f"Motion API URL set to {self.motionurl}")
|
||||
elif args[1] == 'get':
|
||||
await bot.send_text(room, f"Motion URL is currently {self.motionurl}")
|
||||
|
||||
else:
|
||||
recvd_camid = 1
|
||||
try:
|
||||
# Check if first argument is numeric (camera id)
|
||||
|
|
Loading…
Reference in New Issue