Tuya Sensors "Unaivailable"

Hey folks,

I’ve just started using HA with almost zero coding knowledge and I am loving it!

I am struggling with these Tuya BLE sensors - showing as unavailable in HA but working fine in SmartLife app. I would love to get them into HA somehow so I can trigger non-Tuya devices.

Does anyone have any ideas? I’m using the default Tuya integration that was auto-discovered when I first set up HA and the latest version of HA.

They’re sold as Arlec Grid Connect BLE sensors here in Australia and require a BLE hub to work.
https://www.bunnings.com.au/arlec-grid-connect-smart-home-hub_p0148571

HA screenshots, product images:


1. sensor unail

Device details for the “Smart Hub”:

{
  "result": {
    "active_time": 1658889150,
    "biz_type": 18,
    "category": "wfcon",
    "create_time": 1658889150,
    "icon": "smart/icon/ay1536534747810ekKBj/1566277572ce48af53c29.png",
    "id": "bf25972470ec45506fzk9f",
    "ip": "XXXXXXXXX",
    "lat": "-31.9329",
    "local_key": "XXXXXXXXX",
    "lon": "115.8073",
    "model": "SGS01HA",
    "name": "Smart Hub",
    "online": true,
    "owner_id": "62104269",
    "product_id": "bkjsfuzu",
    "product_name": "Smart Hub",
    "status": [],
    "sub": true,
    "time_zone": "+08:00",
    "uid": "eu1658828210267sy9pu",
    "update_time": 1658889154,
    "uuid": "64240413483fda439277"
  },
  "success": true,
  "t": 1660516131652,
  "tid": "792c06641c2011ed9ad6628099f16ede"
}

Device details for the “Pantry Contact”:

{
  "result": {
    "active_time": 1658889188,
    "biz_type": 18,
    "category": "mcs",
    "create_time": 1658889188,
    "icon": "smart/icon/ay1536534747810ekKBj/156584136047cd8f7c1a2.png",
    "id": "bfaa688a1f587a9b22vbzz",
    "ip": "",
    "lat": "-31.9329",
    "lon": "115.8073",
    "model": "YIDONG",
    "name": "Pantry contact",
    "online": false,
    "owner_id": "62104269",
    "product_id": "kadfkbvr",
    "product_name": "Contact Sensor",
    "status": [
      {
        "code": "doorcontact_state",
        "value": true
      },
      {
        "code": "battery_value",
        "value": 100
      }
    ],
    "sub": true,
    "time_zone": "+08:00",
    "uid": "eu1658828210267sy9pu",
    "update_time": 1658889201,
    "uuid": "195e37b033bd27e6"
  },
  "success": true,
  "t": 1660516307840,
  "tid": "e2335aa91c2011ed97488e5328223f65"
}

HA diagnostics dump:

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.8.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Australia/Perth",
    "os_name": "Linux",
    "os_version": "5.15.55",
    "supervisor": "2022.08.3",
    "host_os": "Home Assistant OS 8.4",
    "docker_version": "20.10.14",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "version": "1.26.2",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "aarlo": {
      "version": "0.7.2b8",
      "requirements": [
        "unidecode",
        "cloudscraper>=1.2.58",
        "paho-mqtt"
      ]
    },
    "ble_monitor": {
      "version": "9.1.1",
      "requirements": [
        "pycryptodomex>=3.14.1",
        "janus>=1.0.0",
        "aioblescan>=0.2.13",
        "btsocket>=0.2.0",
        "pyric>=0.1.6.3"
      ]
    },
    "localtuya": {
      "version": "4.0.1",
      "requirements": []
    }
  },
  "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.tuyaeu.com",
    "auth_type": 0,
    "country_code": "61",
    "app_type": "smartlife",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "name": "Pantry contact",
    "model": "YIDONG",
    "category": "mcs",
    "product_id": "kadfkbvr",
    "product_name": "Contact Sensor",
    "online": false,
    "sub": true,
    "time_zone": "+08:00",
    "active_time": "2022-07-27T02:33:08+00:00",
    "create_time": "2022-07-27T02:33:08+00:00",
    "update_time": "2022-07-27T02:33:21+00:00",
    "function": {},
    "status_range": {
      "battery_value": {
        "type": "Integer",
        "value": {
          "unit": "mV",
          "min": 0,
          "max": 10000,
          "scale": 0,
          "step": 1
        }
      },
      "doorcontact_state": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status": {
      "doorcontact_state": true,
      "battery_value": 100
    },
    "home_assistant": {
      "name": "Pantry contact",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "door",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "binary_sensor.pantry_contact",
            "state": "unavailable",
            "attributes": {
              "device_class": "door",
              "friendly_name": "Pantry contact"
            },
            "last_changed": "2022-08-14T22:21:04.828660+00:00",
            "last_updated": "2022-08-14T22:21:04.828660+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": "mV",
          "state": {
            "entity_id": "sensor.pantry_contact_battery",
            "state": "unavailable",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "mV",
              "friendly_name": "Pantry contact Battery"
            },
            "last_changed": "2022-08-14T22:21:04.832499+00:00",
            "last_updated": "2022-08-14T22:21:04.832499+00:00"
          }
        }
      ]
    }
  }
}

Thank you for linking me, but I’m not sure how this is relevant.

I’m trying to get a device that is currently in Google Home, but HA does not have integration for into HA.

Google home is supported in ha over home assiatant cloud AFAIK. If it works with alexa than should work with Google home. As I dont have it, you could test it out.

I have been dabbling with HA a bit recently and I am now juggling precisely the same issue with the “Arlec” sensor set and your post has inspired me to do a little more digging.

It seems the values are there, just the fact that they’re BLE sensors and are only “online” at time of transmit for event/status reporting.

So somehow we need to get the Tuya integration to not squish values with unavailable.
Also echoed here: https://github.com/tuya/tuya-home-assistant/issues/691

Additionally have been thinking of throwing these particular sensors or trying out the Tasmota reflash Arlec Smart Home Hub Bluetooth Gateway (SGS01HA) Configuration for Tasmota (although I’m unsure how easy, if possible, it is to re-pair/pair new devices once flashed)

1 Like

Oh I think that’s if I want to use Google to call out HA devices. I’m trying to go the other way around.

Oooh, that’s an interesting find! I’ve been reluctant to go the Tasmota route for that exact reason, not being able to pair the sensors afterwards. But the post you linked would indicate that since we’re only flashing the WiFi module, the BLE module will appear as normal to the BLE sensors. Please let me know if you have any success!

I also wish there was a way to get these BLE hubs into LocalTuya, I’ve found this HACS integration to be infinitely faster than the cloud integration for all my Tuya stuff.

The point is that it does work other way around.

When you say “But I’m using cloud.”, we’re talking Nabu Casa or similar, right?

Yes I’m talking about nabu casa.