Skip to content
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

Add Nedis TRV ZBHTR20WT - Tuya _TZE200_ne4pikwm #3816

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

prairiesnpr
Copy link
Collaborator

Proposed change

Add Nedis TRV ZBHTR20WT, _TZE200_ne4pikwm and _TZE284_ne4pikwm.

Additional information

Closes: #3517
Based on: https://github.com/Koenkk/zigbee-herdsman-converters/blob/09cfce5153d3931c7cc009aa3ae3107d9b394f5c/src/devices/nedis.ts#L10

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.96%. Comparing base (bd9ecbb) to head (e3214cb).
Report is 3 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #3816   +/-   ##
=======================================
  Coverage   90.96%   90.96%           
=======================================
  Files         327      327           
  Lines       10606    10607    +1     
=======================================
+ Hits         9648     9649    +1     
  Misses        958      958           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label Feb 6, 2025
@checkiecheck
Copy link

hello, any chance this change gets merged for a HA 2025.2 release?

@prairiesnpr
Copy link
Collaborator Author

hello, any chance this change gets merged for a HA 2025.2 release?

Can you confirm it's working for you?

Copy link

@jonas-bork jonas-bork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this! It allowed me to get my thermostat working in Home Assistant :)

However, I had to make some changes to make it fully work. Firstly, though, I want to mention that I'm new to Home Assistant and this repo so maybe my changes are not correct - but they seem to be working for me. Also, I have the _TZE200_ne4pikwm thermostat and have only tested my changes on that one.

I think you forgot to add the frost protection switch. Here's my proposed code for it:

    .tuya_switch(
        dp_id=10,
        attribute_name="frost_protection",
        translation_key="frost_protection",
        fallback_name="Frost protection",
    )

@prairiesnpr
Copy link
Collaborator Author

Thanks for the feedback, I'm focused on fixing the saswell TRVs that broke during the last release, but when that's complete I'll update this and let you test again.

@checkiecheck
Copy link

checkiecheck commented Feb 12, 2025

hello, any chance this change gets merged for a HA 2025.2 release?

Can you confirm it's working for you?

to be honest, it was a decision making question. I tried to use it as custom quirck , but cant seem to activate that. So if this is possible in next release, i'll stop trying custom quirk. activation If it takes more time, i'll invest a bit more to get custom quirk working.

@prairiesnpr prairiesnpr force-pushed the add-_TZE200_ne4pikwm branch 2 times, most recently from c83fcb8 to 6872b63 Compare February 13, 2025 22:00
@sonikki789
Copy link

I could put this up to a test if somebody can tell me what file I should use as custom quirk?

@prairiesnpr
Copy link
Collaborator Author

I could put this up to a test if somebody can tell me what file I should use as custom quirk?

You need tuya_trv.py https://github.com/zigpy/zha-device-handlers/blob/6872b635a87bd5dfb9567086aad2e143c1dbe378/zhaquirks/tuya/tuya_trv.py

@sonikki789
Copy link

I could put this up to a test if somebody can tell me what file I should use as custom quirk?

You need tuya_trv.py https://github.com/zigpy/zha-device-handlers/blob/6872b635a87bd5dfb9567086aad2e143c1dbe378/zhaquirks/tuya/tuya_trv.py

Thanks, got it running :)

@checkiecheck
Copy link

checkiecheck commented Feb 16, 2025

hello, any chance this change gets merged for a HA 2025.2 release?

Can you confirm it's working for you?

got it up now. Just the firmware sensor isnt populating, while it did show something when just paired without the quirk.

oh, another item i spotted. I cant set the max heat value
[0xFC3C:1:0xef00] No cluster_dp found for 1, max_heat_setpoint_limit
[0xFC3C:1:0xef00] no MCU command for data TuyaClusterData(endpoint_id=1, cluster_name='thermostat', cluster_attr='max_heat_setpoint_limit', attr_value=2300, expect_reply=False, manufacturer=-1)
[0xFC3C:1:0xef00] no MCU command for data TuyaClusterData(endpoint_id=1, cluster_name='thermostat', cluster_attr='max_heat_setpoint_limit', attr_value=2100, expect_reply=False, manufacturer=-1)

@prairiesnpr
Copy link
Collaborator Author

oh, another item i spotted. I cant set the max heat value

I didn't expose a max heat DP since it wasn't exposed in z2m. Are you getting a slider for it or just trying to write the attribute directly? If the Tuya app exposes it, we can add it but would need someone to identify the DP, assuming it exists.

@checkiecheck
Copy link

checkiecheck commented Feb 16, 2025

oh, another item i spotted. I cant set the max heat value

I didn't expose a max heat DP since it wasn't exposed in z2m. Are you getting a slider for it or just trying to write the attribute directly? If the Tuya app exposes it, we can add it but would need someone to identify the DP, assuming it exists.

it did expose in device as entity:
image

if it doesnt have info on setting DP, then better not have it at all i suppose (i dont need it)

@prairiesnpr
Copy link
Collaborator Author

if it doesnt have info on setting DP, then better not have it at all i suppose (i dont need it)

Thanks for pointing that out, we do set them as constant attributes, but I wasn't aware that we generated entities for constant attributes, we shouldn't, they are after all constant.

@checkiecheck
Copy link

if it doesnt have info on setting DP, then better not have it at all i suppose (i dont need it)

Thanks for pointing that out, we do set them as constant attributes, but I wasn't aware that we generated entities for constant attributes, we shouldn't, they are after all constant.

agree with that :)

Copy link

@alexanderwwagner alexanderwwagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested your PR and found an issue with the custom quirk.
If the trv is on state heating, homeassistant always shows the state idle:
image

On my other trv from sonoff the state is shown correctly:
image

Unfortunately i don't know how to fix it, otherwise i would have made a suggestion right away!

@prairiesnpr
Copy link
Collaborator Author

Is the running state correct or is it inverted?

@checkiecheck
Copy link

Seems inverted, my schedule starts and turns off, and state is the other way around
Screenshot_2025-02-20-14-51-56-992_io.homeassistant.companion.android.jpg

@prairiesnpr
Copy link
Collaborator Author

See if changing converter=lambda x: RunningState.Heat_State_On if not x else RunningState.Idle, to converter=lambda x: RunningState.Heat_State_On if x else RunningState.Idle, does it.

@checkiecheck
Copy link

Heat_State_On if not x

doenst seem to. Looking at the lines before it wants an attribute running_state. But if i look at attributes in the states screen, i see system mode that gives the info
image
image

@prairiesnpr
Copy link
Collaborator Author

They are actually different, system mode is the mode the thermostat is set to, where running state is the actual current state. So we would expect to see system mode on heat then running state in idle or heat depending on if the thermostat is calling for heat. The heating action is then calculated in ZHA based on system mode and running state, sometimes some other attributes, but mostly those two.

@checkiecheck
Copy link

checkiecheck commented Feb 20, 2025

They are actually different, system mode is the mode the thermostat is set to, where running state is the actual current state. So we would expect to see system mode on heat then running state in idle or heat depending on if the thermostat is calling for heat. The heating action is then calculated in ZHA based on system mode and running state, sometimes some other attributes, but mostly those two.

got it.. i was impatient seemingly, running state is little behind in reporting. The change you proposed does work.
image
image

@alexanderwwagner
Copy link

alexanderwwagner commented Feb 20, 2025

See if changing converter=lambda x: RunningState.Heat_State_On if not x else RunningState.Idle, to converter=lambda x: RunningState.Heat_State_On if x else RunningState.Idle, does it.

Should I change both lines: 131 and 262?
I tried it but now the state is always "heating".

@prairiesnpr
Copy link
Collaborator Author

Should I change both lines: 131 and 262? I tried it but now the state is always "heating".

Try the latest version

@checkiecheck
Copy link

checkiecheck commented Feb 21, 2025

History Looks much better now
IMG-20250221-WA0025.jpg

Heat and idle corrected. Messy yellow lines was me testing

Comment on lines +497 to +502
.tuya_switch(
dp_id=106,
attribute_name="leave_home",
translation_key="leave_home",
fallback_name="Leave home",
)
Copy link
Collaborator

@TheJulianJES TheJulianJES Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something like "Away mode" for the thermostat? If so, I'd probably call it that. It's similar to "schedule mode".

@TheJulianJES TheJulianJES added the smash This PR is close to be merged soon label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
smash This PR is close to be merged soon Tuya Request/PR regarding a Tuya device
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Device Support Request] Nedis ZBHTR20WT TS0601 _TZE200_ne4pikwm Smart Thermostatic Radiator
6 participants