Various usefull/useless IoT devices connected to NodeRed and Home Assistant using Arduino IDE and ESP8266 and MQTT for communication over WiFi.
The scope of this repository is to provide a series of ready-made schetches for variety of sensors and actuators (in general devices) that can easily communicate via MQTT using ESP8266 chip family boards. Initally developed for connecting to a generic MQTT platform, the sensors works fine together with home automation framework like Home Assistant, Domoticz, OpenHAB, NODE-RED and everything that can easily communicate with an MQTT broker. By the way these devices can be used in many different ways and connected to whatever platform is preferred.
These sketches are developed inside the Arduino development enviroment (Arduino IDE) for the ESP8266 bords. Information about how to install the core for such boards are available here or you can visit this repository:
MQTT (aka MQ Telemetry Transport) is a machine-to-machine or “Internet of Things” connectivity protocol on top of TCP/IP. It allows extremely lightweight publish/subscribe messaging transport. In order to make your device communicating you need to connect to an MQTT broker. For testing purposes you can use an on-line broker like: HiveMQ
A better solution is to choose a broker and to install it on a local machine (i.e. a Raspberry PI). The most widely used at the moment of writing is Eclipse - Mosquitto
Chips use MQTT protocol for communication. Herewith a link to the library which is the best and most wideley used so far.
In order to easily manage your "things" you should have a platform able to perform automation and give you control and visibility of your devices. My choice is Home Assistant (HA) integrated together with Node-Red (NR). If you choose to install HA operating system (Hass.IO) then it will be very easy to install mosquitto and NR on the very same machine (preferred a RaspberryPi3) that will be your HUB for the "things". To bond HA together with NODE-RED it is very easy to use specific nodes, available in NR via NPM installation node-red-contrib-home-assistant A docker installation for Node-RED inside HASS.io distribution is available here: notoriusBDG - hassio-addons - node-red
With ACTUATORS we consider all the devices that perform action FROM the microcontroller to the real world (OUTPUTs). Actuators (LEDs, relays, buzzer, etc...) communicate with Home Assistant standard naming which means:
If different it will be written in description
Every time a state of an actuator changes (via MQTT or via phisical control) the MCU notifies it communicating the very same payload he recieved (if it recieved that from an MQTT communication). If you want to use it in Home assistant you should use "optimistic: FALSE". the criteria is the following (use camelCase):
External libraries and dependencies resources can be found inline in the code.