All Projects → vapourismo → knx-go

vapourismo / knx-go

Licence: MIT license
KNX clients and protocol implementation in Go

Programming Languages

go
31211 projects - #10 most used programming language
Nix
1067 projects

Projects that are alternatives of or similar to knx-go

SerialToTCPBridgeProtocol
An error tolerant serial UART to TCP connection, raw data bridge.
Stars: ✭ 16 (-74.19%)
Mutual labels:  gateway, bridge
Whapp Irc
whatsapp web <-> irc gateway
Stars: ✭ 208 (+235.48%)
Mutual labels:  gateway, bridge
Slack-IRC-Gateway
Bridge Slack rooms to IRC channels
Stars: ✭ 33 (-46.77%)
Mutual labels:  gateway, bridge
PSAVanCanBridge
VAN - CAN protocol bridge (V2C) for cars made by PSA Group (Peugeot, Citroen)
Stars: ✭ 67 (+8.06%)
Mutual labels:  protocol, gateway
fuso
一款体积小, 快速, 稳定, 高效, 轻量的内网穿透, 端口转发工具 支持多连接,级联代理,传输加密 (A small volume, fast, stable, efficient, and lightweight intranet penetration, port forwarding tool supports multiple connections, cascading proxy, and transmission encryption)
Stars: ✭ 1,132 (+1725.81%)
Mutual labels:  tunnel, bridge
Kcp
⚡ KCP - A Fast and Reliable ARQ Protocol
Stars: ✭ 10,473 (+16791.94%)
Mutual labels:  tunnel, protocol
Openmqttgateway
MQTT gateway for ESP8266, ESP32, Sonoff RF Bridge or Arduino with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility, SMS & LORA.
Stars: ✭ 2,413 (+3791.94%)
Mutual labels:  gateway, bridge
elvisp
Virtual ISP / IP tunnel daemon for cjdns.
Stars: ✭ 19 (-69.35%)
Mutual labels:  protocol, gateway
lightify-binary-protocol
Documentation of the OSRAM Lightify Binary Protocol for communication between Lightify Gateway and applications
Stars: ✭ 26 (-58.06%)
Mutual labels:  protocol, gateway
FullProxy
Bind and reverse connection based, SOCKS5, HTTP and PortForward based portable proxy
Stars: ✭ 22 (-64.52%)
Mutual labels:  tunnel, protocol
Gateway Go
🎁GateWay Client for OpenIoTHub[云易连访问内网端口和设备的网关]
Stars: ✭ 127 (+104.84%)
Mutual labels:  tunnel, gateway
apisix-go-plugin-runner
Go Plugin Runner for APISIX
Stars: ✭ 113 (+82.26%)
Mutual labels:  gateway
devicehive-python
DeviceHive Python library
Stars: ✭ 29 (-53.23%)
Mutual labels:  gateway
apdu-over-ble
Specification of a protocol to transmit APDU commands and responses over Bluetooth Low Energy
Stars: ✭ 17 (-72.58%)
Mutual labels:  protocol
Telephone-Remote-Control
No description or website provided.
Stars: ✭ 19 (-69.35%)
Mutual labels:  gateway
hermes-protocol
Definition of the Hermes protocol used by the Snips platform
Stars: ✭ 38 (-38.71%)
Mutual labels:  protocol
haal
Hääl - Anonymous Electronic Voting System on Public Blockchains
Stars: ✭ 96 (+54.84%)
Mutual labels:  protocol
go-http-dialer
Go net.Dialer for HTTP(S) CONNECT Tunneling.
Stars: ✭ 55 (-11.29%)
Mutual labels:  tunnel
spec
[OLD!] RGB Protocol specifications for Bitcoin-based digital assets
Stars: ✭ 149 (+140.32%)
Mutual labels:  protocol
gateway
Springcloud gateway 的样例工程, 封装了一些常用的网关功能,如鉴权,数据级权限控制,验签,动态路由,日志,流控,降级等
Stars: ✭ 16 (-74.19%)
Mutual labels:  gateway

Check GoDoc

knx-go

This repository contains a collection of Go packages that provide the means to communicate with KNX networks.

Packages

Package Description
knx Abstractions to communicate with KNXnet/IP servers
knx/knxnet KNXnet/IP protocol services
knx/dpt Datapoint types
knx/cemi CEMI-encoded frames
cmd/knxbridge Tool to bridge KNX networks between a KNXnet/IP router and gateway

Installation

Simply run the following command.

$ go get -u github.com/vapourismo/knx-go/...

Examples

KNXnet/IP Group Client

If you simply want to send and receive group communication, the GroupTunnel or GroupRouter might be sufficient to you.

package main

import (
	"log"
	"os"

	"github.com/vapourismo/knx-go/knx"
	"github.com/vapourismo/knx-go/knx/cemi"
	"github.com/vapourismo/knx-go/knx/dpt"
	"github.com/vapourismo/knx-go/knx/util"
)

func main() {
	// Setup logger for auxiliary logging. This enables us to see log messages from internal
	// routines.
	util.Logger = log.New(os.Stdout, "", log.LstdFlags)

	// Connect to the gateway.
	client, err := knx.NewGroupTunnel("10.0.0.7:3671", knx.DefaultTunnelConfig)
	if err != nil {
		log.Fatal(err)
	}

	// Close upon exiting. Even if the gateway closes the connection, we still have to clean up.
	defer client.Close()

	// Send 20.5°C to group 1/2/3.
	err = client.Send(knx.GroupEvent{
		Command:     knx.GroupWrite,
		Destination: cemi.NewGroupAddr3(1, 2, 3),
		Data:        dpt.DPT_9001(20.5).Pack(),
	})
	if err != nil {
		log.Fatal(err)
	}

	// Receive messages from the gateway. The inbound channel is closed with the connection.
	for msg := range client.Inbound() {
		var temp dpt.DPT_9001

		err := temp.Unpack(msg.Data)
		if err != nil {
			continue
		}

		util.Logger.Printf("%+v: %v", msg, temp)
	}
}

In case you want to access a KNXnet/IP router instead of a gateway, simply replace

client, err := knx.NewGroupTunnel("10.0.0.7:3671", knx.DefaultTunnelConfig)

with

client, err := knx.NewGroupRouter("224.0.23.12:3671", knx.DefaultRouterConfig)

KNXnet/IP CEMI Client

Use Tunnel or Router for finer control over the communication with a gateway or router.

KNX Bridge

The knxbridge tool (in package cmd/knxbridge) has multiple use cases.

Expose a KNX network behind a gateway at 10.0.0.2:3671 on the multicast group 224.0.23.12:3671. This allows routers and router clients to access the network.

$ knxbridge 10.0.0.2:3671 224.0.23.12:3671

Connect two KNX networks through gateways. In this example one gateway is at 10.0.0.2:3671, the other is at 10.0.0.3:3671.

$ knxbridge 10.0.0.2:3671 10.0.0.3:3671

Discover all KNXnet/IP Servers

The following example shows how to discover all routers/gateways on a network.

package main

import (
	"log"
	"os"
	"time"

	"github.com/kr/pretty"

	"github.com/vapourismo/knx-go/knx"
	"github.com/vapourismo/knx-go/knx/util"
)

func main() {
	// Setup logger for auxiliary logging. This enables us to see log messages from internal
	// routines.
	util.Logger = log.New(os.Stdout, "", log.LstdFlags)

	servers, err := knx.Discover("224.0.23.12:3671", time.Millisecond*750)
	if err != nil {
		log.Fatal(err)
	}

	util.Logger.Printf("%# v", pretty.Formatter(servers))
}

Describe a Single KNXnet/IP Server

The following example shows how to get a description from a single server.

package main

import (
	"log"
	"os"
	"time"

	"github.com/kr/pretty"

	"github.com/vapourismo/knx-go/knx"
	"github.com/vapourismo/knx-go/knx/util"
)

func main() {
	util.Logger = log.New(os.Stdout, "", log.LstdFlags)

	// Describe KNXnet/IP server at given address and default port
	servers, err := knx.DescribeTunnel("192.168.1.254:3671", time.Millisecond*750)
	if err != nil {
		log.Fatal(err)
	}

	util.Logger.Printf("%# v", pretty.Formatter(servers))
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].