chrishrb / hoval-gateway

Hoval Gateway
Apache License 2.0
13 stars 5 forks source link
can gateway hoval hoval-gateway mqtt

Hoval Gateway (CAN Bus)

PR-CI

This repository contains a simple Gateway for Hoval ventilations and other applicances. Most of the logic and the idea is from this repository: https://github.com/zittix/Hoval-GW

Thanks a lot!

It is configured for a Hoval ventilation (HV) (mostly in German - i will change that soon). If you have another device you have to configure the datapoints in the gateway/settings.py and also change the device, datapoints can be read in docs/datapoints.csv. If you need help setting up your devices make a new issue, i will help you.

Home Assistant

Features

Important

This repository is simply a demo and not for production use. Use with caution!

If you found any issues or improvements feel free to add pull requests or an issue!

Setup required

Hardware

  1. Raspberry PI
  2. CAN Transceiver and adapter (or simply a complete board e.g. PiCAN2 or CanHat)

Pinout of RJ45 CAN

1: CAN-HIGH
2: CAN-LOW
7: GND

Instructions

  1. Install Raspbian
  2. Install and setup CAN
    
    # Update Raspbian
    sudo apt-get update 
    sudo apt-get upgrade 
    sudo reboot 

sudo vim /boot/config.txt

Add these 3 lines to the end of the file

dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=spi-bcm2835-overlay

or for 2ch-CanHat

dtparam=spi=on

dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=25

dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=23

dtoverlay=spi-bcm2835-overlay

3. Install and setup can-utils and python3
```bash
sudo apt-get install -y can-utils python3
  1. Clone repository
  2. Install dependencies and add your own .env
    
    cd hoval-gateway
    pip3 install -r requirements.txt
    vim .env

Add these Environmentals and replace them with your values

MQTT_BROKER=IP_OF_YOUR_BROKER MQTT_BROKER_USERNAME=USERNAME MQTT_BROKER_PASSWORD=PASSWORD

not needed, default is hoval-gw

MQTT_TOPIC=

6. Setup CAN Interface to be up at boot time
```bash
sudo vim /etc/rc.local

# Add this line bevor exit(0)
ip link set can0 up type can bitrate 50000
  1. Reboot
  2. Start Script python3 . -s settings.yml

After Install

MQTT

Home Assistant

Topics

MQTT-Topics are standardized in the structure:

e.g. hoval-gw/temperature_outside_air/status