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
|
- config list|set|get|write
|
||||||
- detection status|connection|start|pause
|
- detection status|connection|start|pause
|
||||||
- action eventstart|eventend|snapshot|restart|quit|end
|
- action eventstart|eventend|snapshot|restart|quit|end
|
||||||
|
- url get|set <motionurl>
|
||||||
|
|
||||||
Usage: '!cam <id> category command'
|
Usage: '!cam <id> category command'
|
||||||
|
|
||||||
<id> is the numerical id of the camera. Use 0 for all cameras.
|
<id> is the numerical id of the camera. Use 0 for all cameras.
|
||||||
If <id> is omitted, 0 is assumed."""
|
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):
|
async def matrix_message(self, bot, room, event):
|
||||||
args = event.body.split()
|
args = event.body.split()
|
||||||
args.pop(0)
|
args.pop(0)
|
||||||
|
@ -30,6 +41,17 @@ class MatrixModule(BotModule):
|
||||||
await bot.send_text(room, self.helptext, event)
|
await bot.send_text(room, self.helptext, event)
|
||||||
return
|
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
|
recvd_camid = 1
|
||||||
try:
|
try:
|
||||||
# Check if first argument is numeric (camera id)
|
# Check if first argument is numeric (camera id)
|
||||||
|
|
Loading…
Reference in New Issue