home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.08k stars 31.09k forks source link

Tuya Integration - error while setting up climate entities non-int of type 'float' #63440

Closed ahuntjens closed 2 years ago

ahuntjens commented 2 years ago

The problem

I can only see the device without entities. This worked before. Installing and setting up the Tuya integration with login and secret goes without a problem and the radiator shows up with the name I gave it in the Tuya app. But that's all. Home Assistant doesn't create entities so the device is useless.

Information from IOT tuya: Product Name: LPL16-2/3 HEATER Product Category: qn

What version of Home Assistant Core has the issue?

2021.12.7

What was the last working version of Home Assistant Core?

2021.10.6

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.climate
Source: components/tuya/base.py:48
Integration: Klimaat (documentation, issues)
First occurred: 4 januari 2022 22:21:07 (2 occurrences)
Last logged: 10:50:44

Error while setting up tuya platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/tuya/climate.py", line 107, in async_setup_entry
    async_discover_device([*hass_data.device_manager.device_map])
  File "/usr/src/homeassistant/homeassistant/components/tuya/climate.py", line 99, in async_discover_device
    TuyaClimateEntity(
  File "/usr/src/homeassistant/homeassistant/components/tuya/climate.py", line 192, in __init__
    self._attr_max_temp = type_data.max_scaled
  File "/usr/src/homeassistant/homeassistant/components/tuya/base.py", line 34, in max_scaled
    return self.scale_value(self.max)
  File "/usr/src/homeassistant/homeassistant/components/tuya/base.py", line 48, in scale_value
    return value * 1.0 / (10 ** self.scale)
TypeError: can't multiply sequence by non-int of type 'float'

Additional information

Previous PR which should have solved the issue: https://github.com/home-assistant/core/pull/62994

Previous issue which should have been solved by the pr: fixes New Tuya Integration - error while setting up climate entities #59372 fixes Error adding entities for domain climate with platform tuya #58496 fixes Eurom heater not supported in Tuya integration #59501 fixes Eurom Heater - Error while setting up tuya platform for climate #60674 fixes Climate device kt cannot be included: can't multiply sequence by non-int of type 'float' #59299

probot-home-assistant[bot] commented 2 years ago

tuya documentation tuya source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @tuya, @zlinoliver, @metisu, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

ahuntjens commented 2 years ago

Hi Development team!

Any update on this issue perhaps, I still see various similar tickets popping up.. :-( Issue seems to be clear so is there anything I can do to help?

frenck commented 2 years ago

The next release, Home Assistant 2022.2 (now in beta, feel free to join so we can look at this), contain the possibility to download diagnostics information from the device page of an device.

That information would help with determining what is going on here.

ahuntjens commented 2 years ago

oke nice option Frenck, thanks.

Just joined the beta channel and used the download diagnostics:

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.2.0b0",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.9.7",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Amsterdam",
    "os_name": "Linux",
    "os_version": "5.10.63-v8",
    "supervisor": "2022.01.0",
    "host_os": "Home Assistant OS 7.2",
    "docker_version": "20.10.9",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "tuya_v2": {
      "version": "1.5.0",
      "requirements": [
        "tuya-iot-py-sdk==0.4.1"
      ]
    },
    "webrtc": {
      "version": "v2.2.0",
      "requirements": []
    },
    "localtuya": {
      "version": "3.2.1",
      "requirements": []
    },
    "toon_smartmeter": {
      "version": "1.0.18",
      "requirements": []
    },
    "toon_climate": {
      "version": "1.0.12",
      "requirements": []
    },
    "eufy_security": {
      "version": "2.2.3",
      "requirements": [
        "websocket-client==1.1.0"
      ]
    },
    "garmin_connect": {
      "version": "0.1.8",
      "requirements": [
        "garminconnect==0.1.24"
      ]
    },
    "garbage_collection": {
      "version": "4.2",
      "requirements": [
        "python-dateutil>=2.8.1",
        "holidays>=0.10.5.2",
        "voluptuous>=0.12.1"
      ]
    },
    "sems": {
      "version": "3.4.0",
      "requirements": []
    },
    "hacs": {
      "version": "1.20.0",
      "requirements": [
        "aiogithubapi>=21.11.0"
      ]
    }
  },
  "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",
      "@METISU",
      "@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*"
      }
    ],
    "is_built_in": true
  },
  "data": {
    "endpoint": "https://openapi.tuyaeu.com",
    "auth_type": 0,
    "country_code": "31",
    "app_type": "tuyaSmart",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "name": "Slaapkamer",
    "model": "LPL-15",
    "category": "qn",
    "product_id": "20qAGCEd0AxowwTA",
    "product_name": " Your Eurom Heater",
    "online": true,
    "sub": false,
    "time_zone": "+01:00",
    "active_time": "2021-11-21T12:48:35+00:00",
    "create_time": "2020-01-04T14:53:09+00:00",
    "update_time": "2022-01-20T19:43:07+00:00",
    "function": {
      "temp_set": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": 0,
          "max": 37,
          "scale": 0,
          "step": 1
        }
      },
      "switch": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status_range": {
      "temp_current": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": -9,
          "max": 99,
          "scale": 0,
          "step": 1
        }
      },
      "temp_set": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": 0,
          "max": 37,
          "scale": 0,
          "step": 1
        }
      },
      "switch": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status": {
      "switch": false,
      "temp_set": 20,
      "temp_current": 17
    },
    "home_assistant": {
      "name": "Slaapkamer",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": []
    }
  }
}
frenck commented 2 years ago

According to the logs posted, it goes south on max_scaled which is the max temperature value scaled to consumable format.

  File "/usr/src/homeassistant/homeassistant/components/tuya/base.py", line 34, in max_scaled
    return self.scale_value(self.max)
  File "/usr/src/homeassistant/homeassistant/components/tuya/base.py", line 48, in scale_value
    return value * 1.0 / (10 ** self.scale)
TypeError: can't multiply sequence by non-int of type 'float'

I can't reproduce the issue on my end, using the latest code from beta, combined with your diagnostics information

image

In the bottom left, it shows 37 as the max temperature, which is correct. It didn't blow up. Do you still have the exact same error message when running the beta? Or has is changed a little?

This beta release does have quite a bit of changed handling with data points, so it might be a "new" issue instead?

ahuntjens commented 2 years ago

Right now indeed seems to have change a little:

image

frenck commented 2 years ago

Aah check, this will be solved by the 2022.2.0b1 (next beta).

If I'm correct this fixes it: https://github.com/home-assistant/core/pull/65009

ahuntjens commented 2 years ago

Would be great! thanks for the effort!

frenck commented 2 years ago

Home Assistant Core 2022.2.0b1 (second beta) has landed. Could you try that one and see if it resolved the issue for you?

ahuntjens commented 2 years ago

image image

Entities are back! Thanks a lot ! Now I can start creating automations again and make heating on the first floor more efficient.

frenck commented 2 years ago

Nice! Thanks for testing @ahuntjens 👍

I'll close this issue in that case.