# \[Enhancement\] Retrieve the latest state of type TEXT

**URL:** <https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537>\
**Category:** Demandes livrées\
**Tags:** mqtt, scene\
**Created:** [May 20, 2025, 5:17pm UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537 "2025-05-20T17:17:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mutmut](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/mutmut/32/14064_2.png) [@mutmut](https://community.gladysassistant.com/u/mutmut)\
**Post date:** [May 20, 2025, 5:17pm UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/1 "2025-05-20T17:17:10Z")

</div>

In scenes, you can retrieve the last «&nbsp;state&nbsp;» of an MQTT sensor.

I would like to be able to retrieve the last «&nbsp;text&nbsp;» of an MQTT Text sensor to then reuse it in scenes:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/5/8/58d9a6847fde25cb81eb7e87135d7ef445282292.png)

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 20, 2025, 5:29pm UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/2 "2025-05-20T17:29:37Z")

</div>

I’m wondering whether it’s useful to create a new action, or whether it’s instead the ‹&nbsp;retrieve last state&nbsp;› action that should be improved to also work with text sensors…

---

<div class="post-metadata">

**Author:** ![mutmut](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/mutmut/32/14064_2.png) [@mutmut](https://community.gladysassistant.com/u/mutmut)\
**Post date:** [May 20, 2025, 5:32pm UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/3 "2025-05-20T17:32:07Z")

</div>

I leave the choice to @pierre-gilles because I don’t know what’s simplest on the dev side.

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [May 21, 2025, 7:11am UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/4 "2025-05-21T07:11:00Z")

</div>

Given that we’re aiming for simplification on the user side, I agree with @StephaneB . Nothing complicated on the dev side anyway, you just need to take into account the «&nbsp;type&nbsp;» of the feature to retrieve the correct column!

---

<div class="post-metadata">

**Author:** ![mutmut](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/mutmut/32/14064_2.png) [@mutmut](https://community.gladysassistant.com/u/mutmut)\
**Post date:** [May 21, 2025, 8:30am UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/5 "2025-05-21T08:30:41Z")

</div>

Thanks @Terdious for the info and I agree as well.  
I’ll change the post title.

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [May 21, 2025, 8:35am UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/6 "2025-05-21T08:35:35Z")

</div>

![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/6/2/622c60e68486ac1cede3064975275b8752e7b596.png)

The change :

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/0/1/01ca7daf286780d32bfe8f87847b1d8c8c39892b.png)

@pierre-gilles, since I already know there will be other «&nbsp;string&nbsp;» types coming, I took the liberty of creating a constant in the utils to list the string types. Does that work for you?

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/e/9/e911dfb2cbda2f1c13f98cb309a0414bc8e69dab.png)  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/e/5/e56981b8c72e2fd4504ee4fe66a505982396323e.png)

The PR : [Update DeviceGetValueParams to handle text device feature type by Terdious · Pull Request #2317 · GladysAssistant/Gladys · GitHub](https://github.com/GladysAssistant/Gladys/pull/2317/files)

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 22, 2025, 6:47am UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/7 "2025-05-22T06:47:32Z")

</div>

That looks perfect to me @Terdious, I’ll test tomorrow and if it’s good I’ll merge, but as far as the code goes it looks good to me!

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 23, 2025, 8:45am UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/8 "2025-05-23T08:45:53Z")

</div>

Looks good to me, tested and merged 🙂

It will be included in the next Gladys release!

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 26, 2025, 8:42am UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/9 "2025-05-26T08:42:52Z")

</div>

It’s live in Gladys Assistant 4.59:

> [@Gladys Assistant 4.59 : Thermostat Aqara W100, Matter, Scènes!](https://community.gladysassistant.com/t/gladys-assistant-4-59-thermostat-aqara-w100-matter-scenes/9546):
>
> Salut à tous slight_smile Une nouvelle version de Gladys est disponible partying_faceradio_button Prise en charge des boutons du Thermostat Aqara W100 via Zigbee2MQTT Aqara a récemment sorti un nouveau thermostat connecté, le [Aqara W100](https://www.domadoo.fr/fr/devices-matter/7852-aqara-capteur-de-temperature-et-d-humidite-zigbee-30-et-thread-aqara-climate-sensor-w100-6975833357260.html?domid=17), compatible Zigbee, Thread et Matter. @bjm est en train de le tester et m’a fait des retours sur des boutons qui n’étaient pas encore pris en charge par Gladys,…

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 26, 2025, 8:42am UTC](https://community.gladysassistant.com/t/amelioration-recuperer-le-dernier-etat-de-type-text/9537/10 "2025-05-26T08:42:54Z")

</div>


