Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pvainio/vallox-rs485

Vallox RS485 serial bus implemenation for Go
https://github.com/pvainio/vallox-rs485

home home-automation iot rs485 vallox

Last synced: about 2 months ago
JSON representation

Vallox RS485 serial bus implemenation for Go

Awesome Lists containing this project

README

        

# Vallox RS485 serial interface module for Go lang

## Overview

This module implements Vallox RS485 serial protocol. Currently it can:
- read temperature reported by device: outside -> incoming -> inside -> outgoing
- read ventilation fan speed
- change ventilation fan speed

Made for https://github.com/pvainio/vallox-mqtt Vallox RS485 MQTT gateway for Home Assistant integration

## Supported devices

The module has been tested with only one device so far:
- Vallox Digit SE model 3500 SE made in 2001 (one with old led panel, no lcd panel)

Probably it will support other Vallox models using RS485 serial bus for remote controllers. It is possible that some registers have have changed through time since this device register does not match Vallox documentation.

Use at your own risk! Vallox documentation warns about using incorrect registers or incorrect values may damage the device.

## Usage

To write registers (speed) Config.EnableWrite need to be set to true.

## Example

```go
package main

import (
"log"

valloxrs485 "github.com/pvainio/vallox-rs485"
)

var registers = map[byte]string{
valloxrs485.FanSpeed: "Speed",
valloxrs485.TempIncomingOutside: "Ouside temp",
valloxrs485.TempIncomingInside: "Incoming temp",
valloxrs485.TempOutgoingInside: "Inside temp",
valloxrs485.TempOutgoingOutside: "Outgoing temp",
}

func main() {
cfg := valloxrs485.Config{Device: "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A901IPIR-if00-port0"}
vallox, err := valloxrs485.Open(cfg)

if err != nil {
log.Fatalf("error opening Vallox device %s: %v", cfg.Device, err)
}

for {
event := <-vallox.Events()

if !vallox.ForMe(event) {
// Do not handle values addressed for someone else in the same bus
continue
}

if name, ok := registers[event.Register]; ok {
log.Printf("Received new value %s = %d", name, event.Value)
} else {
log.Printf("Received unidentified value register %d = %d", event.Register, event.Value)
}
}
}
```