Skip to content

Latest commit

 

History

History
149 lines (124 loc) · 5.67 KB

POLYGLOT_CONFIG.md

File metadata and controls

149 lines (124 loc) · 5.67 KB

MQTT Plug-In for Devices

license

This Plugin provides an interface between an MQTT broker and the Polyglot PG3 server.

This thread on UDI forums has more details, ask questions there.

MQTT Broker

If you are on PG3 or PG3X on eISY the broker is already running by default

If you are on Polisy or running Polyglot on an RPi, see post #1 in this thread on how to set up.

Custom Parameters

You will need to define the following custom parameters:

## ONE OF THE BELOW IS REQUIRED (see below for example of each)
devlist - JSON array, note format & space between '[' and '{'
    or
devfile - name of yaml file stored on EISY

## THESE ARE REQUIRED ONLY IF USING AN EXTERNAL SERVER OR YOU CHANGED LOCAL SETTINGS
mqtt_server   - (default = 'localhost')
mqtt_port     - (default = 1884)
mqtt_user     - (default = admin)
mqtt_password - (default = admin)

devlist example - JSON list of devices & status/command topics note format & space between '[' and '{'

[  {"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"}  ]

devfile example - YAML file stored on EISY of devices & topics

devices:
- id: "WemosA1"
  name: "Wemos A1"
  type: "analog"
  sensor_id: "A1"
  status_topic: "tele/Wemos32/SENSOR"
  cmd_topic: "cmnd/Wemos32/power"
- id: "WemosR2"
  name: "Wemos AR"
  type: "analog"
  sensor_id: "Range2"
  status_topic: "tele/Wemos32/SENSOR"
  cmd_topic: "cmnd/Wemos32/power"
- id: "WemosT1"
  name: "Wemos T1"
  type: "Temp"
  sensor_id: "DS18B20-1"
  status_topic: "tele/Wemos32/SENSOR"
  cmd_topic: "cmnd/Wemos32/power"
- id: "WemosT2"
  name: "Wemos T2"
  type: "Temp"
  sensor_id: "DS18B20-2"
  status_topic: "tele/Wemos32/SENSOR"
  cmd_topic: "cmnd/Wemos32/power"
- id: "WemosTH"
  name: "Wemos TH"
  type: "TempHumid"
  sensor_id: "AM2301"
  status_topic: "tele/Wemos32/SENSOR"
  cmd_topic: "cmnd/Wemos32/power"
- id: "WemosSW"
  name: "Wemos SW"
  type: "switch"
  status_topic: "stat/Wemos32/POWER"
  cmd_topic: "cmnd/Wemos32/power"

Note the topic (Wemos32) is the same for all sensors on the same device. The 'id' and 'name' can be different

"id":

ISY node ID - Can be anything you like, but ISY restricts to alphanumeric
characters only and underline, no special characters, maximum 14 characters

"type":

A device-type needs to be defined for by using of the following:

Tasmota-flashed CONTROL Devices:

  • switch - For basic sonoff or generic switch.
  • dimmer - Smart Wi-Fi Light Dimmer Switch, See Amazon. Use:
cmd_topic: "cmnd/topic/dimmer"
status_topic: "stat/topic/DIMMER"

(not .../power and ../POWER)

  • flag - For your device to send a condition to ISY {OK,NOK,LO,HI,ERR,IN,OUT,UP,DOWN,TRIGGER,ON,OFF,---}
  • ifan - Sonoff iFan module - motor control, use switch as a separate device for light control
  • s31 - This is for the Sonoff S31 energy monitoring (use switch type for control)

Tasmota-flashed SENSOR Devices:

If you are using 'types' in this section, you need to add this object to the configuration of the device: sensor_id: "sensor name" The 'sensor name' can be found by examining an MQTT message in the Web console of the Tasmota device

  • analog - General purpose Analog input using onboard ADC.
  • distance - Supports HC-SR04 Ultrasonic Sensor. (Todo: Needs tweaking to work with multiple sensors)
  • TempHumid - For AM2301, AM2302, AM2321, DHT21, DHT22 sensors.
  • Temp - For DS18B20 sensors.
  • TempHumidPress - Supports the BME280 sensors.

Non-Tasmota Devices:

  • RGBW - Control for a micro-controlled RGBW Strip
  • sensor - For nodemcu multi-sensor (see link in thread)
  • shellyflood - Shelly Flood sensor; supports monitoring of temperature, water leak detection (flood), battery level, and errors. Uses Shelly's MQTT mode, not Tasmota.
  • raw - simple str, int
  • ratgdo - adds garage device based on the ratgdo board; use topic_prefix/device name for both status & command topics. See ratgdo site

"status_topic":

  • For switch this will be the cmnd topic (like cmnd/sonoff1/POWER),
  • For sensors this will be the telemetry topic (like tele/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 a battery and error topic 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).