Open Kirmas opened 3 years ago
After additional research i realise that only second issue is a problem. First - i must configure on my side.
If I use above for set_temperature, I get this erro when trying to set temperature
Failed to call service climate/set_temperature. set_temperature() got an unexpected keyword argument 'entity_id'
Sorry wrong climate.py update.
### **_set_val = round(float(temperature) * divider)_**
If I add this to original in \tuyaha\devices\climate.py nothing changes. Still the same issue that entity becomes unavailable.
@hribaro1 Could you change log verbosity in your HA integration to debug and provide log for me. In my situation. I had ValueOutOfRange message in the log.
@PaulAnnekov What do you thinking about change debug message to warning or error?
A little out of my league. Can you direct me how to change log verbosity?
@hribaro1 https://www.home-assistant.io/integrations/logger/ you need set to debug
I also see OutofRange, but why?
020-11-09 13:06:16 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1895224152] Received {'type': 'call_service', 'domain': 'climate', 'service': 'set_temperature', 'service_data': {'entity_id': 'climate.87760457ecfabc5c425c', 'temperature': 1.5}, 'id': 50} 2020-11-09 13:06:16 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=climate, service=set_temperature, service_data=entity_id=climate.87760457ecfabc5c425c, temperature=1.5> 2020-11-09 13:06:17 DEBUG (SyncWorker_43) [custom_components.tuya_custom.tuyaha.tuyaapi] Tuya request response: {'payload': {}, 'header': {'payloadVersion': 1, 'code': 'ValueOutOfRange'}} 2020-11-09 13:06:17 DEBUG (SyncWorker_43) [custom_components.tuya_custom.tuyaha.tuyaapi] control device error, error code is ValueOutOfRange 2020-11-09 13:06:17 DEBUG (SyncWorker_43) [homeassistant.components.ssdp] Scanning 2020-11-09 13:06:17 DEBUG (SyncWorker_13) [custom_components.tuya_custom.tuyaha.tuyaapi] Discovery: Use cached info 2020-11-09 13:06:17 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=climate.87760457ecfabc5c425c, old_state=<state climate.87760457ecfabc5c425c=heat_cool; hvac_modes=['off', 'heat_cool'], min_temp=0.1, max_temp=12.2, target_temp_step=0.5, current_temperature=2.0, temperature=1.9, tuya_device_id=87760457ecfabc5c425c, friendly_name=Kopalnica otroci, supported_features=1 @ 2020-11-09T13:01:13.271120+01:00>, new_state=<state climate.87760457ecfabc5c425c=unavailable; hvac_modes=['off', 'heat_cool'], min_temp=0.1, max_temp=12.2, target_temp_step=0.5, friendly_name=Kopalnica otroci, supported_features=1 @ 2020-11-09T13:06:17.106736+01:00>> 2020-11-09 13:06:17 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1895224152] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "climate.87760457ecfabc5c425c", "old_state": {"entity_id": "climate.87760457ecfabc5c425c", "state": "heat_cool", "attributes": {"hvac_modes": ["off", "heat_cool"], "min_temp": 0.1, "max_temp": 12.2, "target_temp_step": 0.5, "current_temperature": 2.0, "temperature": 1.9, "tuya_device_id": "87760457ecfabc5c425c", "friendly_name": "Kopalnica otroci", "supported_features": 1}, "last_changed": "2020-11-09T12:01:13.271120+00:00", "last_updated": "2020-11-09T12:01:13.271120+00:00", "context": {"id": "daab05ca8662579396d247a9ba2b64ee", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "climate.87760457ecfabc5c425c", "state": "unavailable", "attributes": {"hvac_modes": ["off", "heat_cool"], "min_temp": 0.1, "max_temp": 12.2, "target_temp_step": 0.5, "friendly_name": "Kopalnica otroci", "supported_features": 1}, "last_changed": "2020-11-09T12:06:17.106736+00:00", "last_updated": "2020-11-09T12:06:17.106736+00:00", "context": {"id": "f2ae42e233001c29f4c7a71fc8aba675", "parent_id": null, "user_id": "ad4f028b25784d1b81685911604ea5dc"}}}, "origin": "LOCAL", "time_fired": "2020-11-09T12:06:17.106870+00:00", "context": {"id": "f2ae42e233001c29f4c7a71fc8aba675", "parent_id": null, "user_id": "ad4f028b25784d1b81685911604ea5dc"}}}
Min and max range is in this case 0.1 - 12.2 and I tried to set 1.5
@hribaro1 This range is the same with Tuya app? Can you check log without my changes? And what devise do you use?
Range of thermostat currently set is 10-30 degrees, but even if I want to set to 11 I have the same error
2020-11-09 15:06:21 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1766847248] Received {'type': 'call_service', 'domain': 'climate', 'service': 'set_temperature', 'service_data': {'entity_id': 'climate.87760457ecfabc5c3ae3', 'temperature': 11}, 'id': 31} 2020-11-09 15:06:21 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=climate, service=set_temperature, service_data=entity_id=climate.87760457ecfabc5c3ae3, temperature=11> 2020-11-09 15:06:22 DEBUG (SyncWorker_45) [custom_components.tuya_custom.tuyaha.tuyaapi] Tuya request response: {'payload': {}, 'header': {'payloadVersion': 1, 'code': 'ValueOutOfRange'}} 2020-11-09 15:06:22 DEBUG (SyncWorker_45) [custom_components.tuya_custom.tuyaha.tuyaapi] control device error, error code is ValueOutOfRange 2020-11-09 15:06:22 DEBUG (SyncWorker_5) [custom_components.tuya_custom.tuyaha.tuyaapi] Discovery: Use cached info 2020-11-09 15:06:22 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=climate.87760457ecfabc5c3ae3, old_state=<state climate.87760457ecfabc5c3ae3=heat_cool; hvac_modes=['off', 'heat_cool'], min_temp=0.1, max_temp=12.2, target_temp_step=0.5, current_temperature=1.9, temperature=1.9, tuya_device_id=87760457ecfabc5c3ae3, friendly_name=Kopalnica starši, supported_features=1 @ 2020-11-09T13:11:28.374923+01:00>, new_state=<state climate.87760457ecfabc5c3ae3=unavailable; hvac_modes=['off', 'heat_cool'], min_temp=0.1, max_temp=12.2, target_temp_step=0.5, friendly_name=Kopalnica starši, supported_features=1 @ 2020-11-09T15:06:22.180919+01:00>>
Type is Xiamen Hysen Control Tuya wifi thermostat
In my case, I have the same data in HA and Tuya. This is my config.
tuya_custom:
devices_config:
- device_name: Siterwell GS361A-H04
unit_of_measurement: "C" # "F" or "C", not set to use value provided from cloud - **In my case this was very important**
temp_divider: 10 # any positive number, all temperature values will be divided by this value
@ollo69 you were the last one who updated climate component. Can you suggest on how to deal with this issue?
@Kirmas
What do you thinking about change debug message to warning or error?
Done.
I think that problem is that the temperature value should not multiplied by divider
in set_temperature
method:
temp_val = set_val = round(float(temperature) * divider)
Unfortunately this is not a rule, because in other cases the transformation is correct. Probably should be added an option to select the right action, than added an option in HA Tuya Integration to set it properly. I will create a PR when I will be sure about this...
That makes sense. As Tuya API doesn't return model id, we can't handle it entirely in code.
Hello, I have Siterwell GS361A-H04 devise, this devise discovered in your integration, but has a few bugs: 1) His temperature data must be divided by 10 (showing 195 when must be 19.5 etc.) 2) I trying to use https://github.com/ollo69/ha_tuya_custom to avoid this but, when HA try to updete temperature using api, api returned out of range error.
Additional information: Discovery - Try to set 250 Try to set 25
To avoid second issue with ha_tuya_custom i change set_temperature function
def set_temperature(self, temperature): """Set new target temperature."""
But as I understand this change can broke other devise integration.
Sorry for my English. If you misunderstand something ask me please.
Regards, Igor