-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Difference Causing issues w/ Home Assistant Integration #11
Comments
Hi, I am also getting issues like the following one: Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 576, in _async_add_entities
await coro
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 865, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1328, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1052, in __async_calculate_state
attr.update(self.state_attributes or {})
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1202, in state_attributes
data[ATTR_BRIGHTNESS] = self.brightness
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tuya/light.py", line 648, in brightness
brightness = self._brightness.remap_value_to(brightness)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tuya/base.py", line 63, in remap_value_to
return remap_value(value, self.min, self.max, to_min, to_max, reverse)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 16, in remap_value
return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int'
2024-03-18 23:37:25.678 ERROR (MainThread) [homeassistant.components.light] Error adding entity light.bathroom_light for domain light with platform tuya
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 576, in _async_add_entities
await coro
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 865, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1328, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1052, in __async_calculate_state
attr.update(self.state_attributes or {})
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1202, in state_attributes
data[ATTR_BRIGHTNESS] = self.brightness
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tuya/light.py", line 648, in brightness
brightness = self._brightness.remap_value_to(brightness)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tuya/base.py", line 63, in remap_value_to
return remap_value(value, self.min, self.max, to_min, to_max, reverse)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/tuya/util.py", line 16, in remap_value
return ((value - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min
~~~~~~^~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'str' and 'int' This could be maybe due to this bug. Ref: home-assistant/core#111839 cc: @shihuimiao |
+1 for adding non-standardized data points Many Smartlife features are currently unavailable in HA because they rely on data points outside the standard set. |
+1 the api version seems to be quite outdated: It uses v1.0 as an endpoint, probably a reason why newer features are not available in HA. Current version seems to be v2.0, which would bring a lot of interesting enhancements. |
In the Tuya IOT platform console when I call the
Query Devices in Home
endpointhttps://openapi.tuyaus.com/v1.0/homes/{home_id}/devices
or theGet Device Status
orGet Device Details
https://openapi.tuyaus.com/v1.0/devices/{device_id}/status
,https://openapi.tuyaus.com/v1.0/devices/{device_id}
I get all of the fields for the device including the fields added by setting theSelect Control Instruction Mode
toDP Instruction
instead ofStandard Instruction
However, the apigw api used in the repo only returns the
Standard Instructions
The text was updated successfully, but these errors were encountered: