HARDWARE
Hardware and setup for flashing is described in the following article:
FIRMWARE FEATURES
- Control over MQTT broker.
- State-report contains additional information of switches state – server gets informed if any of switches is actually pressed by user or not.
- On ESP a Light-Sleep mode is activated, which allows to reduce consumption from 0.8w to 0.5w, without any side-effects on switches reaction.
- Might be configured with some settings. It’s possible to swap switches and relays.
- It’s possible to adjust configuration without necessaty to uninstall and reflash module.
WORKING MODES
- LED blinks – module is in configuration mode. At this moment open WiFi hotspot “Detritus-xxxxx” is enabled. Configuration page can be accessed at IP 192.168.4.1. Or, if network connection isn’t lost, it’s possible to access configuration page at local IP address.
- LED is on – module is in fully operating mode.
OPERATION CONTROLS
- Has two operating modes: each manual switch state change triggers relay state change; or manual switch turn on/off light only if it moved to appropriate position.
- Enter configuration mode: quickly press some switch 5 or more times.
CONFIGURATION

- SSID, password – WiFi network connection.
- mqtt server, port, client name, user, password – connection to MQTT broker. Note: Client name must be unique! This name also used for Access Point name, and as a Hostname.
- mqtt output topic 1 – topic for output of relay 1 current state. Value is 0/1 for off/on states. Additionally contains a manual switch state by providing a dot in the end.
Examples:
‘0.’ – relay is off, appropriate switch is pressed.
‘1’ – relay is on, appropriate switch released.
‘1.’ – relay is on, appropriate switch pressed. - mqtt commands 1 topic – topic for relay L1 commands input.
- mqtt output topic 2 – topic for output of relay L2 current state.
- mqtt commands 2 topic – topic for relay L2 commands input.
- swap relays – when checked, swaps manual switches for relays (S1 controls L2, S2 controls L1).
- respect switch states – when disabled, each manual switch state change triggers relay state change. When enabled – pressing manual switch, turns on relay. If relay already was on, then does nothing.
- invert switch keys – inverts manual switch logic (also makes effect on mqtt output of ‘.’ symbol).
CONTROL COMMANDS
1– turn on appropriate relay (closes).0– turn off appropriate relay (opens).set– enter configuration mode. Analogue pressing ‘Pairing button’ or quick switch on-off more than 5 times.
Sources
See GitHub: https://github.com/ai91/detritus
Note that it uses development branch of WiFiManager. This branch can start wifi-manager in non-blocking mode. In this mode the module remains fully operable and can be controlled with manual switches (for example if network wasn’t configured properly). Master-branch still doesn’t support this mode.
More
There is also a configuration example of MajorDoMo server (unfortunately in Russian only):


