KartoffelToby / better_thermostat

This custom component for Home Assistant will add crucial features to your climate-controlling TRV (Thermostatic Radiator Valves) to save you the work of creating automations to make it smart. It combines a room-temperature sensor, window/door sensors, weather forecasts, or an ambient temperature probe to decide when it should call for heat and automatically calibrate your TRVs to fix the imprecise measurements taken in the radiator's vicinity.
https://better-thermostat.org
GNU Affero General Public License v3.0
746 stars 122 forks source link

TS0601 does not work through Z2MQTT #912

Open kegelmeier opened 1 year ago

kegelmeier commented 1 year ago

Prerequisites

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.1.6",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "5.15.80",
    "supervisor": "2022.12.1",
    "host_os": "Home Assistant OS 9.4",
    "docker_version": "20.10.19",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "alexa_media": {
      "version": "4.5.3",
      "requirements": [
        "alexapy==1.26.4",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "ble_monitor": {
      "version": "11.4.1",
      "requirements": [
        "pycryptodomex>=3.14.1",
        "janus>=1.0.0",
        "aioblescan>=0.2.14",
        "btsocket>=0.2.0",
        "pyric>=0.1.6.3"
      ]
    },
    "garbage_collection": {
      "version": "4.10.2",
      "requirements": [
        "python-dateutil>=2.8.2"
      ]
    },
    "hacs": {
      "version": "1.30.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "zwift": {
      "version": "3.3",
      "requirements": [
        "zwift-client==0.2.0"
      ]
    },
    "spacex": {
      "version": "029",
      "requirements": [
        "spacexpypi==0.0.12"
      ]
    },
    "better_thermostat": {
      "version": "1.0.0",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "better_thermostat",
    "name": "Better Thermostat",
    "documentation": "https://github.com/KartoffelToby/better_thermostat",
    "issue_tracker": "https://github.com/KartoffelToby/better_thermostat/issues",
    "iot_class": "local_push",
    "version": "1.0.0",
    "config_flow": true,
    "dependencies": [
      "climate",
      "recorder"
    ],
    "after_dependencies": [
      "climate"
    ],
    "codeowners": [
      "@kartoffeltoby"
    ],
    "requirements": [],
    "is_built_in": false
  },
  "data": {
    "info": {
      "name": "Test Thermostat",
      "temperature_sensor": "sensor.ble_temperature_a4c1386fb91b",
      "off_temperature": 15,
      "humidity_sensor": "sensor.ble_humidity_a4c1383ab311",
      "window_off_delay": 10,
      "window_sensors": null,
      "outdoor_sensor": null,
      "weather": null,
      "model": "TS0601_thermostat_3"
    },
    "thermostat": {
      "climate.0xa4c1387b95d7df26": {
        "name": "thermostat_test",
        "state": "heat",
        "attributes": {
          "hvac_modes": [
            "auto",
            "heat",
            "off"
          ],
          "min_temp": 5.0,
          "max_temp": 35.0,
          "target_temp_step": 1.0,
          "current_temperature": 20.0,
          "temperature": 16.0,
          "hvac_action": "off",
          "battery_low": false,
          "child_lock": "UNLOCK",
          "current_heating_setpoint": 16,
          "error": null,
          "frost_protection": "OFF",
          "linkquality": 63,
          "local_temperature": 20,
          "local_temperature_calibration": 4,
          "running_state": "idle",
          "scale_protection": "ON",
          "system_mode": "heat",
          "friendly_name": "thermostat_test",
          "supported_features": 1
        },
        "bt_config": {
          "calibration": "local_calibration_based",
          "calibration_mode": "default",
          "protect_overheating": false,
          "no_off_system_mode": false,
          "heat_auto_swapped": false,
          "child_lock": false,
          "homaticip": false
        },
        "bt_adapter": "mqtt",
        "bt_integration": "mqtt",
        "model": "TS0601_thermostat_3"
      }
    },
    "external_temperature_sensor": {
      "entity_id": "sensor.ble_temperature_a4c1386fb91b",
      "state": "19.6",
      "attributes": {
        "state_class": "measurement",
        "sensor_type": "ATC",
        "mac_address": "A4:C1:38:6F:B9:1B",
        "last_packet_id": 97,
        "firmware": "ATC (Atc1441)",
        "uuid": "A4:C1:38:6F:B9:1B",
        "battery_level": 98,
        "last_mean_of": 2,
        "median": 19.6,
        "mean": 19.6,
        "rssi": -57,
        "unit_of_measurement": "\u00b0C",
        "device_class": "temperature",
        "friendly_name": "Temperatur Wohnzimmer"
      },
      "last_changed": "2023-01-22T21:59:02.707643+00:00",
      "last_updated": "2023-01-22T21:59:02.707643+00:00",
      "context": {
        "id": "01GQDQVWSK7FZ1X311P12G4HWM",
        "parent_id": null,
        "user_id": null
      }
    },
    "window_sensor": "-"
  }
}

Description

I am trying to use a Z2MQTT device with BT and it is not working as expected. The thermostat is shown within HA as unavailable.

Any idea what I can do to fix this?

Steps to Reproduce

  1. Add the TS0601 as a BT entity.
  2. It shows up as not available.

Versions

HA 2023.1.6 BT 1.0.0

wtom commented 1 year ago

Can you give us some logs maybe? Like this, everything looks good, just the model is different from normal. But that has nothing todo with the "unavailable".

kegelmeier commented 1 year ago

It did not produce any logs.. At least in HA I can not find any related logs.

What is the "unavailable" related to?

wtom commented 1 year ago

You need to enable the debug logs

kegelmeier commented 1 year ago

Found the issue. local_temperature_calibration in Z2M was set to 4. BT accepts only values between -3 to 3 as the logs told me. Z2M however accepts also different values. Not sure if this something that should also be fixed in BT.

linardsblk commented 1 year ago

I can confirm that I had the same issue of BT entity showing up as 'Disabled' and it's calibration was set to +5. After resetting it to 0 through Z2M, BT started working as usual.

KartoffelToby commented 1 year ago

@linardsblk pls Checkout 1.2.1