Maison README

Automatize household appliances working with MQTT

maison-logo

Maison /mεzɔ̃/ is a highly customized control center of smart homes and also a light-weight solution for managing several household appliances.

One configuration TOML file is all Maison need. To feed it with commands to appliances or states of devices using MQTT (Message Queuing Telemetry Transport) from LoRa server or other MQTT sources, Maison will issue commands to certain devices and stores changes on states of devices in the database for monitoring in real time.

Also, Maison provides couples of HTTP APIs for client to request so that you can connect smart home APP and smart household appliances seamlessly and painlessly. You can create cron jobs to update devices settings periodically, which is so handy that you only have to add a timestamp in request JSON.

It, at first, was a tiny project which is to build some certain smart classrooms for new campus, working with fixed number and types of devices. As development goes on, making it a more general solution came up in my mind. So here is it.

Get Started

Install InfluxDB for storage and run it at localhost:8086. See InfluxDB Documentation

Install Redis for cron jobs and run it at localhost:6379. See Redis Documentation

The both host and port of databases above can be modified in the configuration file. Then, run

pip install -r requirements.txt
python main.py

Now, the MQTT broker and Maison APIs are working. You can manipulate the appliances by accessing APIs or connecting to your LoRa Server or just using bare MQTT client for testing.

API

POST the following JSON data to http://localhost:2019/command/light/1/

{
    "state": "on"
}

MQTT client

You need a MQTT client to mime LoRa Server actions. Eclipse Mosquitto is a good choice. If you prefer one with graphic interface, MQTTfx might be what you want. Try subscribing “application/1/device/light/rx” and then publish the following JSON to the topic.

{
    "data": "{\"state\":\"on\"}"
}

LoRa Server

See chapter about MQTT integration in Lora Server Documentation

If everything goes well, your light_1 should be on.

Enjoy :P

Configuration File

An example configuration file is offered. All devices properties and commands or statesinformation can be customized.

Use HTTP APIs

Message Data Format

License

GNU Affero General Public License v3.0


See also

comments powered by Disqus