Support for Tuya Contact sensor, Device category MC in Tuya Integration

Hi developers. Thanks for the awesome new Tuya integration, I only noticed my Contact Sensor was still saying unsupported after the last update. I thought this was a bug, but unfortunately it’s a feature, since device category MC is not supported at this time. Here is the information I placed in the github issue:
From Tuya Smart Developer Center I see the following information for the device:
Device Information
Product Name
门磁–新
Product Category
mc

Device Debugging
Standard Status Set

Code Type Values
doorcontact_state Boolean “{true,false}”
battery_state Enum { “range”: [ “low”, “middle”, “high” ] }

Thanks!

I’ve opened up a change request to add support this:

Thanks very much, look forward to the implementation :slight_smile:

Hello, I am pretty new at this, but I have a problem. I bought a window opener on Amazon (from China of course) and it can be controlled by the Tuya app. I also have a bunch of Tuya devices that I previously integrated into Home Assistant and they all work great. Yet for this window opener (Olide) the device shows up in HA but is unsupported, and no entity is found for it. I donwloaded the device diagnostics and it shows the device category is also mc, and it led me to this thread.

My question is, does the current solution only cover the contact sensors? Or it also solves my problem? If so how do I get the modified code (or the correct Tuya integration version) into my server? Thanks for any help!

Below is the json diagnostic file:

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.7.5",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "aarch64",
    "timezone": "America/Los_Angeles",
    "os_name": "Linux",
    "os_version": "5.15.32-v8",
    "supervisor": "2022.07.0",
    "host_os": "Home Assistant OS 8.3",
    "docker_version": "20.10.14",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {},
  "integration_manifest": {
    "domain": "tuya",
    "name": "Tuya",
    "documentation": "https://www.home-assistant.io/integrations/tuya",
    "requirements": [
      "tuya-iot-py-sdk==0.6.6"
    ],
    "dependencies": [
      "ffmpeg"
    ],
    "codeowners": [
      "@Tuya",
      "@zlinoliver",
      "@frenck"
    ],
    "config_flow": true,
    "iot_class": "cloud_push",
    "dhcp": [
      {
        "macaddress": "105A17*"
      },
      {
        "macaddress": "10D561*"
      },
      {
        "macaddress": "1869D8*"
      },
      {
        "macaddress": "381F8D*"
      },
      {
        "macaddress": "508A06*"
      },
      {
        "macaddress": "68572D*"
      },
      {
        "macaddress": "708976*"
      },
      {
        "macaddress": "7CF666*"
      },
      {
        "macaddress": "84E342*"
      },
      {
        "macaddress": "D4A651*"
      },
      {
        "macaddress": "D81F12*"
      }
    ],
    "loggers": [
      "tuya_iot"
    ],
    "is_built_in": true
  },
  "data": {
    "endpoint": "https://openapi.tuyaus.com",
    "auth_type": 0,
    "country_code": "1",
    "app_type": "tuyaSmart",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "name": "Window Opener Left",
    "model": "",
    "category": "mc",
    "product_id": "2tIqtzQxiihn6D14",
    "product_name": "Intelligent Window",
    "online": true,
    "sub": false,
    "time_zone": "-08:00",
    "active_time": "2022-07-06T21:59:16+00:00",
    "create_time": "2022-07-06T21:59:16+00:00",
    "update_time": "2022-07-06T22:04:02+00:00",
    "function": {
      "anti_theft": {
        "type": "Boolean",
        "value": {}
      },
      "percent_control": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "control": {
        "type": "Integer",
        "value": {
          "range": [
            "open",
            "stop",
            "close"
          ]
        }
      },
      "auto_power": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status_range": {
      "anti_theft": {
        "type": "Boolean",
        "value": {}
      },
      "percent_control": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "control": {
        "type": "Enum",
        "value": {
          "range": [
            "open",
            "stop",
            "close"
          ]
        }
      },
      "auto_power": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status": {
      "anti_theft": false,
      "percent_control": 99,
      "control": "stop",
      "auto_power": true
    },
    "home_assistant": {
      "name": "Window Opener Left",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": []
    }
  }
}