This Poly provides an interface between MQTT broker and Polyglot v2 server.
This thread on UDI forums has more details, ask questions there.
Note - your Sonoff MUST run the Sonoff-Tasmota firmware in order to work with MQTT!
-
You will need a MQTT broker running (can be on RPi running Polyglot).
- See post #1 in this thread on how to setup.
-
You will need to define the following custom parameters:
mqtt_server- defaults to 'localhost'mqtt_port- defaults to 1883, the example in the thread uses 1884mqtt_user- username for the MQTT brokermqtt_password- MQTT user's passworddevfile- Alternative todevlistoption below - use the yaml file instead, start withdevices:and then same syntaxdevlist- You will need to put a JSON list of all your Sonoff devices and topics they listen to, for example:[ {"id": "sonoff1", "type": "switch", "status_topic": "stat/sonoff1/POWER", "cmd_topic": "cmnd/sonoff1/power"}, {"id": "sonoff2", "type": "switch", "status_topic": "stat/sonoff2/POWER", "cmd_topic": "cmnd/sonoff2/power"} ]"id":ISY node ID - Can be anything you like, but ISY restricts to alphanumeric characters only and underline, no special characters, maximum 14 symbols."type":One of the following:- switch - For basic sonoff power switch.
- sensor - For nodemcu multisensor (see link in thread).
- flag - For your device to send a condition to ISY {OK,NOK,LO,HI,ERR,IN,OUT,UP,DOWN,TRIGGER,ON,OFF,---}
- TempHumid - For DHT21, DHT22, AM2301, AM2302, AM2321 sensors.
- Temp - For DS18B20 sensors.
- TempHumidPress - Supports the BME280 sensors.
- distance - Supports HC-SR04 Ultrasonic Sensor.
- analog - General purpose Analog input using onboard ADC.
- s31 - This is for the Sonoff S31 energy monitoring (use switch type for control).
- RGBW - Control for a micro-controlled RGBW strip http://github.com/sejgit/shelfstrip
- ifan - Sonoff iFan module - motor control, use switch as a separate device for light control
- shellyflood - Shelly Flood sensor; supports monitoring of temperature, water leak detection (
flood), battery level, and errors. - ratgdo - adds garage device based on the ratgdo board. use topic_prefix/device name for both status & command topics. see ratgdo site for more https://paulwieland.github.io/ratgdo/
"status_topic":- For switch this will be the cmnd topic (likecmnd/sonoff1/power), but on sensors this will be the telemetry topic (liketele/sonoff/SENSOR). For Shelly Floods, this will be an array, like[ "shellies/shellyflood-<unique-id>/sensor/temperature", "shellies/shellyflood-<unique-id>/sensor/flood" ](they usually also have abatteryanderrortopic that follow the same pattern)."cmd_topic":- Is always required, even if the type doesn't support it (like a sensor). Just enter a generic topic (cmnd/sensor/POWER).