make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.1k stars 449 forks source link

owon_pct513_thermostat does not work properly in Fahrenheit #1996

Closed r-t-s closed 6 days ago

r-t-s commented 1 month ago

Describe the bug The owon_pct513 thermostat does not work properly in US Units. This probably ONLY worked in US Units in 2024.3.3. A change was made since then to support Metric. It looks like the mappings to change the scale and step are not working as expected.

To Reproduce Configure Home Assistant and thermostat with Metric units. Everything works as expected. Configure Home Assistant and thermostat with US units. Initial display of thermostat reading is OK. But can't change the setting because it is trying to scale the value between (approximately) 0 and 1.

Expected behavior Should be able to set thermostat between 41 and 90 degF.

Additional context Add any other context about the problem here.

If the bug involves a device, then please include device diagnostics from Settings / Devices & Services / Tuya Local (your device) / "1 device"

Diagnostics from "Released" owon...yaml file: tuya_local-a983993ba13b031046de86a827d1517a-Bunk Room-c1f89c7b26cdbdd96016dc6ddb44ceef (2).json

You can see from the diagnostic file the improper min and max values as well as the wrong step.

With my modified owon...yaml file: owon_pct513_thermostat.yaml.txt

Diagnostics using MY attached owon...yaml file: tuya_local-a983993ba13b031046de86a827d1517a-Bunk Room-c1f89c7b26cdbdd96016dc6ddb44ceef (3).json

The ramining problem is that the step is still 1/2 degF, in degF units it should be a step of 1 degF. But the temperature is truncated to nearest 1 degF ... so it still works properly. But the user thinks they can specify 1/2 degF setting.

Please check if there are messages from Tuya Local in the Home Assistant log (Settings / System / Logs), and include those too. Logs is as expected considering the incorrect min, max, and step:

File "/config/custom_components/tuya_local/helpers/device_config.py", line 939, in get_values_to_set
raise ValueError(f"{self.name} ({value}) must be between {mn} and {mx}")
ValueError: temp_f (0.5) must be between 41.0 and 90.0

If applicable, add screenshots to help explain your problem. OwonSetting

make-all commented 1 month ago

I think commit 4e378216c3 should fix this

r-t-s commented 1 month ago

I tried this file with 2024.6.0 The degF works. When I change to degC if I change the setpoint on HA, or change the mode, it does not work. It looks like having a mapping inside a condition that sets step and scale is not working. See the diagnostic file:

tuya_local-a983993ba13b031046de86a827d1517a-Bunk Room-c1f89c7b26cdbdd96016dc6ddb44ceef (4).json

On an unrelated issue I submitted a request to Tuya development: Cloud Free Support If that is something you support and can use your voice ... please pass it on.

make-all commented 1 month ago

Thank you for testing both cases here.

make-all commented 1 month ago

The scale and step needed to be directly in the condition. owon was the only config with them nested like this, I seem to recall going through the configs some time ago fixing this problem, so probably this one was missed or was introduced later.