[Enhancement] Retrieve the latest state of type TEXT

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

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

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

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

1 Like

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 « type » of the feature to retrieve the correct column!

1 Like

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

1 Like

image

The change :

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


The PR : Update DeviceGetValueParams to handle text device feature type by Terdious · Pull Request #2317 · GladysAssistant/Gladys · GitHub

2 Likes

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!

2 Likes

Looks good to me, tested and merged :slight_smile:

It will be included in the next Gladys release!

2 Likes

It’s live in Gladys Assistant 4.59:

2 Likes