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

**URL:** <https://community.gladysassistant.com/t/mqtt-permettre-lintegration-dun-device-externe-smartphone/6288>\
**Category:** Configuration\
**Tags:** mqtt\
**Created:** [April 29, 2021, 1:49pm UTC](https://community.gladysassistant.com/t/mqtt-permettre-lintegration-dun-device-externe-smartphone/6288 "2021-04-29T13:49:46Z")\
**Posts on this page:** 1\
**Showing post:** 40

<div class="post-metadata">

**Author:** ![lmilcent](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/lmilcent/32/7023_2.png) [@lmilcent](https://community.gladysassistant.com/u/lmilcent)\
**Post date:** [October 18, 2021, 9:41am UTC](https://community.gladysassistant.com/t/mqtt-permettre-lintegration-dun-device-externe-smartphone/6288/40 "2021-10-18T09:41:20Z")

</div>

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 «&nbsp;present&nbsp;» when my phone is on Wi-Fi only.

Procedure:

- I use [presence publisher](https://play.google.com/store/apps/details?id=org.ostrya.presencepublisher&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1) for Android, which allows, once connected to Wi-Fi at home, to send MQTT messages to Gladys.
- In Gladys, under «&nbsp;MQTT&nbsp;», I create a new device of type «&nbsp;presence&nbsp;» with values «&nbsp;1&nbsp;» and «&nbsp;0&nbsp;» (no choice but to use numbers).
- Presence detection: In a scene, the «&nbsp;Device state change&nbsp;» 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 «&nbsp;Check presence&nbsp;» 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 «&nbsp;online&nbsp;» and not «&nbsp;1&nbsp;» 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 «&nbsp;Absence messages&nbsp;» to notify Gladys that I am home on Wi-Fi (logical 😅). 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 «&nbsp;conditions&nbsp;», enable «&nbsp;Send without Wi-Fi&nbsp;»
3. In the «&nbsp;None of the above matches&nbsp;» section, enable «&nbsp;Send absence message&nbsp;» and modify the «&nbsp;Absence message&nbsp;» value to «&nbsp;1&nbsp;».

---

_[View the full topic](https://community.gladysassistant.com/t/mqtt-permettre-lintegration-dun-device-externe-smartphone/6288)._
