tuple

command module
Version: v0.0.0-...-cda790b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

Tuple

A simple, low-level matrix <--> mqtt "bridge".

#tuple:eiselecloud.de

Usage

go get gitlab.eiselecloud.de/matrix/tuple

tuple -homeserver https://matrix.org -username tuple -password secret -broker tcp://localhost:1883

The rooms have to joined manually at this point via another client.

Configuration using environment vars is also possible:

  • USERNAME
  • PASSWORD
  • HOMESERVER
  • BROKER

The command line args overwrite these.

Docker

There's a reproducible docker image available at docker.eiselecloud.de/matrix/tuple.

Matrix -> MQTT

The bridge will send all Matrix Message Events to:

Topic: _tuple/client/r0/rooms/<roomId>/event/<eventType>

Content: the received Matrix event, like

{
  "type": "m.room.message",
  "sender": "@tuple:eiselecloud.de",
  "content": {
    "body": "foo",
    "msgtype": "m.text"
  },
  "origin_server_ts": 1590951283344,
  "unsigned": {
    "age": 165
  },
  "event_id": "$yNhWPC-6zi85SQGpkqsbZv6K_aTW8yrpkgn0y83FgiI",
  "room_id": "!jxyndfUCCLyUOLeZuI:eiselecloud.de"
}

MQTT -> Matrix

Topic: _tuple/client/r0/rooms/<roomId>/send/<eventType>

Content: Any Matrix Message Event Content, like

{
    "msgtype":"m.text",
    "body": "foo"
}

The sender will be the tuple user.

Note that tuple will happily receive its own Matrix events and publish them to MQTT.

Use cases

  • Weather Station Example
  • Just for fun
  • Small IOT devices, like the ESP32 that don't require persistence or other advanced Matrix features
  • A federated sensor network
  • Smart Home stuff

Design

This Bridge should closely follow the Matrix Client Server Specs, with useful exceptions.

The eventType is included in the mqtt topic, so that IOT devices can choose to subscribe only to compatible (proprietary) events

This is my first golang project, so don't judge to hard on programming decisions.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL