# Control a device with a variable value

**URL:** <https://community.gladysassistant.com/t/controler-un-appareil-avec-une-valeur-variable/7977>\
**Category:** Configuration\
**Tags:** scene\
**Created:** [February 15, 2023, 10:32am UTC](https://community.gladysassistant.com/t/controler-un-appareil-avec-une-valeur-variable/7977 "2023-02-15T10:32:01Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Hizo](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Hizo](https://community.gladysassistant.com/u/Hizo)\
**Post date:** [February 15, 2023, 1:11pm UTC](https://community.gladysassistant.com/t/controler-un-appareil-avec-une-valeur-variable/7977/5 "2023-02-15T13:11:45Z")

</div>

I may not have explained myself clearly.

Using the trigger, as soon as an action is performed on the button:

 ![Screenshot_20230215_140405](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/3/35d8c6fb0db7c168264a64a6f3cba1ff78028d67.png)

1st step, I retrieve its value:

 ![Screenshot_20230215_140435](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/8/81d4da003d1d7829095dd775ba4657a2e2af49f1.png)

2nd step, I want to send the previous value to an MQTT device:

 ![Screenshot_20230215_140553](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/b/b1e8b2c2a6a38fe861ac4dff18ed5a1695ffea6e.png)  
But the value must be numeric — it’s impossible to use the variable…

If that works, I can create a single scene regardless of the button’s value.  
If I’m forced to enter a numeric value, I have to create one scene per value; for this example, that makes 3 scenes…  
Each scene uses a specific number in the trigger and sends the same value to the device.

---

_[View the full topic](https://community.gladysassistant.com/t/controler-un-appareil-avec-une-valeur-variable/7977)._
