Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #23 from myoung34/stdout
Browse files Browse the repository at this point in the history
Add support for stdout emitter
  • Loading branch information
myoung34 authored Aug 14, 2020
2 parents 3702c14 + 1bfce54 commit 28d6a4a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The Tilt supports writing to a google doc which you could use with something lik

## Supported Emitters ##

* stdout
* Webhooks
* InfluxDB
* Datadog (dogstatsd)
Expand All @@ -36,6 +37,9 @@ $ cat <<EOF >config.ini
sleep_interval = 2 # defaults to 1
logging_level = DEBUG # defaults to INFO
# stdout example
[stdout]
# SQLite example
[sqlite]
file = /etc/tilty/tilt.sqlite
Expand Down
17 changes: 17 additions & 0 deletions tests/test_stdout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from tilty.emitters import stdout


def test_stdout_type(
):
assert stdout.__type__() == 'Stdout'


def test_stdout():
config = {}
stdout.Stdout(config=config).emit(tilt_data={
'color': 'black',
'mac': '00:0a:95:9d:68:16',
'gravity': 1000,
'temp': 80,
})
29 changes: 29 additions & 0 deletions tilty/emitters/stdout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
""" stdout emitter """
import logging

LOGGER = logging.getLogger()


def __type__() -> str:
return 'Stdout'


class Stdout: # pylint: disable=too-few-public-methods
""" Stdout wrapper class """

def __init__(self, config: dict) -> None:
""" Initializer
Args:
config: (dict) represents the configuration for the emitter
"""
# <start config sample>
# [stdout]

def emit(self, tilt_data: dict) -> None:
""" Initializer
Args:
tilt_data (dict): data returned from valid tilt device scan
"""

0 comments on commit 28d6a4a

Please sign in to comment.