Access types - write on MQTT topic publish

Hi all,

I have two scenarios that I would like to use a unique write access type for.
The first is at MQTT topic that publishes a 1 followed by a 0 shortly afterwards. Once I see this value change from 0 - 1 I would like to send some MQTT data back to the broker.
I have tried to configure the write as shown in the screen shot attached.

The second is another MQTT topic that publishes a timestamp as a string. Once this changes value I would like to trigger a write for some data to be sent to my plc. image of setup attached.

Can anyone please tell me where I am going wrong?

Thanks, Bob


MqttTimestampChange

Hi Bob,

In both cases you can use the following logic:

You can use the fields “ReadCompleted” and “WriteCompleted”, once the Device Read or Write the “tag.trigger” will go 0 - 1 or 1 - 0. From that you can create a tag and set the same trigger to activate a Task, which will contain a code to send data back to the PLC. Inside of this task you can do a code to verify if the last value is the same as the current value.

image

Best Regards,
Tatsoft Team.

1 Like