Skip to content

A library that will create the boilerplate to connect to a Home Assistant MQTT server.

License

Notifications You must be signed in to change notification settings

KodeZ/hass_mqtt_device

Repository files navigation

Library for communicating with Home Assistant

hass_mqtt_device is a C++ library designed to simplify creating a device and connecting it to a Home Assistant MQTT server.

There are a number of functions and device types available. See the examples for more info on how to use the library.

Requirements

Build requirements

  • A modern C++ compiler with C++17 support.
  • CMake version 3.10 or higher for building the project.
  • Mosquitto MQTT broker development package
  • Spdlog
sudo apt update
sudo apt install cmake libspdlog-dev nlohmann-json3-dev git libmosquittopp-dev

Also you need wiring-pi for raspberry pi setups:

wget https://github.com/WiringPi/WiringPi/releases/download/3.4/wiringpi_3.4_arm64.deb
sudo dpkg -i wiringpi_3.4_arm64.deb
rm wiringpi_3.4_arm64.deb

Optional

  • gTest

Installation

  1. Clone the repository:
git clone https://github.com/KodeZ/hass_mqtt_device.git
  1. Navigate to the project directory and create a build directory:
cd hass_mqtt_device
  1. Configure and build the project:
make
  1. (Optional) Install the library to your system:
sudo make install

Usage

There are a few devices defined for comfort. See the devices folder. It is rather easy to make your own devices by inheriting from DeviceBase, then add functions from the functions folder, or create your own functions from FunctionBase.

Examples

In the examples folder there are a few examples on how the library can be used.

Contributing

If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.

License

See the LICENSE file, but in short it is MIT.

About

A library that will create the boilerplate to connect to a Home Assistant MQTT server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published