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

Sorry, I think I got myself in a muddle!

To summarize and provide some context:

  • Gladys is installed at my place, on a Raspberry Pi and is not exposed or accessible on the internet.
  • I don’t have a Gladys Plus subscription yet, so no access to Gladys live from the internet.
  • Need: To define myself as « present » when my phone is on Wi-Fi only.

Procedure:

  • I use presence publisher for Android, which allows, once connected to Wi-Fi at home, to send MQTT messages to Gladys.
  • In Gladys, under « MQTT », I create a new device of type « presence » with values « 1 » and « 0 » (no choice but to use numbers).
  • Presence detection: In a scene, the « Device state change » block on the MQTT device linked to what my application sends, allows me to mark myself as present.
  • Absence detection: In another scene, I mark myself as absent when the signal is more than 15 minutes old. For this, the « Check presence » block over the last 15 minutes allows me to mark myself as absent when the signal is no longer received.

Warning: by default, the application sends « online » and not « 1 » to Gladys. Once I modified the parameter in the Android application, the scenes are functional as expected (before I thought it was 1 and 0).

Tip: I wanted the application to send messages without giving it access to the GPS and keep my GPS always on (necessary to allow it to know the Wi-Fi SSID).
I use what the application calls « Absence messages » to notify Gladys that I am home on Wi-Fi (logical :sweat_smile:). Knowing that Gladys marks me as present when it has messages and absent when it has nothing, it works as I want!

For this:

  1. Deny GPS permission (location)
  2. In « conditions », enable « Send without Wi-Fi »
  3. In the « None of the above matches » section, enable « Send absence message » and modify the « Absence message » value to « 1 ».