# Return value of Moes Scene Switch TS0042 button under Gladys

**URL:** <https://community.gladysassistant.com/t/valeur-de-retour-bouton-moes-scene-switch-ts0042-sous-gladys/7094>\
**Category:** Configuration\
**Tags:** zigbee2mqtt, tuya\
**Created:** [March 22, 2022, 4:52pm UTC](https://community.gladysassistant.com/t/valeur-de-retour-bouton-moes-scene-switch-ts0042-sous-gladys/7094 "2022-03-22T16:52:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MisterBin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/misterbin/32/9790_2.png) [@MisterBin](https://community.gladysassistant.com/u/MisterBin)\
**Post date:** [March 22, 2022, 4:52pm UTC](https://community.gladysassistant.com/t/valeur-de-retour-bouton-moes-scene-switch-ts0042-sous-gladys/7094/1 "2022-03-22T16:52:30Z")

</div>

Hello,  
I have paired a Moes brand 2-input button, recognized by zigbee2mqtt as TS0042 (TuYa),

> **[Tuya TS0042 control via MQTT | Zigbee2MQTT](https://www.zigbee2mqtt.io/devices/TS0042.html#tuya-ts0042)**
>
> Remaining battery in %, can take up to 24 hours before reported. Value can be found in the published state on the battery property. It's not possible to read (/get) or write (/set) this value. The minimal value is 0 and the maximum value is 100. The...

In Gladys, I added a scene with a device state change, but what seems strange to me is that only integer values can be entered, whereas the button returns strings.

State under zigbee2mqtt:

```json
{
    "battery": 100,
    "linkquality": 167,
    "action": "1_single"
}

The values for action are: 1_single, 1_double, 1_hold, 2_single, 2_double, 2_hold

```

In Gladys:

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/0/0428b5017dfb2e1ff9a13e5ac7fac9c3cc96e480.png)

In zigbee2mqtt:  
I can’t post an image as I’m new to the forum

Thank you for your time and help

---

<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:** [March 23, 2022, 6:07pm UTC](https://community.gladysassistant.com/t/valeur-de-retour-bouton-moes-scene-switch-ts0042-sous-gladys/7094/2 "2022-03-23T18:07:48Z")

</div>

Hello @MisterBin, and welcome to the community! 🙂

Indeed, Gladys only handles numerical values for device states.

We need to convert between the static value and the numerical value in the Zigbee2mqtt integration.

@cicoub13 @AlexTrovato Is this device already supported or do we need to add the values to the Zigbee2mqtt integration?

If it’s not supported, you’ll need to create a GitHub issue @MisterBin: [Issues · GladysAssistant/Gladys · GitHub](https://github.com/GladysAssistant/Gladys/issues)

---

<div class="post-metadata">

**Author:** ![MisterBin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/misterbin/32/9790_2.png) [@MisterBin](https://community.gladysassistant.com/u/MisterBin)\
**Post date:** [March 23, 2022, 7:06pm UTC](https://community.gladysassistant.com/t/valeur-de-retour-bouton-moes-scene-switch-ts0042-sous-gladys/7094/3 "2022-03-23T19:06:06Z")

</div>

I saw this in the code, no idea if I’m in the right place  
but if so, maybe we just need to add cases for the button values

```auto
        case 'single':
        case '1_single':
          result = BUTTON_STATUS.CLICK;
          break;

```

```auto
  convertValue.js
  -------------------------------
    // Case for Button devices
    case 'click': {
      switch (value) {
        case 'single':
          result = BUTTON_STATUS.CLICK;
          break;
        case 'double':
          result = BUTTON_STATUS.DOUBLE_CLICK;
          break;
        case 'hold':
          result = BUTTON_STATUS.LONG_CLICK;
          break;
        default:
          result = value;
      }
      break;
    }

```

---

<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:** [March 24, 2022, 5:37pm UTC](https://community.gladysassistant.com/t/valeur-de-retour-bouton-moes-scene-switch-ts0042-sous-gladys/7094/4 "2022-03-24T17:37:06Z")

</div>

> [@MisterBin](#):
>
> I saw that in the code, no idea if I’m in the right place  
> but if so, maybe it would be enough to add cases for the button values

You are in the right place!

You indeed need to add these values in these files + unit tests to check that it works well
