Christoffer Martinsson e089b4e0da Added code syntax
2018-10-28 17:32:30 +01:00

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!")
```