icukeng / wb-can

CANbus-MQTT bridge using WirenBoard conventions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CANbus-MQTT bridge

Summary

Service which enables communucation for HomA based controllers with CAN bus devices. It's originally designed to be used with Wiren Board smart home, and uses extended MQTT conventions.

Now bridge supports Hapcan relays only, but can be extended easily to all Hapcan units and maybe some other CANbus devices. (It's only matter of bus communication dumps and API, 'cause I don't have any devices except those relays).

Usage

Target build with wbdev wbdev make. For tests run make ifup (from root) for dummy interface and use candump, cansend.

Cli flags are:

  • -p - mqtt port (default: 1883)
  • -h - mqtt host (default: localhost)
  • -v lvl - verbose level 0-4 (default: 0)

Internals notes

  • CAN bus doesn't have any scan ability, so in general some config needed. But not now - Hapcan supports scan frame. Service send scan frame on startup to obtain device list. Config may appear later (on demand).
  • Bistable relay can save own On-Off state. The question is where is verified state while unsync (on power loss for example). Now it is on relay side.

About

CANbus-MQTT bridge using WirenBoard conventions

License:GNU General Public License v3.0


Languages

Language:C 88.7%Language:C++ 8.7%Language:Makefile 2.7%