coffee-bin-mqtt

Documentation Status

MQTT sensor project for CoffeeBin.

Features

  • It uses deep sleep ,ode to save energy.
  • It messures the volatage on bootup an send the result as MQTT message to the broker.
  • It has an external status LED
  • It has an switch to broadcast an MQTT message, that the coffe machine is in maintenance mode.

Hardware

  • ESP8266 ESP12F
    • Flash Size: 32 Mbit
    • Flash Mode: DIO
    • Flash Speed: 40 MHz
  • LED
  • Switch
  • Voltage sensor

Development

Preparation

Install the USB driver for your ESP8266 and find out on which port your device is avaible. For convinience you can save that information in your ~/.bashrc or ~/.bash_profile file.

If you don’t wanna do that, you have to add the port to each command.

mos --port /dev/cu.SLAB_USBtoUART COMMAND

Build

You need to install Docker to build it locally.

git clone https://github.com/vergissberlin/coffee-bin-mqtt
cd coffee-bin-mqtt
mos build --platform ESP8266 --local --verbose
mos flash --esp-erase-chip --esp-baud-rate 115200 --esp-flash-params "dio,4m,40m"

Debugging and configuration

mos wifi --port /dev/cu.SLAB_USBtoUART WIFI-SSID WIFI-PASSWORD
mos console --port /dev/cu.SLAB_USBtoUART

Upload files

mos put --port /dev/cu.SLAB_USBtoUART fs/init.js

Requirements

Software
  • Web browser on Linux, MacOS or Windows
  • USB adapter driver (/dev/cu.wchusbserial14610)
  • MongooseOS

Configuration

Tip

You can enable RPC to configure and controll your device over WiFi.

config9.json
{
"device": {
    "id": "esp8266_XXXXX"
},
"mqtt": {
    "enable": false,
    "server": "io.adafruit.com:1883",
    "user": "USERNAME",
    "pass": "PASSWORD"
},
"aws": {
    "thing_name": "esp8266_XXXXX"
},
"wifi": {
    "ap": {
        "enable": false
    },
    "sta": {
        "enable": true,
        "ssid": "WIFI_SSID",
        "pass": "WIFI_PASSWORD"
        }
    }
}

Contribute

Pull requests

If you are interested to improve the code, fee free to 1. Make a fork 2. make your changes 3. Create a pull request.

Bug reports

If you find a bug and don’t know how to fix it, than your bug report is also welcome! Try to describe the problem very detailed.