Skip to content

Commit

Permalink
FB_OUTPUT_COVER_MQTT: adding 'closing', 'opening' and 'stopped' messa…
Browse files Browse the repository at this point in the history
…ges (#159)
  • Loading branch information
MichielVanwelsenaere authored Oct 16, 2024
1 parent d95bcf3 commit 162bc90
Show file tree
Hide file tree
Showing 14 changed files with 621 additions and 262 deletions.
2 changes: 1 addition & 1 deletion docs/FAQ/Howto_adding_a_new_MQTT_subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ A more in depth implementation can be found in the *InitMqtt* method of every MQ
Data : SD_MQTT.CALLBACK_DATA;
END_VAR
```
- Add logic to process the received MQTT message: in this reference project a check is executed if the subscription that triggered the callback method matches the subscription configured in the *MqttInit* method. In that method the subscription topic is automatically concatinated with the function block name. For more in depth details study the *PublishReceived* and *MqttInit* methods of every MQTT function block in the reference project.
- Add logic to process the received MQTT message: in this reference project a check is executed if the subscription that triggered the callback method matches the subscription configured in the *MqttInit* method. In that method the subscription topic is automatically concatenated with the function block name. For more in depth details study the *PublishReceived* and *MqttInit* methods of every MQTT function block in the reference project.


2 changes: 1 addition & 1 deletion docs/FunctionBlocks/FB_OUTPUT_BINARY_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Requires method call `InitMQTT` to enable MQTT capabilities.
|:-------------|:------------------|:------------------|:------------------|:--------------------------|:--------------------------|
| **Output changes: OUT** | A change is detected on output `OUT`. | `TRUE/FALSE` | 2 | `TRUE` | yes

MQTT publish topic is a concatination of the publish prefix and the function block name.
MQTT publish topic is a concatenation of the publish prefix and the function block name.

### **MQTT subscribe behavior**
Requires method call `InitMQTT` to enable MQTT capabilities.
Expand Down
6 changes: 5 additions & 1 deletion docs/FunctionBlocks/FB_OUTPUT_COVER_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ Requires method call `InitMQTT` to enable MQTT capabilities.
| Event | Description | MQTT payload | QoS | Retain flag | Published on startup |
| :---------------------- | :------------------------------------ | :----------- | :----------------------------------- | :---------- | :------------------- |
| **Cover reaches position** | Cover reaches a open or closed position | `OPEN` or `CLOSED` | 2 | `TRUE` | no |
| Event | Description | MQTT payload | QoS | Retain flag | Published on startup |
| :---------------------- | :------------------------------------ | :----------- | :----------------------------------- | :---------- | :------------------- |
| **Cover moves** | Cover moves | `OPENING` or `CLOSING` | 2 | `TRUE` | no |
| **Cover stops** | Cover stopped moving without reaching fully open or closed position | `STOPPED` | 2 | `TRUE` | no |

MQTT publish topic is a concatination of the publish prefix and the function block name.
MQTT publish topic is a concatenation of the publish prefix and the function block name.

### **MQTT subscribe behavior**

Expand Down
4 changes: 2 additions & 2 deletions docs/FunctionBlocks/FB_RS485_DUCO_DUCOBOX_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Requires method call `InitMQTT` to enable MQTT capabilities.
|:-------------|:------------------|:------------------|:------------------|:--------------------------|:--------------------------|
| **register is polled** | a modbus register is polled | int value | 2 | `FALSE` | no

MQTT publish topic is a concatination of the publish prefix and the function block name, the node numer and a register number. For example:
MQTT publish topic is a concatenation of the publish prefix and the function block name, the node numer and a register number. For example:

`Devices/PLC/House/Out/RS485/FB_RS485_DUCO_DUCOBOX_MQTT/1/read/0`

Expand All @@ -50,7 +50,7 @@ Commands are executed by the FB if the topic `MQTTSubscribeTopic` matches the MQ

MQTT subscription topic is a concatenation of the subscribe prefix variable, function block name, node number and register number. For example, topic `Devices/PLC/House/In/RS485/FB_RS485_DUCO_DUCOBOX_MQTT/1/write/0` with payload `30` will set the 'Target value (%)' parameter for node 1 (which in this case represents the entire system). Go through the DUCO modbus register documentation linked above for a deeper understanding.

Upon a succesfull write operation the received payload will be published on the 'Out' topic. Continuing with the example above this will result in a payload `30` to be published on topic `Devices/PLC/House/Out/RS485/FB_RS485_DUCO_DUCOBOX_MQTT/1/write/0`.
Upon a successful write operation the received payload will be published on the 'Out' topic. Continuing with the example above this will result in a payload `30` to be published on topic `Devices/PLC/House/Out/RS485/FB_RS485_DUCO_DUCOBOX_MQTT/1/write/0`.

### **Code example**

Expand Down
2 changes: 1 addition & 1 deletion docs/FunctionBlocks/FB_RS485_EASTRON_SDM220_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Requires method call `InitMQTT` to enable MQTT capabilities.
|:-------------|:------------------|:------------------|:------------------|:--------------------------|:--------------------------|
| **output is updated** | the output is updated. | real value | 2 | `FALSE` | no

MQTT publish topic is a concatination of the publish prefix and the function block name and a unique value:
MQTT publish topic is a concatenation of the publish prefix and the function block name and a unique value:
| output | MQTT topc suffic | Unit |
|:-------------|:------------------|:------------------|
| VOLTAGE | `/VOLT` | Volts
Expand Down
2 changes: 1 addition & 1 deletion docs/FunctionBlocks/FB_RS485_EASTRON_SDM_POWER_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Requires method call `InitMQTT` to enable MQTT capabilities.
|:-------------|:------------------|:------------------|:------------------|:--------------------------|:--------------------------|
| **output is updated** | the output is updated. | real value | 2 | `FALSE` | no

MQTT publish topic is a concatination of the publish prefix and the function block name and a unique value:
MQTT publish topic is a concatenation of the publish prefix and the function block name and a unique value:
| output | MQTT topc suffic | Unit |
|:-------------|:------------------|:------------------|
| ACTIVEPOWER | `/ACTP` | Watts
Expand Down
4 changes: 2 additions & 2 deletions docs/FunctionBlocks/FB_RS485_ESERA_OWD_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ Requires method call `InitMQTT` to enable MQTT capabilities.
|:-------------|:------------------|:------------------|:------------------|:--------------------------|:--------------------------|
| **sensor data is received** | temperature, humidity, etc readings received. | real value | 2 | `FALSE` | no

MQTT publish topic is a concatination of the publish prefix and the function block name, the OWD numer and a unique sensor value. For example:
MQTT publish topic is a concatenation of the publish prefix and the function block name, the OWD number and a unique sensor value. For example:

`Devices/PLC/House/Out/RS485/FB_RS485_ESERA_1WIRE_GATEWAY_MQTT_HOME/OWD/1/TEMP`

Naturally `/TEMP` will only be ommited by the OWD if the physical sensor exposes it.
Naturally `/TEMP` will only be omitted by the OWD if the physical sensor exposes it.

| output | MQTT topc suffic | Unit |
|:-------------|:------------------|:------------------|
Expand Down
2 changes: 1 addition & 1 deletion docs/FunctionBlocks/FB_VIRTUAL_BOOL_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Requires method call `InitMQTT` to enable MQTT capabilities. Only applicable if
|:-------------|:------------------|:------------------|:------------------|:--------------------------|:--------------------------|
| **input changes: IN** | A change is detected on input `IN`. | `TRUE/FALSE` | configured in method call `InitMQTT` | configured in method call `InitMQTT` | configured in method call `InitMQTT`

MQTT publish topic is a concatination of the publish prefix and the function block name.
MQTT publish topic is a concatenation of the publish prefix and the function block name.

### **MQTT subscribe behavior**
Requires method call `InitMQTT` to enable MQTT capabilities. Only applicable is the function block is configured in input mode which will allow the input of a value to the PLC through MQTT which will be exposed on the function block `OUT` output.
Expand Down
2 changes: 1 addition & 1 deletion docs/FunctionBlocks/FB_VIRTUAL_INT_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Requires method call `InitMQTT` to enable MQTT capabilities. Only applicable if
|:-------------|:------------------|:------------------|:------------------|:--------------------------|:--------------------------|
| **input changes: IN** | A change is detected on input `IN`. | `TRUE/FALSE` | configured in method call `InitMQTT` | configured in method call `InitMQTT` | configured in method call `InitMQTT`

MQTT publish topic is a concatination of the publish prefix and the function block name.
MQTT publish topic is a concatenation of the publish prefix and the function block name.

### **MQTT subscribe behavior**
Requires method call `InitMQTT` to enable MQTT capabilities. Only applicable is the function block is configured in input mode which will allow the input of a value to the PLC through MQTT which will be exposed on the function block `OUT` output.
Expand Down
2 changes: 1 addition & 1 deletion docs/FunctionBlocks/FB_VIRTUAL_REAL_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Requires method call `InitMQTT` to enable MQTT capabilities. Only applicable if
|:-------------|:------------------|:------------------|:------------------|:--------------------------|:--------------------------|
| **input changes: IN** | A change is detected on input `IN`. | `TRUE/FALSE` | configured in method call `InitMQTT` | configured in method call `InitMQTT` | configured in method call `InitMQTT`

MQTT publish topic is a concatination of the publish prefix and the function block name.
MQTT publish topic is a concatenation of the publish prefix and the function block name.

### **MQTT subscribe behavior**
Requires method call `InitMQTT` to enable MQTT capabilities. Only applicable is the function block is configured in input mode which will allow the input of a value to the PLC through MQTT which will be exposed on the function block `OUT` output.
Expand Down
2 changes: 1 addition & 1 deletion docs/FunctionBlocks/FB_VIRTUAL_STRING_MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Requires method call `InitMQTT` to enable MQTT capabilities. Only applicable if
| :-------------------- | :---------------------------------- | :----------- | :----------------------------------- | :----------------------------------- | :----------------------------------- |
| **input changes: IN** | A change is detected on input `IN`. | `TRUE/FALSE` | configured in method call `InitMQTT` | configured in method call `InitMQTT` | configured in method call `InitMQTT` |

MQTT publish topic is a concatination of the publish prefix and the function block name.
MQTT publish topic is a concatenation of the publish prefix and the function block name.

### **MQTT subscribe behavior**

Expand Down
Loading

0 comments on commit 162bc90

Please sign in to comment.