43 lines
1.0 KiB
Markdown
43 lines
1.0 KiB
Markdown
+++
|
|
title = "Configuration"
|
|
date = "2017-04-29T18:36:24+02:00"
|
|
Weight=3
|
|
+++
|
|
The config file is located at `~/.haasp/haasp_config.py`
|
|
|
|
### Template
|
|
```python
|
|
from haasp import EventObject, ConfigObject
|
|
|
|
class Config(ConfigObject):
|
|
|
|
|
|
def config(self):
|
|
|
|
config = {}
|
|
|
|
# Clock
|
|
config["clock"] = {}
|
|
config["clock"]["location"] = "copenhagen"
|
|
|
|
return config
|
|
|
|
|
|
def setup(self):
|
|
# -------------------------------------------------------------------------
|
|
# Create event objects
|
|
# -------------------------------------------------------------------------
|
|
self.clock = EventObject("clock", "now")
|
|
self.timer_test = EventObject("timer", "test")
|
|
|
|
|
|
def process_event(self):
|
|
|
|
# -------------------------------------------------------------------------
|
|
# Create workflows
|
|
# -------------------------------------------------------------------------
|
|
if self.timer_test.event == "triggered":
|
|
self.log.debug("Timer DONE!")
|
|
|
|
```
|