Permalink
Browse files

Add support for our new klingelblink server.

  • Loading branch information...
noniq committed May 6, 2015
1 parent 2619496 commit feae3383b1db313ba9ed34821887bec43aa185ff
Showing with 13 additions and 0 deletions.
  1. +1 −0 README.md
  2. +5 −0 config.example.yml
  3. +7 −0 da-klingel.rb
@@ -19,6 +19,7 @@ Apart from playing a sound file there are three more actions the script can trig
* __Snapshot__: Uses a webcam to take a snapshot image. The webcam must provide a URL to create a snapshot, returning a JSON response containing the URL of the snapshot: `{"url": "http://example.com/snapshots/123.jpg"}`. If available, the snapshot image will be used in the Flowdock and status screen actions below.
* __Flowdock__: The script can post a notification to your flowdock inbox.
* __Status screen__: The script can trigger a specific screen in our [status screen app](https://github.com/die-antwort/status-screen).
* __Klingelblink__: The script can trigger our [klingelblink server](https://github.com/die-antwort/klingelblink).

To enable these actions just set `enabled:` to `true` and fill in the needed settings (API key, host, …)

@@ -43,3 +43,8 @@ flowdock:
no_snapshot_available: Röööööng röööööng …
tags:
- doorbell


klingelblink:
enabled: false
url: YOUR_KLINGELBLINK_URL
@@ -13,6 +13,12 @@ def play_sound(config)
system "pacmd", "play-file", path_to_file, config.pa_sink.to_s, out: "/dev/null"
end

def klingelblink(config)
return unless config.enabled
url = URI(config.url)
Net::HTTP.post_form(url, {})
end

def save_snapshot(config)
return unless config.enabled
response = Net::HTTP.get(URI(config.url))
@@ -61,6 +67,7 @@ def convert_members_to_ostruct(hash)
Thread.new do
begin
play_sound($config.sound)
klingelblink($config.klingelblink)
snapshot_url = save_snapshot($config.snapshot)
update_status_screen($config.status_screen, snapshot_url)
post_to_flowdock($config.flowdock, snapshot_url)

0 comments on commit feae338

Please sign in to comment.