Skip to content

Commit

Permalink
[command] Add "kotori-selftest" program, still in its infancy
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Apr 5, 2018
1 parent f9d6374 commit 6222ddd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ in progress
- [grafana] Add mechanisms for taming the dashboard refresh interval
- [core] Improve component loading robustness
- [grafana] Refactoring. Robustness. Run GrafanaManager as service. Add worker service for taming dashboard refresh intervals.
- [command] Add ``kotori-selftest`` program, still in its infancy


.. _kotori-0.20.1:
Expand Down
15 changes: 15 additions & 0 deletions kotori/vendor/selftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# (c) 2018 Andreas Motl <andreas@getkotori.org>
import json
import delegator

def run():
realms = ['mqttkit-1', 'hiveeyes', 'luftdaten', 'weewx']
measurements = {"temperature": 42.84, "weight": 84.85}
for realm in realms:
topic = '{}/testdrive/area-42/node-1/data.json'.format(realm)
command = 'mosquitto_pub -h "{host}" -t "{topic}" -m \'{message}\''.format(
host='localhost', topic=topic, message=json.dumps(measurements))

print 'Running command: {}'.format(command)
delegator.run(command)
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'python-dateutil==2.6.0', # 2.7.0
'arrow==0.10.0', # 0.12.1
'funcy==1.7.2', # 1.10.1
'delegator.py==0.1.0',

# Bus adapters
#'twisted-mqtt==0.1.4', # 0.2.1
Expand Down Expand Up @@ -200,6 +201,7 @@
'h2m-csv-udp-fuzzer = kotori.vendor.hydro2motion.client:run_udp_fuzzer',
'lst-message = kotori.vendor.lst.shell:message',
'luftdaten-to-mqtt = kotori.vendor.luftdaten.luftdaten_api_to_mqtt:main',
'kotori-selftest = kotori.vendor.selftest:run',
],
'paste.app_factory': [
'main = kotori.frontend.app:main',
Expand Down

0 comments on commit 6222ddd

Please sign in to comment.