KartoffelToby/better_thermostat

Exception, device not available

karent80 opened this issue · 0 comments

Prerequisites

  • [v ] Model name of your Devices

moes tuya ts0601

  • [ v] Output from Home Assistant Developer Tools state e.g.
  • [ v] Output from Home Assistant Device Diagnostic from BT
{
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.9.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.4",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Warsaw",
    "os_name": "Linux",
    "os_version": "6.6.31-haos-raspi",
    "supervisor": "2024.09.1",
    "host_os": "Home Assistant OS 13.0",
    "docker_version": "26.1.4",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "xiaomi_cloud_map_extractor": {
      "documentation": "https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor",
      "version": "v2.2.0",
      "requirements": [
        "pillow",
        "pybase64",
        "python-miio",
        "requests",
        "pycryptodome"
      ]
    },
    "samsungtv_smart": {
      "documentation": "https://github.com/ollo69/ha-samsungtv-smart",
      "version": "0.13.5",
      "requirements": [
        "websocket-client!=1.4.0,>=0.58.0",
        "wakeonlan>=2.0.0",
        "aiofiles>=0.8.0",
        "casttube>=0.2.1"
      ]
    },
    "xiaomi_miot": {
      "documentation": "https://github.com/al-one/hass-xiaomi-miot",
      "version": "0.7.20",
      "requirements": [
        "construct>=2.10.68",
        "python-miio>=0.5.12",
        "micloud>=0.5"
      ]
    },
    "bodymiscale": {
      "documentation": "https://github.com/dckiller51/bodymiscale",
      "version": "2024.6.0",
      "requirements": [
        "cachetools==5.3.0"
      ]
    },
    "rn301": {
      "documentation": "",
      "version": "1.0.1",
      "requirements": []
    },
    "better_thermostat": {
      "documentation": "https://github.com/KartoffelToby/better_thermostat",
      "version": "1.6.0",
      "requirements": []
    },
    "hacs": {
      "documentation": "https://hacs.xyz/docs/configuration/start",
      "version": "2.0.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "nodered": {
      "documentation": "https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/custom_integration/",
      "version": "4.0.2",
      "requirements": []
    },
    "hon": {
      "documentation": "https://github.com/Andre0512/hon/",
      "version": "0.14.0",
      "requirements": [
        "pyhOn==0.17.5"
      ]
    }
  },
  "integration_manifest": {
    "domain": "better_thermostat",
    "name": "Better Thermostat",
    "after_dependencies": [
      "climate"
    ],
    "codeowners": [
      "kartoffeltoby"
    ],
    "config_flow": true,
    "dependencies": [
      "climate",
      "recorder"
    ],
    "documentation": "https://github.com/KartoffelToby/better_thermostat",
    "iot_class": "local_push",
    "issue_tracker": "https://github.com/KartoffelToby/better_thermostat/issues",
    "requirements": [],
    "version": "1.6.0",
    "is_built_in": false
  },
  "setup_times": {},
  "data": {
    "info": {
      "name": "sypialnia_better_thermostat",
      "temperature_sensor": "sensor.sypialnia_temperatura_template_sensor",
      "off_temperature": 20,
      "tolerance": 0.0,
      "target_temp_step": "0.0",
      "window_sensors": null,
      "humidity_sensor": null,
      "outdoor_sensor": null,
      "weather": null,
      "cooler": null,
      "window_off_delay": 0,
      "window_off_delay_after": 0,
      "model": "Zigbee Smart"
    },
    "thermostat": {
      "climate.sypialnia_grzejnik": {
        "name": "sypialnia_grzejnik",
        "state": "heat_cool",
        "attributes": {
          "hvac_modes": [
            "off",
            "heat_cool",
            "heat_cool"
          ],
          "min_temp": 8,
          "max_temp": 28,
          "target_temp_step": 0.5,
          "preset_modes": [
            "comfortable",
            "holiday",
            "eco"
          ],
          "current_temperature": 21.0,
          "temperature": 8.0,
          "preset_mode": null,
          "friendly_name": "sypialnia_grzejnik",
          "supported_features": 17
        },
        "bt_config": {
          "calibration": "target_temp_based",
          "calibration_mode": "default",
          "protect_overheating": false,
          "no_off_system_mode": true,
          "heat_auto_swapped": false,
          "child_lock": false,
          "homaticip": false
        },
        "bt_adapter": "tuya",
        "bt_integration": "tuya",
        "model": "Zigbee Smart"
      }
    },
    "external_temperature_sensor": {
      "entity_id": "sensor.sypialnia_temperatura_template_sensor",
      "state": "20.8",
      "attributes": {
        "unit_of_measurement": "\u00b0C",
        "device_class": "temperature",
        "friendly_name": "Sypialnia temperatura"
      },
      "last_changed": "2024-09-14T09:55:23.906316+00:00",
      "last_reported": "2024-09-14T09:55:23.906316+00:00",
      "last_updated": "2024-09-14T09:55:23.906316+00:00",
      "context": {
        "id": "01J7QZATKZK1KZBBGZGPV2YDSW",
        "parent_id": null,
        "user_id": null
      }
    },
    "window_sensor": "-"
  }
}
}

Description

Device is unavailable. Reloading integration results in following error:

2024-09-14 11:36:08.637 INFO (MainThread) [custom_components.better_thermostat.adapters.delegate] better_thermostat None: integration: tuya isn't native supported, feel free to open an issue, fallback adapter generic
2024-09-14 11:36:08.649 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat sypialnia_better_thermostat: Waiting for entity to be ready...
2024-09-14 11:36:08.654 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat sypialnia_better_thermostat: Starting version 1.6.0. Waiting for entity to be ready...
2024-09-14 11:36:08.654 DEBUG (MainThread) [custom_components.better_thermostat.climate] better_thermostat sypialnia_better_thermostat: Undefined target temperature, falling back to 8.0
2024-09-14 11:36:08.655 DEBUG (MainThread) [custom_components.better_thermostat.climate] better_thermostat sypialnia_better_thermostat: No previously hvac mode found on startup, turn bt to trv mode heat
2024-09-14 11:36:08.655 DEBUG (MainThread) [custom_components.better_thermostat.climate] better_thermostat sypialnia_better_thermostat: Startup config, BT hvac mode is heat, Target temp 8.0
2024-09-14 11:36:08.657 DEBUG (MainThread) [custom_components.better_thermostat.calibration] better_thermostat None: climate.sypialnia_grzejnik - new setpoint calibration: 8.0 | external_temp: 20.8, target_temp: 8.0, trv_temp: 21.0
2024-09-14 11:36:08.657 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: TO TRV set_hvac_mode: climate.sypialnia_grzejnik from: heat_cool to: heat
2024-09-14 11:36:08.657 DEBUG (MainThread) [custom_components.better_thermostat.adapters.generic] better_thermostat None: set_hvac_mode heat
2024-09-14 11:36:08.750 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/config/custom_components/better_thermostat/climate.py", line 858, in startup
await control_trv(self, trv)
File "/config/custom_components/better_thermostat/utils/controlling.py", line 220, in control_trv
await set_hvac_mode(self, heater_entity_id, _new_hvac_mode)
File "/config/custom_components/better_thermostat/adapters/delegate.py", line 84, in set_hvac_mode
return await self.real_trvs[entity_id]["adapter"].set_hvac_mode(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/better_thermostat/adapters/generic.py", line 124, in set_hvac_mode
await self.hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 758, in async_set_hvac_mode
await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tuya/climate.py", line 290, in set_hvac_mode
self._send_command(commands)
File "/usr/src/homeassistant/homeassistant/components/tuya/base.py", line 276, in _send_command
self.device_manager.send_commands(self.device.id, commands)
File "/usr/local/lib/python3.12/site-packages/tuya_sharing/manager.py", line 93, in send_commands
return self.device_repository.send_commands(device_id, commands)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tuya_sharing/device.py", line 180, in send_commands
self.api.post(f"/v1.1/m/thing/{device_id}/commands", None, {"commands": commands})
File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 192, in post
return self.__request("POST", path, params, body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 121, in __request
raise Exception(f"network error:({ret['code']}) {ret['msg']}")
Exception: network error:(2008) command or value not support

Steps to Reproduce

  1. Create BT device - only mandatory inputs and all setting default
    obraz

  2. Notice the device is not available

  3. Enabled logging and reloaded integration

Versions

BT 1.6.0
Core 2024.9.1
Supervisor 2024.09.1
Operating System 13.0
Frontend 20240906.0

Additional Information