Tuya integration support for ZX-8630 soil moisture sensor

The ZX-8630 is a Tuya supported soil moisture sensor. It has a BT low energy radio module.
Entities of device ZX8630 are shown in the integration, but value is unavailable:

I can see the values in the diagnostic information file in section “status”.

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.6.2",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.2",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "6.6.29-haos",
    "supervisor": "2024.06.0",
    "host_os": "Home Assistant OS 12.3",
    "docker_version": "25.0.5",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "hacs": {
      "documentation": "https://hacs.xyz/docs/configuration/start",
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "gruenbeck_cloud": {
      "documentation": "https://github.com/p0l0/hagruenbeck_cloud",
      "version": "0.1.1",
      "requirements": [
        "pygruenbeck_cloud==0.1.0"
      ]
    },
    "miele": {
      "documentation": "https://github.com/astrandb/miele",
      "version": "2024.3.0",
      "requirements": [
        "flatdict==4.0.1",
        "pymiele==0.1.7"
      ]
    },
    "portainer": {
      "documentation": "https://github.com/tomaae/homeassistant-portainer",
      "version": "0.0.0",
      "requirements": []
    },
    "watchman": {
      "documentation": "https://github.com/dummylabs/thewatchman",
      "version": "0.5.1",
      "requirements": [
        "prettytable==3.0.0"
      ]
    }
  },
  "integration_manifest": {
    "domain": "tuya",
    "name": "Tuya",
    "codeowners": [
      "Tuya",
      "zlinoliver",
      "frenck"
    ],
    "config_flow": true,
    "dependencies": [
      "ffmpeg"
    ],
    "dhcp": [
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      },
      {
        "macaddress": "xxxxxx*"
      }
    ],
    "documentation": "https://www.home-assistant.io/integrations/tuya",
    "integration_type": "hub",
    "iot_class": "cloud_push",
    "loggers": [
      "tuya_iot"
    ],
    "requirements": [
      "tuya-device-sharing-sdk==0.1.9"
    ],
    "is_built_in": true
  },
  "setup_times": {
    "null": {
      "setup": 7.752189412713051e-05
    },
    "7cf51512cf3417d0bc8497d0f89d71fc": {
      "wait_import_platforms": -9.811909717041999,
      "wait_base_component": -0.005411605816334486,
      "config_entry_setup": 10.454026424791664
    }
  },
  "data": {
    "endpoint": "https://apigw.tuyaeu.com",
    "terminal_id": "xxxxxxxxxxxxxxxxxxx",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "devices": [
      {
        "id": "bf7571gsoboawebz",
        "name": "ZX-8630",
        "category": "zwjcy",
        "product_id": "tu1qx9f4",
        "product_name": "ZX-8630",
        "online": false,
        "sub": false,
        "time_zone": "+02:00",
        "active_time": "2024-06-13T07:17:47+00:00",
        "create_time": "2024-06-13T07:17:47+00:00",
        "update_time": "2024-06-13T07:17:47+00:00",
        "function": {
          "temp_unit_convert": {
            "type": "Enum",
            "value": {
              "range": [
                "c",
                "f"
              ]
            }
          }
        },
        "status_range": {
          "humidity": {
            "type": "Integer",
            "value": {
              "unit": "%",
              "min": 0,
              "max": 100,
              "scale": 0,
              "step": 1
            }
          },
          "temp_current": {
            "type": "Integer",
            "value": {
              "unit": "\u2103",
              "min": -200,
              "max": 1400,
              "scale": 1,
              "step": 1
            }
          },
          "temp_unit_convert": {
            "type": "Enum",
            "value": {
              "range": [
                "c",
                "f"
              ]
            }
          },
          "battery_state": {
            "type": "Enum",
            "value": {
              "range": [
                "low",
                "middle",
                "high"
              ]
            }
          },
          "battery_percentage": {
            "type": "Integer",
            "value": {
              "unit": "%",
              "min": 0,
              "max": 100,
              "scale": 0,
              "step": 1
            }
          }
        },
        "status": {
          "humidity": 0,
          "temp_current": 249,
          "temp_unit_convert": "c",
          "battery_state": "middle",
          "battery_percentage": 32
        },
        "home_assistant": {
          "name": "ZX-8630",
          "name_by_user": null,
          "disabled": false,
          "disabled_by": null,
          "entities": [
            {
              "disabled": false,
              "disabled_by": null,
              "entity_category": null,
              "device_class": null,
              "original_device_class": "temperature",
              "icon": null,
              "original_icon": null,
              "unit_of_measurement": "\u00b0C",
              "state": {
                "entity_id": "sensor.zx_8630_temperatur",
                "state": "unavailable",
                "attributes": {
                  "state_class": "measurement",
                  "unit_of_measurement": "\u00b0C",
                  "device_class": "temperature",
                  "friendly_name": "ZX-8630 Temperatur"
                },
                "last_changed": "2024-06-15T13:29:17.584371+00:00",
                "last_reported": "2024-06-15T13:41:14.254680+00:00",
                "last_updated": "2024-06-15T13:41:14.254680+00:00"
              }
            },
            {
              "disabled": false,
              "disabled_by": null,
              "entity_category": null,
              "device_class": null,
              "original_device_class": "humidity",
              "icon": null,
              "original_icon": null,
              "unit_of_measurement": "%",
              "state": {
                "entity_id": "sensor.zx_8630_luftfeuchtigkeit",
                "state": "unavailable",
                "attributes": {
                  "state_class": "measurement",
                  "unit_of_measurement": "%",
                  "device_class": "humidity",
                  "friendly_name": "ZX-8630 Luftfeuchtigkeit"
                },
                "last_changed": "2024-06-15T13:29:17.585672+00:00",
                "last_reported": "2024-06-15T13:41:14.255716+00:00",
                "last_updated": "2024-06-15T13:41:14.255716+00:00"
              }
            },
            {
              "disabled": false,
              "disabled_by": null,
              "entity_category": "diagnostic",
              "device_class": null,
              "original_device_class": "battery",
              "icon": null,
              "original_icon": null,
              "unit_of_measurement": "%",
              "state": {
                "entity_id": "sensor.zx_8630_batterie",
                "state": "unavailable",
                "attributes": {
                  "state_class": "measurement",
                  "unit_of_measurement": "%",
                  "device_class": "battery",
                  "friendly_name": "ZX-8630 Batterie"
                },
                "last_changed": "2024-06-15T13:29:17.586707+00:00",
                "last_reported": "2024-06-15T13:41:14.256706+00:00",
                "last_updated": "2024-06-15T13:41:14.256706+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": null,
              "state": {
                "entity_id": "sensor.zx_8630_batteriestatus",
                "state": "unavailable",
                "attributes": {
                  "friendly_name": "ZX-8630 Batteriestatus"
                },
                "last_changed": "2024-06-15T13:29:17.587673+00:00",
                "last_reported": "2024-06-15T13:41:14.259811+00:00",
                "last_updated": "2024-06-15T13:41:14.259811+00:00"
              }
            }
          ]
        },
        "set_up": true,
        "support_local": true
      }
    ]
  }
}

Hello,
The problem comes from the fact that your device is listed as “offline”:

"online": false,

This sets the entity values to unavailable.

I’m searching for a clean way to implement this but I don’t really have an idea.

Maybe there is a way to know that this is a low-powered device? Or via de Device category?

Have a nice day,
Azerty