GithubHelp home page GithubHelp logo

Comments (25)

PlusPlus-ua avatar PlusPlus-ua commented on July 4, 2024

Hi, thank you!

I think your issue contains all needed information, will try to add the device tomorrow.

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

@PlusPlus-ua Are there any updates on this? If you could give some general guidelines about how to add the support for this, I'd take a stab at it. Maybe this will serve as a general document for anyone willing to contribute to this project too.

from ha_tuya_ble.

PlusPlus-ua avatar PlusPlus-ua commented on July 4, 2024

Sorry, was quite busy on the work plus sleepless nights due to russian rocket strikes.

Your device needs new entity type - climate to be added to sources.

After that, adding new thermostat devices will be easy. I'll describe it in documentation later.

from ha_tuya_ble.

PlusPlus-ua avatar PlusPlus-ua commented on July 4, 2024

Could you please describe min and max target temperature for the device, it is absent from the original issue.

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

I'm sorry to hear that. I hope you and your family are in a safe place.

I don't find any configuration in the UI for min and max temperatures. On the TRV itself, the min temp I can set is always 5 and the max is 30. I think this setting is read only anyway and it is not very important.

from ha_tuya_ble.

PlusPlus-ua avatar PlusPlus-ua commented on July 4, 2024

I've added climate support, it's just first version, so I expect some errors.

from ha_tuya_ble.

Yokosa avatar Yokosa commented on July 4, 2024

Hi @PlusPlus-ua thank you very much for your work.

After adding the devices I have this error in the logs:

`Logger: homeassistant.components.climate
Source: custom_components/tuya_ble/climate.py:133
Integration: Klimat (documentation, issues)
First occurred: 20:38:38 (2 occurrences)
Last logged: 20:38:56

Error while setting up tuya_ble platform for climate
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/tuya_ble/climate.py", line 292, in async_setup_entry
entities.append(TuyaBLEClimate(
File "/config/custom_components/tuya_ble/climate.py", line 133, in init
self._attr_preset_modes = list(mapping.preset_mode_dp_ids.keys())
AttributeError: 'set' object has no attribute 'keys'`

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

Im getting a different error:

Logger: homeassistant.config_entries
Source: components/bluetooth/wrappers.py:272
First occurred: 1:14:45 AM (3 occurrences)
Last logged: 2:33:20 AM

Error setting up entry Thermostatic Radiator Valve 3498DE for tuya_ble
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/tuya_ble/__init__.py", line 45, in async_setup_entry
    await device.initialize()
  File "/config/custom_components/tuya_ble/tuya_ble/tuya_ble.py", line 280, in initialize
    await self.update()
  File "/config/custom_components/tuya_ble/tuya_ble/tuya_ble.py", line 320, in update
    await self._send_packet(TuyaBLECode.FUN_SENDER_DEVICE_STATUS, bytes())
  File "/config/custom_components/tuya_ble/tuya_ble/tuya_ble.py", line 851, in _send_packet
    await self._ensure_connected()
  File "/config/custom_components/tuya_ble/tuya_ble/tuya_ble.py", line 601, in _ensure_connected
    client = await establish_connection(
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 344, in establish_connection
    await client.connect(
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/wrappers.py", line 272, in connect
    connected = await super().connect(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/bleak/__init__.py", line 531, in connect
    return await self._backend.connect(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 204, in connect
    reply = await self._bus.call(
  File "/usr/local/lib/python3.10/site-packages/dbus_fast/aio/message_bus.py", line 371, in call
    await future
asyncio.exceptions.CancelledError

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

Also:

This error originated from a custom integration.

Logger: custom_components.tuya_ble.tuya_ble.tuya_ble
Source: custom_components/tuya_ble/tuya_ble/tuya_ble.py:601
Integration: Tuya BLE
First occurred: 1:07:36 AM (21 occurrences)
Last logged: 2:33:05 AM

DC:23:4D:34:98:DE: device not found, not in range, or poor RSSI: None
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 204, in connect
    reply = await self._bus.call(
  File "/usr/local/lib/python3.10/site-packages/dbus_fast/aio/message_bus.py", line 371, in call
    await future
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 344, in establish_connection
    await client.connect(
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/wrappers.py", line 272, in connect
    connected = await super().connect(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/bleak/__init__.py", line 531, in connect
    return await self._backend.connect(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 141, in connect
    async with async_timeout(timeout):
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/tuya_ble/tuya_ble/tuya_ble.py", line 601, in _ensure_connected
    client = await establish_connection(
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 361, in establish_connection
    _raise_if_needed(name, device.address, exc)
  File "/usr/local/lib/python3.10/site-packages/bleak_retry_connector/__init__.py", line 310, in _raise_if_needed
    raise BleakNotFoundError(msg) from exc
bleak_retry_connector.BleakNotFoundError: DC:23:4D:34:98:DE - DC:23:4D:34:98:DE: Failed to connect: 

from ha_tuya_ble.

PlusPlus-ua avatar PlusPlus-ua commented on July 4, 2024

Stupid error in climate entity, exactly as I've expected :)

I've committed changes, but haven't created a new version. Update please sources on your HA server from GitHub and restart HA.

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

The device is now detected and shows up immediately. However, the controls and entities do not seem to appear. Whatever shows is disabled and does not have a name. I'm not sure what degree control (-6 in the screenshot) refers toScreenshot_20230604-100958_Home Assistant.png

from ha_tuya_ble.

PlusPlus-ua avatar PlusPlus-ua commented on July 4, 2024

Any errors in the log?

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024
Logger: homeassistant.components.climate
Source: custom_components/tuya_ble/climate.py:277
Integration: Climate (documentation, issues)
First occurred: 10:09:22 AM (2 occurrences)
Last logged: 10:09:22 AM

Error adding entities for domain climate with platform tuya_ble
Error while setting up tuya_ble platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 648, in _async_write_ha_state
    available = self.available  # only call self.available once per update cycle
  File "/config/custom_components/tuya_ble/climate.py", line 277, in available
    if result and self._mapping.is_available:
AttributeError: 'TuyaBLEClimateMapping' object has no attribute 'is_available'

from ha_tuya_ble.

PlusPlus-ua avatar PlusPlus-ua commented on July 4, 2024

Fixed, try again

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

It's the same result. I've tried re-adding the device.

But there seems to be a new error:

Logger: homeassistant.components.climate
Source: custom_components/tuya_ble/climate.py:133
Integration: Climate (documentation, issues)
First occurred: 11:28:10 AM (1 occurrences)
Last logged: 11:28:10 AM

Error while setting up tuya_ble platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/tuya_ble/climate.py", line 292, in async_setup_entry
    entities.append(TuyaBLEClimate(
  File "/config/custom_components/tuya_ble/climate.py", line 133, in __init__
    self._attr_preset_modes = list(mapping.preset_mode_dp_ids.keys())
AttributeError: 'set' object has no attribute 'keys'

from ha_tuya_ble.

PlusPlus-ua avatar PlusPlus-ua commented on July 4, 2024

That's strange, it looks like you have returned a previous version of code.

Ok, I've excluded away mode for now. Let's try to debug all another.

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

I've made sure I'm on the latest commit by comparing the contents of the climate.py file between main and my local copy. Unfortunately, nothing has changed in regard to the UI, but if I enable some of the disabled entities they do show icons (like antifrost, child lock...). The names are still not showing (they all have the name "Thermostatic Radiator Valve" but nothing specific like child lock or antifrost).

The latest error is:

Logger: homeassistant.components.climate
Source: components/climate/__init__.py:366
Integration: Climate (documentation, issues)
First occurred: 12:14:19 PM (4 occurrences)
Last logged: 12:15:50 PM

Error adding entities for domain climate with platform tuya_ble
Error while setting up tuya_ble platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 242, in state
    if self.hvac_mode is None:
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 366, in hvac_mode
    return self._attr_hvac_mode
AttributeError: 'TuyaBLEClimate' object has no attribute '_attr_hvac_mode'

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024
Screenshot 2023-06-04 at 12 30 27 PM Screenshot 2023-06-04 at 12 30 25 PM

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

Actually something has changed in the UI, the main temperature control has showed up, but it's unavailable

from ha_tuya_ble.

PlusPlus-ua avatar PlusPlus-ua commented on July 4, 2024

Have no idea what is the error, but possible fixed

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

Seems to work now! Thanks!

One issue though: the current temp needs to be divided by 10

Screenshot_20230604-160217_Home Assistant.png

Do you know why the other switches do not show specific names? The entities IDs also lack suffixes like _antifreeze and _child_lock. Instead, they just use a number. Can I help with that?

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

I've adjusted the coefficient value for target temp, which fixed the issue. But actually setting the temperature to a new value does not seem to be working.

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

It turns out there's an issue in async_set_temperature where the temp is mistakenly being multiplied by the humidity coefficient instead of the target temperature coefficient.

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

I'll contribute my fixes as soon as I've tested them all

from ha_tuya_ble.

forabi avatar forabi commented on July 4, 2024

Update here: #28

from ha_tuya_ble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.