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

[Device Support] Neo temperature humidity and illumance sensor quirk #926

Merged
merged 9 commits into from
Aug 25, 2021

Conversation

marciogranzotto
Copy link
Contributor

Implements temperature and humidity for the Neo TS0201 _TZ3000_qaaysllp sensor: #862

Thanks to @blakadder, @Vebryn, and all others involved in the issue discussion!

@walnuss0815
Copy link

Hello @marciogranzotto ,

first: Thanks for your great work! Unfortunately it does not work form me. :( I have added the file to my custom quirk directory and already tried resetting and reconnecting the device. The states of temperature and humidity are unknown and I am getting the following errors:

2021-06-16 23:17:29 WARNING (MainThread) [zigpy.zcl] Unknown cluster 57346
2021-06-16 23:17:29 WARNING (MainThread) [zigpy.zcl] Unknown cluster 57346
.
.
.
2021-06-16 23:18:30 WARNING (MainThread) [zigpy.device] [0x0000] Requesting Node Descriptor failed
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/zigpy/device.py", line 102, in get_node_descriptor
status, _, node_desc = await self.zdo.Node_Desc_req(
File "/usr/local/lib/python3.8/site-packages/zigpy/util.py", line 110, in retry
r = await func()
File "/usr/local/lib/python3.8/site-packages/zigpy/device.py", line 225, in request
result = await asyncio.wait_for(req.result, timeout)
File "/usr/local/lib/python3.8/asyncio/tasks.py", line 501, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
.
.
.
2021-06-16 23:18:46 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xe6c8:1:0x0400]: 'async_configure' stage failed: 'uint8_t' object is not subscriptable
2021-06-16 23:18:46 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xe6c8:1:0x0001]: 'async_configure' stage failed: 'uint8_t' object is not subscriptable

@marciogranzotto
Copy link
Contributor Author

marciogranzotto commented Jun 17, 2021

@walnuss0815 I don't think your problem is releated with this change, since it looks like a communication issue. Can you test if you still have the problem without this code change?

I have two of those sensors and I was able to add them flawlessly

@walnuss0815
Copy link

walnuss0815 commented Jun 17, 2021

I've removed the code change and two of the log messages were gone. After I added the code change again the log messages were back. So it apears that the following log entries are caused by the the code change:

2021-06-17 17:38:47 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x0DAD:1:0x0400]: 'async_configure' stage failed: 'uint8_t' object is not subscriptable
2021-06-17 17:38:47 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x0DAD:1:0x0001]: 'async_configure' stage failed: 'uint8_t' object is not subscriptable
.
.
.
Unknown cluster 57346

@marciogranzotto
Copy link
Contributor Author

marciogranzotto commented Jun 18, 2021

@walnuss0815 but without these changes can you add the device and see its illuminance and battery info?
Also, I just committed a change removing the 0xE002 cluster in the replacement, can you check if that makes any difference?

@blakadder, @Vebryn - do you guys experience the same problem? or it works for you?

@walnuss0815
Copy link

@marciogranzotto right, before I added the file there only were the battery info and the illuminance.

The latest commit did not fix the issue. Temperature and humidity are still unknown.

@marciogranzotto
Copy link
Contributor Author

marciogranzotto commented Jun 27, 2021

Just pushed a new commit that may solve the problem.

However, the tests will fail since the Neo cluster (0xe002) is not on the default cluster list and neither between 0xfc00 and 0xffff
image

Any ideas on how to proceed?

Comment on lines 57 to 73
def __init__(self, device, endpoint_id):
super().__init__(device, endpoint_id)
self.info("Forcing discovery information for Neo custom endpoint")

self.profile_id = zha.PROFILE_ID
self.device_type = DeviceType.TEMPERATURE_SENSOR
self.device_type = zigpy.profiles.zha.DeviceType(self.device_type)

self.add_input_cluster(
TemperatureMeasurement.cluster_id,
TemperatureMeasurement(endpoint=self, is_server=True),
)
self.add_input_cluster(
RelativeHumidity.cluster_id,
RelativeHumidity(endpoint=self, is_server=True),
)
self.status = zigpy.endpoint.Status.ZDO_INIT
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for this. The reason why the replacement endpoint id 2 failed, is because you did not have PROFILE_ID defined in the replacement. I've checked and you can add a new endpoint via replacement

@codecov-commenter
Copy link

codecov-commenter commented Jun 30, 2021

Codecov Report

Merging #926 (2c2922c) into dev (3875b3d) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #926      +/-   ##
==========================================
+ Coverage   82.58%   82.65%   +0.06%     
==========================================
  Files         190      191       +1     
  Lines        4807     4825      +18     
==========================================
+ Hits         3970     3988      +18     
  Misses        837      837              
Impacted Files Coverage Δ
zhaquirks/tuya/neo_TS0201.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3875b3d...2c2922c. Read the comment docs.

@coveralls
Copy link

coveralls commented Jun 30, 2021

Pull Request Test Coverage Report for Build 1156504411

  • 18 of 18 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 82.653%

Totals Coverage Status
Change from base Build 1156500807: 0.06%
Covered Lines: 3988
Relevant Lines: 4825

💛 - Coveralls

Copy link
Contributor

@Adminiuga Adminiuga left a comment

Choose a reason for hiding this comment

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

Flake8 changes

zhaquirks/tuya/neo_TS0201.py Outdated Show resolved Hide resolved
zhaquirks/tuya/neo_TS0201.py Outdated Show resolved Hide resolved
@dmulcahey
Copy link
Collaborator

@Adminiuga good to go?

Copy link
Contributor

@Adminiuga Adminiuga left a comment

Choose a reason for hiding this comment

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

Lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants