Reset variables without connection

Hi everyone,
how can i reset the variables data into specified asset when the mqtt agent is not connected?
Example: if MQTT is connected he set the bool variable on TRUE, and if the connection is down he has to change back to FALSE.
I’ve checked inside When/Then and Flow Rules but still haven’t found nothing

Thanks to All!!

Hi,

at first, welcome to the forum.

As our MQTT Broker uses the standard protocols, you can use the last will message for this.

Hi Denis,
thanks for you responde, there is a way to do on openremote? I can’t change the config on my MQTT device so the only options is on the IoT Portal

Thanks

Hi DPS,

We have a nice new feature for that.
On the users page, go to your service user and you will see that there is an active MQTT connection. You can use that state - if the user has an active connection - on an asset attribute.

  1. Add a boolean attribute to represent the MQTT connection status
  2. Add the configuration item ‘user connected’ to that attribute
  3. Fill in the service users username
  4. Save the asset

If you also give this attribute rule state, you can use it in rules to trigger other actions.

Don

Hi Don,
i’ve done as u explained but the bool variables won’t come true.

This is the setup, at the top the bool var and in the bottom the user config:

In the panel named “MQTT sessions” below the user details, do you see an active connection?

yes, solved using Last Will.
We’ve configured a bool var witch stay true if the mqtt is connected or it will become false.
Using the When/Then rule i reset all the variables

1 Like

Fine you solved it, the lastWill is a essential feature.

can You please show us how you did it