Skip to content

CarlosLagarto/controller_share

Repository files navigation


Lagarto Controller

Logo

Built With

RUST Javascript Mosquitto Apache Shelly Tempest SQLite

Table of Contents
  1. About The Project
  2. Installation
  3. Roadmap
  4. License
  5. Contact
  6. Acknowledgments

About The Project

IoT backend controller + SPA Client + ML for next day rain probability.


Why: Just to keep my "nerd" spirit updated technology wise regarding HTML5, CSS3, SVG, RUST, Javascript ECMA2015, WebApps, Apache, SqLite, Linux, ...

First version was made with Python and MySql in the backend, but I simplified the database engine (sqlite uses less server resources than mysql) and with rust we use much less CPU, meaning lower power consuption (0%..0.5% versus 20%..40%)

Smart control for lawn watering, house central heater, integration and control of weather station data, and other sensors and actuators, with custom automation scenaries.


How it work: Async distributed system, with rust near real time controller, running on a intel NUC with linux/ubuntu.

The controller integrates and bridges the external devices:

* Shellies to control the lawn water valves, central heater, shutters, esternal gate, etc.
* Tempest - weather station with readings each minute. Station transmit UDP packets, and we have a fail safe REST API channel to tempest site.
* Mosquitto MQTT Broker near real-time clients integration (commands and status reading).
* Apache Web for the SPA web application
* Green IT - power consuption bellow 0.5% CPU.

Also, as this is for limited and controlled usage, I've installed OpenSSL in a self-signed CA, and configured the Apache and the clients to work with two-way SSL authentication. Client certificates are installed manually. Not the best scenario, but as we are talking about 2 or 3 mobile phones, I decided to go this way. Apache only serves https requests, and internally the requests are proxied to the backend. Also defined some rules to allow for two environments (dev/test and production) as I use the same machine. All the devices have fixed IPs.

(back to top)

Installation

I will give more details, but the general instalation procedure is:

  • install and configure apache (sample configuration to be provided)
  • install and configure mosquitto (sample configuration to be provided)
  • install SQLite and create databases in the desired location (scripts are provided) (https://sqlitestudio.pl/)
  • configure the the config files (see code example)
  • create site in apache and copy the ite files. I've created an account in a free dynamic dns service
  • compile rust application for your plataform (rust have to be installed), or copy the exec to the desired location (linux64)
  • configure your devices in the database. SQL must be used. I decided that making a UI for data entry, for something that is done once, on application installation and configuration and devices instalation, didn't deserve that effort.
    Any updates if/when necessary will be done also through SQL commands

(back to top)

Roadmap

As of 2023/Apr/5, weather data and lawn watering in the manual and standard modes are ready and in production for 4 months.

  • Add Changelog
  • Terminate testing of lawn watering wizard mode
  • Terminate devices and scenarios control (client and backend)

See the open issues for a list of known issues.

(back to top)

License

Distributed under the MIT License. See license.txt for more information.

(back to top)

Contact

Carlos Lagarto

Project Link: [https://github.com/CarlosLagarto/controller_share]

(back to top)

Acknowledgments

Just a special thanks to the RUST community and Mozzila that have made this journey easier and fun!

(back to top)