MQTT Plug-in Help
- Overview
- Supported MQTT Topics
- Configuring Devices
- Responding to External Device State Changes
- Controlling Devices
- Acknowledgements
Overview
The MQTT Client Plug-in provides a client interface to MQTT for HomeVision. Its main purposes are to control MQTT enabled devices via the HomeVision Schedule or NetIO and to control HomeVision internal objects (X-10, Flags, etc.) by MQTT sources.
Note: To perform actions on internal objects, this plug-in uses the Actions Plug-in. The Actions Plug-in must be enabled to control internal objects.
While the client plug-in is designed to work easily with Tasmota based devices, using a similar topic structure, other devices that follow different topic structures likely can be accommodated as well. There is a lot of flexibility in the plug-in allowing support for many different situations.
The MQTT interface has three distinct functions:
- For "external" MQTT-enabled devices (e.g., Sonoff switches with Tasmota SW), the MQTT Plug-in acts as an MQTT controller. The plug-in PUBLISHES command topics to these devices to control them and SUBSCRIBES to status topics from these devices to track their state changes. Changes are tracked by Actions such as setting Flags or Variables and running Macros based on that status.
- For "internal" objects defined in HomeVision (such as X-10 modules, flags, inputs, etc.), the MQTT Plug-in acts as a "proxy" for them, essentially making them appear to be MQTT-enabled. For each selected object, the plug-in SUBSCRIBES to a command topic so it can be controlled and PUBLISHES a status topic when it changes state.
- Generic MQTT topics can be sent from the HomeVision schedule via serial commands, from NetIO, or from custom plug-ins, independent of any configured devices.
The way the MQTT plug-in handles internal objects and external devices can be confusing. In fact, from an MQTT perspective, both internal objects and external devices are handled the same. They are both controlled by command (cmnd) topics and report status via status (stat) topics.
Internal devices are “embedded” in HomeVision. So, from the MQTT perspective, they are controlled (via MQTT) with an incoming cmnd message, and they will report their status via an outgoing stat message. But that’s exactly the same as an external device: control them (via MQTT) with a cmnd message, and they will report their status via a stat message.
A cmnd message is used to control an internal object or external device; a stat message is used to track an internal object’s or external device’s state.
A confusing part is that the FLOW of cmnd/stat messages with respect to the MQTT plug-in is reversed for the two types, simply because of where they reside in the architecture of the system.
Another confusing part is that for external devices, it may be desirable for Homevision to do something when it reports its status. Hence the plug-in responds to stat status topics. This looks a lot like it is doing a cmnd type of work, but in fact it is no different from any other home automation system. It is just “responding” to the external device’s change in status.
For example, suppose there is an external light switch (like a Tasmotized Sonoff wall switch), and both HomeVision and Home Assistant. When that switch is turned on, it reports that fact with a stat message, and both systems may respond: HomeVision may take an action, like running a macro, and Home Assistant may show the light is on in the GUI, or even run an automation.
Supported MQTT Topics
Standard and Custom Topics
Topics can be assigned to devices either as abbreviated topics (called “Standard” topics in this help) or full topics.
Standard topics follow the Tasmota structure, so only the unique sub-topic portion need be entered. Default standard topics are indicated by enclosing the sub-topic with “<” and “>”.
If a topic starts with a “<”, the appropriate prefix is automatically added.
If a topic ends with a “>”, the appropriate postfix is automatically added.
A “>” may be followed by optional index digits.
Prefixes and postfixes are defined in the Settings Tab.
Most of the examples to follow assume use of the defaults.
To provide additional flexibility in defining a system’s topic structure, standard topics can have the prefix and postfix indicators in any position relative to the sub-topic.
The following are possible (where “T” is the sub-topic):
Template Example <T> cmnd/T/POWER --> Tasmota and MQTT Plug-in default T<> T/cmnd/POWER <>T cmnd/POWER/T >T< POWER/T/cmnd T>< T/POWER/cmnd ><T POWER/cmnd/T
To accommodate certain Tasmota devices that have multiple relays or switches, one or more digits can follow the “>” postfix index to specify the relay or switch. For example, an external device of this type that sends out state reports like this:
stat/FloorLamp/POWER2 ON
should be set up with this topic structure:
<FloorLamp>2
Devices that send out reports for several “relays” should have separate entries in the Ext Devices Tab for each “relay”.
Note 1:
While Tasmota indices are in the range of “1” through “32”,
the plug-in allows any number of digits.
When using one of the templates where the topic follows a postfix with a relay index, care should be taken to avoid topics that start with a number, as the plug-in won’t be able to tell where the index ends and the topic begins.
Note 2:
Tasmota considers “POWER1” and “POWER” as the same and interchangeable.
However, the plug-in treats them as different, meaning “POWER” won’t match a full topic containing “POWER1”.
If a topic has only a “<” OR a “>”, then only the appropriate
prefix OR postfix is automatically added.
Otherwise, the topic is used as-is without any additional portions prepended/appended to it.
Thus by not putting “<” and “>” in a topic,
any topic structure can be used.
However, the plug-in does not have built-in processing when receiving MQTT topics that don’t follow the standard prefixes and postfixes. In these cases custom procedures need to be provided. See Custom Processing of Received Messages.
Most of the examples in the rest of this Help follow the Tasmota standard.
Standard Command Topic
The following command topic is supported (using default prefixes and postfixes) with various payloads:
Full Topic Payload cmnd/topic/POWER ON cmnd/topic/POWER ON level cmnd/topic/POWER level cmnd/topic/POWER OFF cmnd/topic/POWER TOGGLE cmnd/topic/POWER empty or "?"**
topic is defined during device configuration.
Payloads are case-insensitive for incoming messages.
level is expressed as a percentage, 0-100.
For X-10 devices, it is converted to the next lower discrete level supported.
Any status message will report back the discrete level as a whole percentage, so it may not match exactly what was received.
** “?” for those external entities that don’t allow an empty payload.
The plug-in publishes command topics to external devices.
Usually, after receiving one of these commands, an external device will publish its state.
The plug-in receives this report by subscribing to the state topic. (See next.)
A command with an empty payload requests the device to publish its state without changing the state of the device.
HomeVision objects subscribe to command topics so that external entities can control them.
For a full list of Actions based on the received topic and payload, see
Object Actions.
Standard State Topic
For each external device, the plug-in subscribes to the following topic (assuming <topic> in the “Topic” field):
Full Topic Payload stat/topic/POWERx OFF/ON/ON level/level
When a POWER topic is received, the plug-in looks for a message of “on” or “off” and takes action according to the device’s settings in the Ext Devices Tab.
For a full list of Actions based on the received topic and payload, see
External Device Actions.
When an internal object changes state, the plug-in will publish a state message to indicate the object’s new state.
RESULT State Topic
Certain devices, i.e., those running Tasmota software, usually produce both at POWER state message and a RESULT state message with the POWER info in a JSON formatted payload.
In fact, RESULT state messages can be sent from the device when many other actions occur.
To receive such messages, they must explicitly be entered as a device in the Ext Devices Tab with a custom command defined to process the message.
Topic Payload stat/topic/RESULT a JSON string
Last Will and Testament Topic
For each external device with a standard topic that has “Subscribe to Last Will and Testament” checked, the plug-in automatically subscribes to a Last Will and Testament topic as follows:
Full Topic tele/topic/LWT
If received, the plug-in looks for a message of “online” or “offline” and attempt to display this message in the Ext Devices Tab.
In fact, for standard topics, the exact LWT subscription will be as defined in the device’s “topic” field, where “tele” is the prefix (<) and “LWT” is the postfix (>).
If the topic is not in the form of a standard topic,
the “Subscribe to Last Will and Testament” checkbox has no effect.
LWT is not supported for internal objects.
Special “homevision” Topic
The MQTT Plug-in automatically subscribes to:
Full Topic cmnd/homevision/#
When a message is received in the form:
Full Topic Payload cmnd/homevision/object_type/POWER empty or "?" cmnd/homevision/POWER empty or "?"
for each defined object matching object_type
(one of
x10, light, var, flag, hvac, temp, analog, timer, input or output)
or for all of these object types if not specified, the plug-in will publish a state message for each object to indicate its current state.
Only those objects specified in the Int Objects Tab are reported.
Macros, Scheduled Events, Periodic Events and IR are never reported as they have no “state”.
This feature can be used by an MQTT entity to quickly sync up with HomeVision object states.
When a message is received in the form:
Full Topic Payload cmnd/homevision/action trigger string
the MQTT Plug-in will execute the trigger string. See Homevision Action Topic for details.
Special Counting Payload
The MQTT Plug-in has special handling to provide a “counting” feature.
Certain MQTT messages will increment selected variable(s) each time the message is received. To activate this feature,
create either an external device or internal object with either one or two variables selected.
Then, in the “Count Payload Text” of the Settings Tab, enter the text that will indicate “Count”.
For external devices, receiving a “stat” or “tele” “POWER” message that has its first word in the payload matching “Count Payload Text” will cause the selected variable(s) to increment.
For internal objects, a “cmnd” “Power” message will do the same.
For example, if “Count Payload Text” is set to “CYCLE”, and an internal object is created with Var-100 and Var-101 assigned to it but re-named “Watchdog”,
then when the following is received:
cmnd/Watchdog/POWER CYCLE
Var-100 and Var-101 are incremented.
Note: Other messages that would set variables assigned to this topic will continue to do so.
This can be used to advantage; sending a “cmnd” “POWER” message with a payload of “0” would “reset” the variables so subsequent “Count” messages would start from zero.
Configuring Devices
Ext Devices Tab
This tab contains a list of supported external devices. Device Name is the name of the device for use by serial and NetIO commands. It must be unique among both external and internal device names. See below for Name rules. Topic is the topic used for publishing and subscribing. See below for Topic rules.
- The Flag/Var column shows the Flag (FL-#) or Variable (VA-#) assigned to the device. If none is assigned, a "-" will show.
- The Macro column shows the Macro(s) assigned to the device in the form {on macro#}/{off macro#}. If no macro is assigned, a "-" will show.
- The State column will usually show "On" or "Off", depending on the reported state of the device. If the payload was a number, its value, potentially masked and/or truncated, will be displayed. When the state has not (yet) been reported, a "-" will show.
- For each device, its row will be displayed in RED text if the device is reported as "off line" by an LWT message. However, if an "on Line" LWT or a POWER state message is received, the row will display in BLACK text.
- Rows can be sorted in ascending or descending order by Device Name or Topic by clicking on the column header.
New/Edit/Delete External Devices
- To enter a new device, click the "New" button, and start with the Topic.
- Topics are case-sensitive!
- A "Standard" topic, for which prefix and postfix substitution is performed (see Settings Tab), is indicated by enclosing it in "<" and ">" (or one of the variations mentioned previously). E.g., "<topic>". This should be the default method for specifying topics. To help with this, a new device will have "<>" already inserted in the topic field. (Delete or modify as needed.)
- Topics can contain multiple levels, indicated by "/", but should not start or end with a "/".
- A topic with default processing of received messages should not contain "#" or "+" MQTT wildcards, since it is used both to subscribe and publish and wildcards are not allowed in published topics.
- A topic with custom processing of received messages MAY contain "#" or "+" MQTT wildcards, since it will only be subscribed to. Use of wildcards should adhere to the MQTT standards. However, care should be taken when using them. It's probably a bad idea to have "#" as a topic, as it will subscribe to EVERYTHING!
- Device Names, not topics, are used by NetIO and serial commands to publish commands to MQTT devices. If the topic is simple and descriptive, it can be copied to the Name field. If the topic is multi-level, Name must be simpler. Name cannot contain "<", ">", "/" or spaces. Alphanumeric and the underscore are the only allowed characters. Name cannot be "pub", "sub" or "unsub"; these are reserved keywords for sending generic MQTT messages.
- There is some validation of the Topic and Name fields to enforce the above rules and to avoid name duplication, but it may not be perfect.
- For each device, an HV Flag or Variable can be assigned.
Assigning a Flag or Variable is optional.
There is no checking to make sure a Flag or Variable is not used more than once.
- If a variable is selected, two additional options are available.
- "Use Variable as Flag" treats the variable as a flag with its value being either a "0" (off) or "1" (on). If a value is received instead of "on" or "off", if it is "odd" it represents "on" and if "even" it represents "off". The variable will be set to "0" or "1" accordingly.
- If "Use Variable as Flag" is NOT selected, then "Use Two Variables"
can be selected.
If it is, any value received in a stat message will be written to two variables as a 2-byte number. I.e., the LSB will be written to the specified Variable, and the MSB written to the specified Variable + 1.
If the option is not selected, the received value is written as a 1-byte number to the specified Variable.
Note: When "Use Variable as Flag" is not selected, Payloads with "on" or "off" do not cause any Actions, except for updating the "State" display.
- If a variable is selected, two additional options are available.
- Macros can be assigned for "On" and "Off" states. The same macro can be assigned to both states, or different macros can be assigned. A macro can be assigned to just one of the states, leaving the other set to "None".
- To have custom processing of received messages or triggers for this topic, select the appropriate mode and enter command/triggers. See Custom Processing of Received Messages for details.
- Check "Subscribe to Last Will and Testament" to subscribe standard topics to LWT. If the topic is not in the form of a standard topic, this selection has no effect.
- Choose whether to log MQTT messages sent or received by this device.
- Click "OK" to save edits, or "Cancel" to discard them.
- Devices can be edited by clicking the "Edit" button. This brings up the same window used for adding a new device.
- Use the "Delete" button to delete a device. When a device is deleted, the plug-in unsubscribes to any topics related to that device.
- When "Done" is clicked, devices with standard topics are subscribed to their state and LWT full topics. Devices with custom topics are subscribed only to the topic as-is. Click "Done" for changes to become effective!
Int Objects Tab
This tab contains a list of supported internal objects. These can be any of: X-10, Custom Lights, Flags, Variables, Inputs, Outputs, IR, Digital Temperature Sensors, Analog Inputs, Macros, Scheduled Event, Periodic Events, Timers or HVAC. Add only those objects that need to be visible to or acted on by the MQTT network.
- ID is the internal object ID. X-10 object IDs show with their A-P house/unit code format. Input and Output object IDs have an "I" or "O" prepended to their usual A-Q codes to distinguish them from X-10 ids. Other objects show using a "Fake" code of the first two letters of their standard HV object type name. For example, Custom Lights show as "LI".
- Object Name is the name of the object for use by serial and NetIO commands. It must be unique among both external and internal names. It can be the same as the topic, but cannot contain "<", ">", "/" or spaces. Alphanumeric and the underscore are the only allowed characters. Object Name cannot be "pub", "sub" or "unsub"; these are reserved keywords for sending generic MQTT messages. N.B.: HomeVision allows duplicate names among objects, so some modification to the suggested default names will be necessary to achieve uniqueness in the object lists.
- Topic is the topic used for publishing and subscribing. Topic rules are the same as external devices with default processing (i.e., no MQTT wildcards).
- The State column will show the reported state of the object. The auto reporting feature for objects must be turned on, or the HomeVision schedule must explicitly send updates for this to work. When the state has not (yet) been reported, a "-" may show. Variables always show a "-" for the state.
- Level shows the reported object level or value as appropriate. X-10 and Light objects show their level in percent, while Variables show their value.
- Rows can be sorted in ascending or descending order by ID, Object Name or Topic by clicking on the column header. When sorting by ID, object types are always grouped together and sorted within those groups by ID.
- At the bottom of the window, check the Object Type(s) desired. Checking object types here simply limits the Object drop-down list on the Configure New window to make it easier to find the object to configure. It doesn't affect any objects already configured.
New/Edit/Delete Internal Objects
- To enter a new object, Click the "New" button and start by selecting an object from the drop-down list.
Objects included in the list are those that have been checked in the
"Object Type List Enable" section of the Int Object Tab.
- If a variable is selected, two additional options are available.
- "Use Variable as Flag" treats the variable as a flag with its value being either a "0" (off) or "1" (on). If a value is received instead of "on" or "off", if it is "odd" it represents "on" and if "even" it represents "off". The variable will be set to "0" or "1" accordingly.
- If "Use Variable as Flag" is NOT selected, then "Use Two Variables" can be selected. If it is, any value received in a stat message will be written to two variables as a 2-byte number. I.e., the LSB will be written to the specified Variable, and the MSB written to the specified Variable + 1. If the option is not selected, the received value is written as a 1-byte number to the specified Variable.
- If an X-10 object is selected, then choose a Model. Model is used to determine how level changes are done.
- Clicking "Copy Object to Topic, Name" will populate the Topic and Name fields with an appropriate version of the object name.
Some validation is done on the Topic and Name fields; the "OK" button will be grayed out if either field fails validation.
The Topic and Name fields can be modified, keeping in mind the rules above for topics and object/device names.
More than one object can have the same topic. This allows a single incoming command to control several objects. However, note that if a single topic is assigned to multiple objects, when ANY of those objects changes state, the same status message is published so that any external client that might be subscribed to the status message won't be able to tell which object changed state.
An exception to this is if different index numbers are appended to the topic, in which case each will act and report independently. - Choose if object status messages should be sent with the "retained" flag set. The retain flag will cause most brokers to "remember" the status and send it to any client that later subscribes to the status topic.
- Choose whether to log MQTT messages sent or received by this device.
- If a variable is selected, two additional options are available.
- Objects can be edited by clicking the "Edit" button. This brings up the same window used for adding a new object.
- Use the "Delete" button to delete an object. When a object is deleted, the plug-in unsubscribes to any topics related to that device.
- When "Done" is clicked, objects with standard topics are subscribed to their command full topics. Objects with custom topics are subscribed only to the topic as-is. Click "Done" for changes to become effective!
Settings Tab
- Prefixes and Postfixes can be set for "standard" topics. The defaults conform to the Tasmota structure. They can be changed if necessary, but avoid Prefixes and Postfixes that have digits at the beginning or end.
- If desired, enter the "Count" payload text. Leave blank if not used.
- "MQTT Broker web/IP Address" defaults to "localhost" which should work if the MQTT broker is on the same (Linux) computer as HomeVisionXL. If it doesn't work, or the broker and HomeVisionXL are on different computers, change it to the MQTT broker's domain or explicit IP address.
- "MQTT Broker Port" defaults to "1883" and probably won't need to change.
- QOS values for Publish and Subscribe messages can be set for brokers that do not support the defaults of QOS 1 for Publish and QOS 2 for Subscribe.
- If a username and password is used to log into the broker, check the "Use Username/Password" box and then fill in the username and password.
- Select the type(s) of state responses desired.
Valid only for internal objects!
"Power" enables a standard response like this:
Full Topic Payload stat/topic/POWERx OFF/ON/ON level/level
“RESULT” enables a response like this, if “Dimming” is unchecked:
Full Topic Payload stat/topic/RESULT {"POWERx":"OFF"/"ON"/"ON level"/level}
or like this if “Dimming” is checked:
Full Topic Payload stat/topic/RESULT {"POWERx":"OFF"/"ON","Dimmer":level}
- Note: If set to "Response uses 0-100" (see next item), the POWER value will still be "OFF" if 0 and "ON" if otherwise.
One or both of "Power" or "RESULT" must be selected. If both are unchecked, "Power" will be re-selected automatically. "Dimming" has no effect if "Power" only is selected. - Select the format of device state responses for "stat" MQTT messages. Valid only for internal objects! Responses can be either the "OFF"/"ON"/"ON level" format or strictly "level", i.e., 0-100. Response format can be set separately for appliance modules (which normally would be best set to "OFF/ON") and all others (standard X-10, PCS, Custom Lights, etc.).
- If logging is desired, check "Create log file".
Doing so will display an entry box for the folder for the logs.
Log files will be created in this folder.
Enter the folder name directly, or click the "..." button to browse to or create it.
To keep file sizes to a reasonable length, a new file is created each day there is logging information.
The file name is "MQTTLogYYMMDD", with an extension determined by "Log File Extension".
If "Log File Extension" is empty, the file will have a ".txt" extension if HomeVisionXL is running in Windows,
and no extension if running in Linux.
- Only messages for devices/objects that have their "Log sent messages" or "Log received messages" options checked are logged. This includes messages sent via the "right-click" menu, serial or NetIO.
- "Subscribe" and "Unsubscribe" messages are not logged.
- Received messages to "cmnd/homevision/#" are always logged. However, responses to this command are determined by the affected objects' settings.
- "Netio string", "Serial string prefix string", and "Serial string terminator character(s)" are set to reasonable defaults and probably don't need to be changed, except in the rare case that they conflict with other plug-ins.
Pub/Sub Tab
The Pub/Sub Tab allows entry and publication of two topic/payload pairs and
entry and subscription to two topics.
It can be useful for testing or accessing/monitoring other devices.
Standard or custom topics are allowed.
(See Standard and Custom Topics for details.)
Subscription topics can make use of MQTT wildcards “#” and “+”.
No validation is done on topics.
If a topic is not formed correctly, it simply won’t work.
A payload is not required.
The unlabled checkbox before the “Publish” button sets the retain flag to 1 for the message.
It should rarely be needed.
The most useful reason for setting retain to 1 (checking the box) would be to clear a retained message in the broker.
Publishing a topic with a empty payload and retain set to 1 should clear any retained messages for that topic in the broker.
When receiving a message that matches one of the subscribed topics,
the topic and payload will appear in the Log sub-window (See below) and in the debug plug-in in blue text if the debug plug-in is enabled.
The “Unsubscribe” button will manually unsubscribe its associated topic.
Changing and Subscribing a topic entry after the previous entry was Subscribed
will result in the previous entry being automatically unsubscribed before the new one is subscribed.
When the MQTT Configuration window is closed, subscribed topics remain subscribed.
While obviously not showing up in the Log window, incoming subscribed messages will continue to show in the debug window, if enabled.
Each text entry field has a drop-down feature to access recent entries:
- The drop-down list shows (up to) the 8 most recent entries, in reverse order (newest first).
- In the Publish section, Topic and Payload entries are saved into their recent lists once the corresponding "Publish" button is clicked. In the Subscribe section, Topic entries are saved into their recent lists once the corresponding "Subscribe" or "Unsubscribe" buttons are clicked.
- Selecting an entry from the list moves it up to the first position.
- Manually typing an entry that is identical to one already in the list behaves the same as selecting that entry (i.e., moves it up to the first position).
-
The recent entry lists are saved when the MQTT Configuration window is closed (clicking "Done"), so they can be accessed again if the MQTT Configuration window is subsequently reopened.
However, if the MQTT plug-in is disabled then later re-enabled it, only the newest entry for each field is available, not the whole list.
Pub/Sub Log Area
The Log window of the Pub/Sub Tab shows results based on publishing and subscribing activity.
- Each of the four Pub/Sub actions are presented in different colors in both the Topic entry fields and the Log window. Publish lines in the Log window also have a gray background.
-
When a Publish button is pressed, that action is shown in the Log window with either "p1: " or "p2: " prepended to the topic and payload published.
When a Subscribe or Unsubscribe button is pressed, that action is shown in the Log window with either "s1: " or "s2: " prepended to the topic subscribed to.
When subsequent matching subscribed messages are received, they are shown as they arrive with the appropriate "s1: " or "s2: ". - If "Timestamp?" is checked, a timestamp is prepended according to the "Format". The default is "%d-%T", which translates to "dd-hh:mm:ss". Other formats are possible using the TCL "clock" formats here: https://www.tcl.tk/man/tcl8.6/TclCmd/clock.htm#M26
-
The log stores the most recent 250 lines. Use the scroll bar to view.
However, when a new line comes in, the section of the log being displayed may shift so that the most recent entry is visible.
If there are new entries coming in fast, it may not be possible to select and copy text before the selection scrolls out of the visible window. See next item. - Right clicking within the Log window will bring up a menu to "Select All", "Copy" selected lines to clipboard, "Clear" the entire log or "Freeze" or "Unfreeze" the view. "Freeze view" will stop the view from jumping to the new line so selection and copy or just viewing older entries can be done more easily. The log will continue to collect any new entries.
- A subset of lines can be selected by dragging the cursor through the desired text. Right clicking then "Copy" will put the selection on the clipboard.
- The log will continue to collect new entries while the MQTT Configuration window is open, even if you move to a different tab. Log information is deleted when the MQTT Configuration is closed (by clicking "Done").
Responding to External Device State Changes
Refer to External Device Actions for responses to received messages.
Note that an assigned Flag or Variable is always updated before the macro is run so the macro can take advantage of the new value.
Controlling Devices
Device/Object Display Area
Right-clicking on a line in the Device/Object Display Area will bring up a menu from which “On”, “Off”, “Toggle”, “State”, and “Set to” can be selected. For internal objects, one or more of these items may be grayed out if not appropriate for the object type.
For external devices, none are grayed out as there is no knowledge of the capabilities of the device. Some or all of these items may not work based on what the device can do (or not do).
When selected, for standard topics, the corresponding command topic is published. (See Standard Command Topics above).
For other non-standard topics, the right-click items may or may not make sense.
For external devices, this typically will make its way through the MQTT broker to the external device which would then act on the command.
For external device topics that are not standard, or at least missing the “<”, the topic will be published “as-is”, with the appropriate payload.
Since the plug-in will have subscribed to this topic, the message will be sent right back to the plug-in from the broker.
For internal objects,
the corresponding command topic is published in the same manner as external devices.
(Some object types “interpret” the selection depending on its capability. For example, clicking “On” for a flag translates to SET, while “Off” translates to CLEAR.)
No action is taken directly on the internal object.
Only a cmnd messages is sent out.
However, since the internal object has subscribed to the command topic,
the MQTT broker will send it right back to the plug-in,
which will then set the object to the requested state.
If the command topic causes an object state change, the plug-in completes the sequence by publishing a state topic showing the new state.
Here’s a sequence chart example that might make it more clear:
HomeVision Plug-in MQTT Broker Right-click X-10 object "Den" and click "Toggle": cmnd/den/POWER TOGGLE --> <-- cmnd/den/POWER TOGGLE <-- HV cmd to toggle Den sends X-10 cmd to toggle Den --> stat/den/POWER {value} -->
Serial Control
MQTT devices can be controlled within a schedule via serial commands which take one of these forms:
mqtt: {-log|-nolog -retain|-noretain} device_name/object_name command; - command is one of: [0|off|1|on|2|toggle|on {level}|state]. "state" requests status from device/object. - Logs and retains according to option(s) if present (overrides configuration settings); - Default: log and retain according to named device/object's config settings. mqtt: {-log|-nolog -retain|-noretain} pub topic {payload {retain}}; - logs and retains according to option(s) if present; - "-retain|-noretain" removes "retain as last word" restriction. I.e., payload can actually include "retain" as last word; - default: always logs and retains if last word is "retain". mqtt: {-log} [sub|unsub] topic <topic>|topic callback; - logs if option is present, never retains; - default: never logs, never retains. "mqtt:" is whatever the "Serial string prefix" is defined as. ";' is whatever the "Serial string terminator character(s)" is defined as.
Device/Object Form
This is the simplest form and can be used for any device or object alredy configured in the Ext Devices or Int Objects tabs.
For example, to toggle a device named “sonoff1”, the serial command would be:
mqtt: sonoff1 toggle;
X-10 and Custom Lights can be set to a level by using “on level”. E.g.,
mqtt: den on 50;
The device name is case-insensitive when matching a device name in the Device list.
The command portion is sent as-is, case-wise.
Note: Device names are limited to alphas, numbers and the underscore.
Note: While serial commands in the schedule can change the state of internal objects as well as external devices, it may make more sense to just set the internal object directly in the schedule.
In either case, the plug-in will publish a state change topic if the state actually changed.
Generic Form
In addition to the external and internal device/object specific MQTT messages,
the plug-in allows generic MQTT messages that may or may not be related to any configured device.
This gives freedom to send anything necessary without tying messages to specific configured devices.
For “pub” commands, if the last word in the payload is “retain”,
the command is sent with the MQTT retain flag set.
However, if either -retain or -noretain is present, it removes the “retain as last word” restriction.
I.e., payload can actually include and send “retain” as the last word.
Examples:
mqtt: pub "cmnd/living room/POWER" some payload info; logs; sends "some payload info" to "cmnd/living room/POWER"; no retain. mqtt: -nolog pub "cmnd/living room/POWER" some payload info; no log; sends "some payload info" to "cmnd/living room/POWER"; no retain. mqtt: pub "cmnd/living room/POWER" some payload info retain; logs; sends "some payload info" to "cmnd/living room/POWER"; retains. mqtt: -nolog -noretain pub "cmnd/living room/POWER" some payload info retain; no log; sends "some payload info retain" to "cmnd/living room/POWER"; no retain.
For sub and unsub commands, callback is a public callback procedure that must exist in a plug-in.
Examples:
mqtt: sub tele/somedevice/state mycb; mqtt: unsub tele/somedevice/state mycb;
Formatting Rules
- If a topic has spaces, the entire topic should be enclosed in double-quotes or braces {}.
- Double-quotes or braces are NOT necessary for any spaces in the payload portion.
- Backslashes in the payload portion should be "escaped" by another backslash (e.g., "\\").
NetIO
NOTE: While the NetIO application is no longer supported by its developers,
it still works and the NetIO plug-in may still be useful to those still using the app.
MQTT devices can be controlled via NetIO using a “netioaction” command in the NetIO application.
All forms of the serial commands are available for NetIO as well.
For example, to have a button set up to toggle a device named “sonoff1”,
the button’s sends attribute would be set to:
sends: netioaction mqtt sonoff1 toggle
“mqtt” is whatever the “Netio string” is defined as.
“toggle” or “2”, “on” or “1”, “off” or “0”, “on {level}” and “state” are allowed.
The device name is case-insensitive when matching a device name in the Device list.
The command portion is sent as-is, case-wise.
The state of the device can get retrieved by:
reads: get mqtt sonoff1
The get command will return the object’s state string, depending on the state of the device.
Note: This is a “convenience” command, since it actually just reads the state of the Flag or Variable associated with an external device,
or the state of an internal object.
For external devices, if no flag or variable are associated, an empty string is returned.
If the device’s state has not yet been reported, the last value of the Flag or Variable will be returned.
Also note that this command is essentially the same as the more direct gets:
reads: get var state var#
or
reads: get flag state flag#
or
reads: get x10 state id#
except that no NetIO Custom Returns processing is done.
So the direct object gets are probably better to use than the MQTT versions.
Generic MQTT messages can be sent via NetIO using a “netioaction” command in the NetIO application in a similar way as serial commands.
Examples:
sends: netioaction mqtt sub tele/somedevice/state mycb sends: netioaction mqtt unsub tele/somedevice/state mycb sends: netioaction mqtt pub {cmnd/living room/POWER} some payload info sends: netioaction mqtt pub {cmnd/living room/POWER} some payload info retain
Note: For NetIO, a topic with spaces must be enclosed by braces {}. Double-quotes are not allowed due to the way NetIO handles arguments of the netioaction command.
Custom Processing of Received Messages
Sometimes a topic may not fit the standard forms supported by the plug-in, or the actions taken (setting flags, variables and running macros) may not be powerful enough. There are four methods that provide more advanced processing, listed here in increasing independance from the MQTT Plug-in’s configuration:
- Triggers - Send trigger strings, defined in an external device's configuration, to HomeVisionXL and other plug-ins.
- Custom Commands - Create a plug-in and define a command, referenced in an external device's configuration, to run when a topic is received;
- Homevision Action Topics - Receive an MQTT command with a payload that contains a trigger string. No external device is needed.
- Independant Plug-ins - Relies on subscriptions in the plug-in instead of the "Custom Commands" method, where the MQTT Plug-in does the subscribing. Moves ALL activity into a plug-in so no external device is needed. See "mqttComm" section for details.
Triggers and Homevision Action Topics are relatively simple to construct.
Custom Commands and Independant Plug-ins require some knowladge of the TCL programming language.
Triggers
Triggers are a way to get a little more processing power without coding.
Works well for sequential actions that don’t require decision making.
Instead of a command procedure, enter serial trigger strings to perform actions. A serial trigger string can be one or more “built-in” HomeVisionXL strings and/or serial strings supported by existing plug-ins.
Note: Like “Command”,
the “Flag/Var”, “On Macro” and “Off Macro” fields are ignored.
However, use the action command in trigger(s)
to manipulate flags, vars, macros, etc..
To use Triggers, select “Trigger”.
Once selected, the “Topic Type” options are available.
Selecting “Standard” is used with standard topics
(generally, those of the form <topic>),
so “stat” messages with payloads of “on”, “off”,”on {level}” and “{level}” are available.
If “All” is selected, then only one trigger entry is provided, and this is run regardless of the payload.
If “On/Off” is selected, there are separate entries for the “on” and “off” states. However, one of the two fields can be empty, which means that nothing will happen for messages received with that state.
A payload of “0” or “on 0” implies “off”.
Selecting “Custom” should be used for topics that don’t adhere to the “standard” topic model, and hence can’t be guaranteed an “on/off” payload.
Only one trigger entry is available and is run regardless of the payload contents.
The following special character strings will cause substitutions for every occurrence in a trigger string(s).
(Note: %X, %P, %E, %L don’t make sense for “Custom” trigger strings, but, if used, will result in a “0” being substituted.)
- %X Substitute a received 0-100 level scaled to 0-16 (standard X10).
- %P Substitute a received 0-100 level scaled to 0-31 (Pcs).
- %E Substitute a received 0-100 level scaled to 0-63 (dirEct to level).
- %L Substitute a received 0-100 Level unscaled.
- %O Substitute the tOpic.
- %M Substitute the entire payload (Message) unmodified.
- %m Substitute the entire payload (message), substituting single quotes for double quotes.
- %D Substitute the current Date in the form YYYYMMDD.
- %T Substitute the current Time in the form HH:MM:SS.
Examples:
Play a sound file and run a program when the topic is received.
This example shows how two separate “built-in” triggers can work together in one trigger string.
(Assumes that the sound and program functions are working.)
Options: Custom. Trigger: Play wav file "alarm" Run program "sendtext"
Write a daily log file. (This may be redundant, as the MQTT Plug-in has logging capability in other forms, but shows what can be done.)
Options: Standard, All. Trigger: write to file "filename%D" "%T: %O:%M"
Write a daily log file, where the payload may have double quotes in it (i.e., a JSON string).
In that case, the double quotes must be converted to single quotes to avoid confusing the “write to file” processing.
Options: Standard, All. Trigger: write to file "filename%D" "%T: %O:%m"
The following examples require action plug-in version 1.3 or greater.
Turn on/off other lights to same level as triggering device.
Options: Standard, On/Off. On Trigger: action: x10 pcslevel c12 %P, x10 level a3 %X; Off Trigger: action: x10 off c12, x10 off a3;
Tune a TV to a channel using IR.
(Select cable input to TV, then tune a channel with a .5 second delay between digits.)
Options: Standard, On/Off. On Trigger: action: ir transmit 28 1,ir transmit 114 1,wait for 500,ir transmit 116 1; Off Trigger: {empty}
Tune a TV to a channel on a streaming service.
(Turn on TV, 0.5 second delay for TV to turn on, select streaming device input, then select streaming channel.)
This example shows how two separate plug-in triggers (action and roku) can work together in one trigger string.
Options: Standard, On/Off. On Trigger: action: ir transmit 2 1,wait for 500,ir transmit 26 1; roku: 13; Off Trigger: {empty}
Note: roku is a custom plug-in. See it Here.
Custom Commands
To have custom processing of received messages for a topic,
click “Command” and enter a procedure name in the “Command” field.
The procedure becomes the callback procedure for this topic.
Note: If “Command” is selected,
the “Flag/Var”, “On Macro” and “Off Macro” fields are ignored.
However, the action command can be used in the procedure to manipulate flags, vars, macros, etc..
Log settings are also ignored. Any logging should be done in the command procedure using the mqttLog command (See below).
CAUTION: There is little validation of the name of the custom procedure. Care should be taken to avoid any standard TCL procedure names as inadvertently using an existing procedure name may result in abnormal behavior!
The procedure must be defined in another enabled plug-in,
and must be made public via the hvPublic
command.
A plug-in can contain several different procedures that are called by different messages.
The procedure will be called like this:
procedure_name topic payload retain {other args}
For most procedures, retain can be ignored. {other args} may be present in future versions of the MQTT client
and likely not be important for typical procedures. For those interested, details of retain and any future other args can be found
here
Example:
Suppose we have a device (named BathHumidity) running Tasmota software with a AM2301 temperature/humidity sensor attached , and we want to turn on a ventilator fan (named BathFan) when the humidity gets high (>70) and turn it off when it is low (<55).
We would get periodic MQTT tele reports like this:
tele/BathHumidity/SENSOR { "Time":"2020-05-20T15:13:25", "Switch2":"OFF", "AM2301": { "Temperature": 75.0, "Humidity": 82.0 }, "TempUnit": "F" }
(The JSON payload is expanded here for readability.)
In the Ext Devices Tab, add an external device for the humidity sensor with a full topic of
tele/BathHumidity/SENSOR
The MQTT Plug-in will explicitly subscribe to this topic instead of the normal standard state topics.
Click “Command” and set the Command entry field to “humid”.
Click “OK” to save this entry.
Add another external device for the fan with a standard topic
<BathFan>
so that it will report status in the standard way, like this:
stat/BathFan/POWER ON
Click “Command” and set the Command entry field to “bathfan”.
Click “OK” to save this entry.
Click “Done” for changes to be effective!
Create a plug-in containing the following:
tcl::tm::path add [file dirname [info script]] package require json 1.0 hvImport mqttComm hvPublic humid proc humid {topic payload args} { global fanStatus if {$payload eq ""} return if {[catch {::json::json2dict $payload} status]} return set humidity [dict get $status AM2301 Humidity] if {$humidity > 70 && !$fanStatus} { mqttComm pub "cmnd/BathFan/POWER" on } if {$humidity < 55 && $fanStatus} { mqttComm pub "cmnd/BathFan/POWER" off } } hvPublic bathfan proc bathfan {topic payload args} { global fanStatus if {[lindex [split $topic "/"] end] eq "POWER"} { if {$payload eq "ON"} { set fanStatus 1 } elseif {$payload eq "OFF"} { set fanStatus 0 } } }
(See next Section for a description of mqttComm.)
Procedure humid is called whenever a humidity status message is received. It processes the JSON status message to get the humidity and turns the fan on or off depending on the humidity level.
Since we only care about the topic and payload, we can lump the rest into args and ignore that.
Procedure bathfan is called whenever a state message from the fan switch is received. It tracks the state of the fan so humid only turns the fan on/off if it is not already.
In reality, bathfan isn’t necessary, as turning on the fan while it is already on does no harm. It’s here mainly as an example of how to set up a command.
Homevision Action Topic
This Topic can be used to send a set of commands just like those allowed in an external device trigger. Since this method is not supported in Home Assistant’s MQTT discovery, it would need to be used in configuration.yaml or in a GUI-based construction, like a button.
However, it is powerful enough that, in some cases, using this method could eliminate the need for “virtual” external devices and the corresponding manual configuration.yaml changes if using Home Assistant!
For example, the previous external device trigger can be done like this:
Topic: cmnd/homevision/action Payload: action: ir transmit 2 1,wait for 500,ir transmit 26 1; roku: 13;
In response to an action command, the actions will be returned in a status message:
Topic: stat/homevision/action Payload: action: ir transmit 2 1,wait for 500,ir transmit 26 1; roku: 13;
This message may be returned before all the actions in the trigger are completed, especially if the trigger contains “waits”.
Trigger % substitutions are NOT performed on the payload using this method.
mqttComm - Sending/Receiving MQTT Messages from/to Another Plug-in
When total control for MQTT message processing is needed,
this method takes “Custom Commands” a step farther.
A plug-in can be essentially independent of processing that is done in the MQTT Plug-in, except for using it as a MQTT transport mechanism.
Other plug-ins can interface with the MQTT Plug-in via the mqttComm command.
The calling plug-in should import the command via:
hvImport mqttComm
The mqttComm command has the following formats:
mqttComm {-log} sub|unsub <topic>|topic callback mqttComm {-exactstat -nodim -log -retain} stat|cmnd <topic>|topic {payload} mqttComm {-log -retain} pub topic {payload}
- Note: In previous versions (< 1.76), "type", the name of the calling plug-in, was the first argument. This has been deprecated. However, for backward compatibility, new versions of the command will allow (and ignore) a "type" argument.
- -log: Log the command. This argument is optional.
- -retain: The sent message is retained by the broker. This argument is optional.
- -exactstat: Sends only a POWER stat response regardless of power/result settings.
- -nodim: Don't include Dimming in a RESULT response.
- topic: Can either be enclosed in "<>" (or any of the other standard forms) or not. If a standard form is used, MQTT's standard prefixes and the Power post-fix will be added to create a full topic. Otherwise, a topic with neither "<" nor ">" is used as-is, without adding the standard pre- and post-fixes, essentially creating generic MQTT messages. If the topic contains spaces, the topic along with any "<" or ">", should be enclosed in double-quotes.
- payload: The MQTT message payload to send and is valid only for "cmnd", "stat" and "pub" actions. Double-quotes or braces are NOT necessary for any spaces in the payload portion.
- callback: The name of a procedure in the calling plug-in that will process the subscribed-to incoming message and is valid only for "sub" and "unsub". See Callbacks with the "sub" form of mqttComm below for more details on callbacks.
A “stat” or “cmnd”, when used with a topic with neither “<” nor “>”, ignores the “stat” or “cmnd” and is the same as using “pub”.
A “pub” or “cmnd”, when used with a standard topic, is the same as using “cmnd”.
When the standard form is used with “sub” or “unsub”, a “cmnd” pre-fix is assumed.
To subscribe or unsubscribe to a “stat” type topic, use the topic without the “<”.
Example: To subscribe to a stat message:
mqttComm sub stat/uroom> cascallback
which will subscribe to
stat/uroom/POWER
with “cascallback” as the callback procedure.
Caution:
Make sure when subscribing to a topic that the topic is unique, especially compared to external devices and internal objects.
The MQTT client allows multiple, different callback procs to be assigned to the same topic (via different subscriptions) resulting in all of the procs being called when the common topic arrives.
This could be useful, but normally it will cause unexpected behavior.
For the MQTT client to successfully execute the callback procedure, an “hvPublic” command should be added to the plug-in. For example,
hvPublic cascallback proc cascallback {topic payload retain} { ... }
The mqttComm procedure returns an empty string if MQTT is not ready.
This can be used to trigger retries until MQTT is ready.
The mqttComm procedure returns 0 if the type, action or topic is missing or NULL,
or if there is no payload for a cmnd or stat command.
The mqttComm procedure returns 1 for a successful operation.
Examples:
mqttComm sub <uroom> cascallback subscribes to cmnd/uroom/POWER with callback cascallback mqttComm unsub stat/uroom/power mycallback unsubscribes to stat/uroom/power with callback mycallback mqttComm cmnd <uroom> on publishes cmnd/uroom/POWER on mqttComm stat <uroom> on publishes stat/uroom/POWER on and/or stat/uroom/RESULT {"POWER":"ON","Dimming":100} mqttComm -nodim stat <uroom> on publishes stat/uroom/POWER on and/or stat/uroom/RESULT {"POWER":"ON"} mqttComm -exactstat stat <uroom> on publishes stat/uroom/POWER on mqttComm stat "cmnd/room 2/state" on publishes cmnd/room 2/state on mqttComm pub "cmnd/room 2/state" on publishes cmnd/room 2/state on
Callbacks with the “sub” form of mqttComm
When something subscribes to a topic, the assumption is that some action should be taken when a message with that topic arrives. So how is that handled when a plug-in uses mqttComm to subscribe to a topic? This is where callbacks come in. When an incoming MQTT message arrives, the MQTT Plug-in will call the callback procedure associated with the previous subscription for that topic. It will be called like this:
callback fulltopic payload retain
- callback: The callback procedure name.
- fulltopic: The complete topic, as received, including any prefix or postfix.
- payload: The message payload.
- When a new subscription is made by a client, all retained messages that match the full topic are reported with retain set to 1. Any messages matching the full topic that are subsequently received by the broker are reported with a value of 0.
This is best explained by example.
Let’s assume a plug-in wants to subscribe to a topic:
mqttComm sub <uroom> cascb
This results in a subscription to
cmnd/uroom/POWER
When received, this topic means either report back the current device state (with an empty or “?” payload), or change the device state based on the payload. That means that when the MQTT Plug-in receives the message, it must communicate with the subscribing plug-in to complete the response. It does this by calling the callback procedure. Let’s say some external entity wants to know the state of uroom. When the MQTT Plug-in received the appropriate message, it calls the callback procedure like this:
cascb cmnd/uroom/POWER "?" 0
A procedure “cascb” must be defined and made public (via hvPublic cascb) in the calling plug-in to handle the message. In this case, it should eventually use another mqttComm command to send back status, maybe like this:
mqttComm stat <uroom> On 50 ---> stat/uroom/POWER ON 50
There are a couple of different approaches to handling subscribed topics. Which is better depends on the goals of the plug-in.
If the plug-in is going to handle a few very specific fulltopics,
a separate callback for each might be the best way to handle them.
If it needs to handle a number of very similar fulltopics, one callback that parses the fulltopic might be best.
Either approach will work.
Other Public Procedures Supplied/Called by the MQTT Plug-in
topicTemplate
To help with parsing full topics,
the MQTT Plug-in makes public a helper procedure that will split a full topic (the topic returned to the callback) into its parts and provide other info about the full topic.
The calling plug-in should import the command via:
hvImport topicTemplate
The topicTemplate command should be used like this:
set template {*}[topicTemplate topic]
- topic: fulltopic received by the callback.
- template will contain a dict with the following key/values:
Key(s) | Value |
---|---|
template | One of <T>, >T<, <>T, T<>, ><T, T><, <T, >T, T>, T<, T. |
pre pos | Prefix position 1-3, -1 if no prefix. |
pre type | Prefix string, "" if no prefix. |
topic pos | Sub-topic position 1-3 |
topic name | Sub-topic string |
topic type | "s" (standard: contains both < and >), "ns" (non-standard) otherwise. |
post pos | Postfix position 1-3, -1 if no postfix. |
post type | Postfix string, "" if no prefix. |
post ntype | Post type with "Relay" number striped off. |
post index | "Relay" number or "[0-9]*" if none, or "" if no postfix. |
match | Regexp expression to match the full topic. |
The resulting dict returned by topicTemplate can be used like this:
set template {*}[topicTemplate topic] set subtop [dict get $template topic name] set pre [dict get $template pre type] set post [dict get $template post type] if {$subtop ne "mytopic"} {return} if {$pre eq "cmnd"} { switch $post { "command_type_1" { ... } "command_type_2" { ... } ... } }
mqttLog
Puts an entry into the current MQTT log file.
The calling plug-in should import the command via:
hvImport mqttLog
The mqttLog command has the following format:
mqttLog string {color}
- string: String to log.
- color: If the "debug" is imported into the calling procedure, will also send the string to the debug plug-in in color, Default: red.
mqttReady
This procedure is defined by the using plug-in and is called by the MQTT Plug-in whenever it connects to or disconnects from the MQTT broker (and hence ready (or not) to take mqttComm calls).
It is used to detect transitions in MQTT status.
Using this procedure is only necessary to make sure the plug-in’s subscriptions are re-done automatically in the case the connection to the broker going down and then recovers (with a {state connected} return).
The using plug-in should make the command public via:
hvPublic mqttReady
When the MQTT connection changes, the MQTT Plug-in calls mqttReady like this:
mqttReady status
status is a dict of either {state connected} or {state disconnected reason reason}. Possible values for reason are:
0 Normal disconnect 1 Unacceptable protocol version 2 Identifier rejected 3 Server unavailable 4 Bad user name or password
Reasons “1”, “2”, and “4” are fatal and need to be corrected before a connection can be made.
To use, define a mqttReady procedure to respond to the connected and/or disconnected states.
mqttStatus
This procedure is provided by the MQTT Plug-in and returns current MQTT status. (Compare to mqttReady.)
Its use is to make sure MQTT is ready before subscribing to topics.
mqttStatus blank|state|session|reason|all
mqttStatus takes as an argument: “state”, “session”, “reason”, “all” or no arg - which defaults to “state”, the most likely arg to use.
If called with “All” as an argument, it returns a dict with the following keys:
- state
- The new connection state. Possible values are: "connected", or "disconnected". This item is always present in the returned dict.
- session
- Whether the broker has a session present for the client. The value will always be '0' for this version of MQTT.
- reason
- The reason for a disconnection or failed connection.
Possible values for reason are:
0 Normal disconnect 1 Unacceptable protocol version 2 Identifier rejected 3 Server unavailable 4 Bad user name or password
If called with “state”, “session”, “reason”, or no argument (default “state”), the procedure returns values as described above for that argument type.
mqttStatus and mqttReady Usage
Typical use:
hvImport debug hvPublic samplecb proc samplecb {topic payload retain} { # do something } hvImport mqttComm hvImport mqttStatus proc subscribe { {type sub} } { if {$type ni {sub unsub}} {return} if {[mqttStatus] ne "connected"} { debug "MQTT not connected" red # Try again after 5 seconds after 5000 subscribe return } # cancel any after command if got here via mqttReady after cancel subscribe # subscribe mqttComm $type <sample_topic> samplecb ... } hvPublic mqttReady proc mqttReady {status} { if {[dict get $status state] eq "connected"} { # Code to run when MQTT is ready. # Typically a "subscribe" or "init" procedure. subscribe } else { # Code to run when MQTT is not ready. } } hvEventHook ready [list subscribe sub] hvEventHook exit [list subscribe unsub]
A sample plug-in using mqttComm, mqttReady and mqttStatus that does its own subscribing and needs no entries in the MQTT Plug-in’s device lists can be downloaded from here.
MQTT Discovery for Home Assistant
Tips for Interfacing HomeVision with Home Assistant
How to Use the MQTT Plug-in’s Home-Assistant Auto Discovery
Acknowledgements
- The MQTT client, which provides the interface between the MQTT Plug-in and the MQTT network, was designed and provided by Schelte Bron.