PaperUI - MQTT gateway - how to track a device status?

Hi,
I’ve upgraded to OH3 - but am still very much a newbie.

I’m using OH3 with an MQTT ethernet gateway to communicate with some Arduino nodes via mysensors.

I’ve created a ‘thing’ in OH3 for each node, and also channels for each of the nodes child sensors, so that i can update the ‘items’ in OH3. This is generally working well and the Arduinos are sending messages to OH3 items.

However, for the life of me I can’t figure out how to determine if a device is online or not.

When a node goes offline, OH3 still shows the ‘Thing’ as being online. Presumably i need some sort of rule to set the status of the ‘Thing’ to offline? However if that’s the case, i only want to do this if none of things channels have been updated for a period of time.

Is this possible to do in paperUI, or do i need to re-create the items in an .items file?

Apologies if this question has been asked before - I’m getting completely lost in the learning curve :confused:

B

Hi,
MQTT Devices usually send a Last Will Tag (LWT).
You can define the MQTT message and payload in the Things Dfefinition unter "Show more…
E.g. for Tasmota devices, you get a MQTT message like
“/%topic%/tele/LWT” and the payload “online” or “offline”.
Joerg

Unfortunately mysensors doesn’t do LWT.

The Online/Offline badge on the Thing isn’t the status of your device - it’s essentially just openHAB telling you that it can get through to the MQTT broker.

I’m not sure there is a way to get the status of a mysensors device without polling using a rule (or checking timestamps if your device sends a regular message). What mysensors devices have you got?

Note that in OH3 the UI is called MainUI. PaperUI has gone.

1 Like

If your sensors send periodic updates on at least one channel,you can use ‘expire’ feature to detect missed updates.

To further explain the situation the others have suggested

Create an item that will expire in the period of time

Create a rule that will trigger the item ON when anyone of your channels is updated and send an online message to MQTT LWT topic you want.

Create a rule when expire item changes to OFF that sends an offline message to LWT topic.

thank you all

hafniumzinc : I’m using a custom mysensor node that reads data from a Victron MPPT Solar Controller, and sends the data to the MQTT gateway, and then the item channels in OH3. I’m trying to to configure everything within the ‘mainUI’ if possible :slight_smile:

rossko57: I added the expire binding to the ‘items’ metadata in OH, and i think this will give me what i want. thank you. Its really helpful to set the items to UNDEF if they’ve not been updated :slight_smile:

denominator: this seems like a great way to setup a ‘proxy item’ ? however i am struggling to create a rule (using mainUI) which triggers when channels are updated - i think its the same issue as explained in this post… OH3 Can't add a Thing' trigger channel event to a rule - im not confident enough to use the snapshot though :confused:

Hmm, may be a terminology issue about what you’re really trying to do might be hindering you?

There is no way at all to trigger a rule from a channel state update. That’s okay, you link the channel to an Item and trigger your rule from Item updates.

Some channels do not generate state updates at all, but instead cause trigger events. These cannot be linked to Items, but you can trigger rules from the channel event.