Updated Procedures, event hooks and cronjobs as Python scripts (markdown)
parent
0789218b83
commit
1c645ec92a
|
@ -52,3 +52,20 @@ from platypush.message.event.assistant import SpeechRecognizedEvent
|
|||
def test_procedure(event, **content):
|
||||
print('Recognized speech: {}'.format(event.args['phrase']))
|
||||
```
|
||||
As well as cronjobs:
|
||||
|
||||
```python
|
||||
# ~/.config/platypush/scripts/test.py
|
||||
|
||||
from platypush.cron import cron
|
||||
from platypush.utils import run
|
||||
|
||||
# Run it every minute
|
||||
@cron('* * * * *')
|
||||
def test_cron(event, **content):
|
||||
import os
|
||||
import datetime
|
||||
|
||||
with open(os.path.expanduser('~/test.txt'), 'a') as f:
|
||||
f.write('The time is: {}\n'.format(datetime.datetime.now().isoformat()))
|
||||
```
|
Loading…
Reference in a new issue