From Salt documentation, we can use this code to raise custom events. Will this work in AutoPi?
import salt.client
caller = salt.client.Caller()
ret = caller.cmd('event.send',
'myco/event/success'
{ 'success': True,
'message': "It works!" })
if not ret:
# the event could not be sent, process the error here
...