Added more backends docs
parent
a26714ec97
commit
4e50fb9a29
53
Backends.md
53
Backends.md
|
@ -13,7 +13,6 @@
|
|||
* [Sensor backends](#sensor-backends)
|
||||
* [Infrared sensor](#infrared-sensor)
|
||||
* [ZeroBorg backend](#zeroborg-backend)
|
||||
* [Leap Motion](#leap-motion)
|
||||
* [MCP3008](#mcp3008)
|
||||
* [Arduino and serial backend](#arduino-and-serial-backend)
|
||||
* [inotify backend](#inotify-backend)
|
||||
|
@ -595,10 +594,58 @@ You can also connect [IFTTT](https://ifttt.com) to Platypush actions by leveragi
|
|||
|
||||
[Backend reference](https://platypush.readthedocs.io/en/latest/platypush/backend/kafka.html)
|
||||
|
||||
[Apache Kafka](https://kafka.apache.org/) is a distributed streaming platform that allows you to build flexible message-based interfaces across your devices.
|
||||
|
||||
You can connect Platypush to a Kafka broker server through this backend and configure it to listen for messages on a specific topic (default topic name: `platypush.<device_id>`).
|
||||
|
||||
Messages received over the topic will:
|
||||
|
||||
* Be processed as Platypush messages (requests, responses or messages) if they are valid JSON-formatted messages
|
||||
* Trigger a [`KafkaMessageEvent`](https://platypush.readthedocs.io/en/latest/platypush/event/kafka) that you can build event hooks on otherwise
|
||||
|
||||
The configuration is quite straightforward:
|
||||
|
||||
```yaml
|
||||
backend.kafka:
|
||||
server: host:9092 # Kafka broker server and port to connect to
|
||||
topic: platypush # Default topic prefix to listen on. The actual topic name will be <topic>.<device_id>
|
||||
```
|
||||
|
||||
# MPD/Mopidy backend
|
||||
|
||||
[Backend reference](https://platypush.readthedocs.io/en/latest/platypush/backend/music.mpd.html)
|
||||
|
||||
You can use this backend to get events from your MPD/Mopidy music server, for instance when a new track is being played, when the playback is paused/resumed or when the current playlist changes.
|
||||
|
||||
Configuration:
|
||||
|
||||
```yaml
|
||||
backend.music.mpd:
|
||||
server: localhost # MPD/Mopidy server
|
||||
port: 6600 # Server port (default: 6600)
|
||||
poll_seconds: 3 # How often you want to poll the server for updates (default: 3 seconds)
|
||||
```
|
||||
|
||||
|
||||
An example that sends a _scrobble_ request to [Last.FM](https://last.fm) when a new track is played:
|
||||
|
||||
```yaml
|
||||
event.hook.ScrobbleNewTrack:
|
||||
if:
|
||||
type: platypush.message.event.music.NewPlayingTrackEvent
|
||||
then:
|
||||
-
|
||||
action: lastfm.scrobble
|
||||
args:
|
||||
artist: ${track['artist']}
|
||||
title: ${track['title']}
|
||||
-
|
||||
action: lastfm.update_now_playing
|
||||
args:
|
||||
artist: ${track['artist']}
|
||||
title: ${track['title']}
|
||||
```
|
||||
|
||||
# MIDI backend
|
||||
|
||||
[Backend reference](https://platypush.readthedocs.io/en/latest/platypush/backend/midi.html)
|
||||
|
@ -621,10 +668,6 @@ You can also connect [IFTTT](https://ifttt.com) to Platypush actions by leveragi
|
|||
|
||||
[Backend reference](https://platypush.readthedocs.io/en/latest/platypush/backend/sensor.ir.zeroborg.html)
|
||||
|
||||
## Leap Motion
|
||||
|
||||
[Backend reference](https://platypush.readthedocs.io/en/latest/platypush/backend/sensor.leap.html)
|
||||
|
||||
## MCP3008
|
||||
|
||||
[Backend reference](https://platypush.readthedocs.io/en/latest/platypush/backend/sensor.mcp3008.html)
|
||||
|
|
32
Plugins.md
32
Plugins.md
|
@ -24,6 +24,7 @@
|
|||
* [MIDI plugin](#midi-plugin)
|
||||
* [MQTT plugin](#mqtt-plugin)
|
||||
* [Pushbullet plugin](#pushbullet-plugin)
|
||||
* [Kafka plugin](#kafka-plugin)
|
||||
* [IFTTT plugin](#ifttt-plugin)
|
||||
* [Adafruit IO plugin](#adafruit-io-plugin)
|
||||
* [Weather plugin](#weather-plugin)
|
||||
|
@ -46,6 +47,8 @@ music.mpd:
|
|||
port: 6600
|
||||
```
|
||||
|
||||
It's advised to turn on the [MPD/Mopidy backend](backends#mpd-mopidy-backend) as well if you want to receive live events on your playback status.
|
||||
|
||||
# Web interface
|
||||
|
||||
If you have enabled the HTTP backend, you can already point your browser to `http://hostname:8008` and you would see a new tab named `music.mpd` in your control panel. You can browse your music from here, modify the current playlist, search for music and control the playback state. If you're using mopidy and you have some plugins configured (Spotify, SoundCloud, TuneIn...), you'll be able to control music from your cloud accounts from here as well. The interface will look [like this](https://i.imgur.com/HbpDL5K.png).
|
||||
|
@ -787,6 +790,35 @@ curl -XPOST -H 'Content-Type: application/json' \
|
|||
http://hostname:8008/execute
|
||||
```
|
||||
|
||||
# Kafka plugin
|
||||
|
||||
[Plugin reference](https://platypush.readthedocs.io/en/latest/platypush/plugins/kafka.html)
|
||||
|
||||
Use this plugin if you want to synchronize messages to your devices over a Kafka message instance. Some use cases:
|
||||
|
||||
* Send asynchronous messages to other Kafka nodes
|
||||
* Send raw messages to other Platypush devices and build event hooks on them
|
||||
* Send directly JSON-formatted requests, responses or events to other Platypush devices
|
||||
|
||||
The configuration is quite straightforward:
|
||||
|
||||
```yaml
|
||||
kafka:
|
||||
server: host:9092 # Default hostname and port where the Kafka broker runs. If None (default), then
|
||||
# you will either have to specify on `send_command`, or it will use the Kafka
|
||||
# backend configured server, if the Kafka backend is running
|
||||
```
|
||||
|
||||
If you want to use Kafka to deliver messages to other Platypush devices keep in mind that their [Kafka backends](backends#kafka-backend) will listen by default on a queue named `platypush.<device_id>`.
|
||||
|
||||
Example to send a text Kafka message:
|
||||
|
||||
```shell
|
||||
curl -XPOST -H 'Content-Type: application/json' \
|
||||
-d '{"type":"request", "target":"hostname", "action":"kafka.send_message", "args": {"msg":"My first Kafka message over Platypush"}}' \
|
||||
http://localhost:8008/execute
|
||||
```
|
||||
|
||||
# IFTTT plugin
|
||||
|
||||
[Plugin reference](https://platypush.readthedocs.io/en/latest/platypush/plugins/ifttt.html)
|
||||
|
|
Loading…
Reference in New Issue