MQTT - Allow integration of an external "device" (smartphone)

I don’t think this is possible at the moment, hence the creation of a feature request.

Need

Detect my presence and that of my wife at home.

Proposed Solution

I don’t particularly like Bluetooth key fobs, they take up a bit of space and my NUT seems to have given up quite quickly.

I found a simple Android application: Presence Publisher (Android).

The application allows you to register on an MQTT server to push events when the home WiFi is detected.
This allows me to detect my phone on the WiFi and easily and correctly identify myself.

I don’t currently see how I can do this.

  • Maybe the possibility of creating MQTT users in the service needs to be added?
  • Anything else?

Normally I think you can use the same identifier provided in Gladys to identify yourself on the MQTT server, you just need to use a client-id different from Gladys’s (which is random so it shouldn’t be a problem)

After that, I don’t exactly know what the message format and the topic this app publishes to are?

Are these the credentials provided in the configuration file? I think it’s encrypted, right?

No idea yet, I haven’t gotten to the connection part, so I haven’t delved into this point yet.

You’ve got the little eye to display the password

However, I don’t see how this can work if MQTT is not accessible from the outside, you will never be marked as away.

Here’s what it publishes:

Thanks for your answers!
I hadn’t thought of that actually, that I need to be able to indicate that I’m no longer there. :thinking:

For detecting my return home, it could work, I just need to find another way to detect when I’m no longer there, especially.

I’m just starting with these technologies, but wouldn’t it be possible to trigger someone’s absence when there’s no more « online » status update for, say, 15 minutes?

For info, I use it to manage my presence and my phone’s battery in Gladys.
And it works well.
In the MQTT service, I created a device in this format:

Then, on the presence publisher side,
I changed the presence value to 1 and the absence value to 0.
After that, I opened Gladys access, so I can access it even outside Wi-Fi.
But it shouldn’t be complicated for @pierre-gilles to create an API on the g+ side to set a value to 0 or 1 for a device or simply set absent or present when g+ receives the values via API?

Not very complicated :slight_smile: If there is demand for this kind of feature on Gladys Plus, I’ll add it without any problem :slight_smile:

+1 for the feature via Gladys +

Got it, I’ve created a « feature request »:

It’s a good idea and it’s not very complicated, I’ll check it out!

Got it, I’ve coded the new route on the Open API, it will be coming soon in a PR on Gladys :slight_smile:

The API call looks like this:

And in Gladys (and Gladys Plus), I now have the new value:

Of course, this feature can be used with any type of device, including a presence device!

The PR is ready:

I just merged the PR, it’s available on master!

I just launched a Docker dev build integrating the latest bug fixes, as well as this feature :slight_smile:

The production gateway was also re-deployed with this new feature :partying_face:

It’s live in Gladys v4.3.1 :slight_smile:

Hello everyone,

I’m new to Gladys, I’m taking the liberty to intervene on this post regarding the initial request for presence detection. In my current system (I won’t name it, but it runs on a PI4), I use Nut detection and also Ping detection for phones (the MAC address), which works perfectly well. Wouldn’t it be possible to do the same in Gladys, a module to ping IP or MAC addresses? I find it more practical than going through a third-party application.

Hello and welcome, your request has already been mentioned :wink:

The issue is that if the box reboots, you will change IP, and I no longer remember this discussion but there was also something that mentioned the MAC address changing as well… Read the discussion and you will be fixed

Hello!

From what we’ve discussed on several topics, this feature already works (I think @VonOx made a working PoC on Android)

Is it good on your side @lmilcent?

If so, can we close the feature request?

Yes, it works great, I just need to find some time for the documentation

I haven’t tested it yet, as I don’t have Gladys Plus, I connect to my instance at home via VPN. So it’s more restrictive, but I will think again about the subject for my particular case.