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

DDF add support for Neo TS0601 #7832

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ThiemeNL
Copy link

@ThiemeNL ThiemeNL commented Jul 2, 2024

Product name: Neo siren alarm with battery
Manufacturer: _TZE200_t1blo2bj
Model identifier: TS0601
Device type to add: Siren, but recognized as light

#6112 with help of @Smanar

@ThiemeNL ThiemeNL changed the title DDF add support for Neo _TZE200_t1blo2bj DDF add support for Neo TS0601 Jul 2, 2024
Copy link
Collaborator

@SwoopX SwoopX left a comment

Choose a reason for hiding this comment

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

Hi and thanks for the PR. Besides a couple of minors, there's 1-2 changes to be made to stay consistent with other sirens.

I'm not too sure if the would allow us to remove quite some lines of the current source code presumably dedicated only to this device, but those can also be deleted later on with a seperate PR.

devices/tuya/_TZE200_t1blo2bj_neo_siren.json Outdated Show resolved Hide resolved
"status": "Gold",
"subdevices": [
{
"type": "$TYPE_ON_OFF_LIGHT",
Copy link
Collaborator

Choose a reason for hiding this comment

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

The type warning device would be more appropriate here

Copy link
Collaborator

Choose a reason for hiding this comment

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

The c++ code block tuya siren (they are not using the WD IAS cluster), not possible to use warning device type.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm afraid I have to disagree here, at least partially. With a DDF supported device, the DDF defines what type of device it is, not the device itself anymore (meaning it's changable to your liking). So, if you make a warning device out of it, this generally allows following the expected code paths. Tuya is not blocked here per se.

In case the siren is still not able to sound up, it is more a matter of what you pass over for processing.

Copy link
Author

Choose a reason for hiding this comment

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

I was not able to make it work as a warning device. Changing it to a light was a fix for me. More info at #6112

Comment on lines +75 to +89
{
"name": "state/on",
"write": {
"dpid": 13,
"dt": "0x10",
"eval": "Item.val == 1 ? 1 : 0;",
"fn": "tuya"
},
"parse": {
"dpid": 13,
"eval": "Item.val == 1 ? 0 : 1;",
"fn": "tuya"
},
"default": false
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

None of the sirens/warning devices has this attribute and we should stay consistent as much as possible. I'd rather see the functions move up to state/alert

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment, not possible to use state/alert for tuya siren.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Resource item usage is not (or should not be) limited to a vendor/manufacturer, but generally usable. Therefore, the 3 possible functions define what needs to be done with sent/received data. If that cannot be ensured in this case, we might want to change the (legacy) code to allow this in future. This shouldn't be anything heretic 😂

Copy link
Collaborator

Choose a reason for hiding this comment

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

No It's the same problem for tuya covering.
The DDF core can handle state/on for exemple but not state/open or state/alert.
The problem is not the vendor/manufacturer, but the DDF code. We have already speak about that.

Copy link
Author

Choose a reason for hiding this comment

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

This is the workround. I was not able to get it work as a warning device.

devices/tuya/_TZE200_t1blo2bj_neo_siren.json Outdated Show resolved Hide resolved
devices/tuya/_TZE200_t1blo2bj_neo_siren.json Outdated Show resolved Hide resolved
devices/tuya/_TZE200_t1blo2bj_neo_siren.json Show resolved Hide resolved
devices/tuya/_TZE200_t1blo2bj_neo_siren.json Outdated Show resolved Hide resolved
devices/tuya/_TZE200_t1blo2bj_neo_siren.json Outdated Show resolved Hide resolved
devices/tuya/_TZE200_t1blo2bj_neo_siren.json Outdated Show resolved Hide resolved
devices/tuya/_TZE200_t1blo2bj_neo_siren.json Outdated Show resolved Hide resolved
@ThiemeNL ThiemeNL requested a review from SwoopX July 7, 2024 18:38
@SwoopX
Copy link
Collaborator

SwoopX commented Jul 11, 2024

Took me a while to have a closer look. Thanks for the recent changes, the majority seems to look fine. I'm afraid this PR doesn't get my vote to get merged for a couple of reasons. Let me try to explain:

  1. The light should use state/alert as previously mentioned for consistency
    In contrast to Smanar's believe that anything for Tuya is blocked, anything is workable for any device. Especially the DDF code is so rediciously simple to have all light related resource items work with DDFs that I couldn't believe it at the beginning. What is adding complexity here, admittedly, are the various Tuya hacks already in the code. This gives me the creeps and they should go as soon as possible, even with the risk of breaking stuff imho. The longer that code stays, the more difficult wil it be to remove it.
  2. The DDF will only work for 1 of the 2 manufacturer/modelid combinations mentioned (siren usage more precisely)
    For the TZE204 manufacturer, it should not be possible to sound the alarm via DDF, as the hacks prohibit that in general by tumbling down a spaghetti code rabbit hole. @ThiemeNL I assume you have the TZE200 variant? Even with that, one need to know what to put into the DDF unfortunately

Having said that, @ThiemeNL could you please let us know with which value you test state/alert? Please redo with a type other than "warning device".

@Smanar
Copy link
Collaborator

Smanar commented Jul 12, 2024

In contrast to Smanar's believe that anything for Tuya is blocked, anything is workable for any device. Especially the DDF code is so rediciously simple to have all light related resource items work with DDFs that I couldn't believe it at the beginning. What is adding complexity here, admittedly, are the various Tuya hacks already in the code. This gives me the creeps and they should go as soon as possible, even with the risk of breaking stuff imho. The longer that code stays, the more difficult wil it be to remove it.

You don't remember ? with DDF to send request (all is working for incoming request), you can use only state/on state/bri (with this PR #5868 ), not possible to use state/lift for exemple, make a try on your side on a covering, you can reverse a return but not reverse the request.
All is possible using "config" endpoint but not the "state".

And it's not locked for tuya, it's locked for ALL brands. You need to use defaut request or give up.

@SwoopX
Copy link
Collaborator

SwoopX commented Jul 12, 2024

You don't remember ? with DDF to send request (all is working for incoming request), you can use only state/on state/bri (with this PR #5868 ), not possible to use state/lift for exemple, make a try on your side on a covering, you can reverse a return but not reverse the request. All is possible using "config" endpoint but not the "state".

And it's not locked for tuya, it's locked for ALL brands. You need to use defaut request or give up.

No, I indeed do not remember that one, thanks for sharing. That also finally helped me explaining why it is working at all with state/on, was about to say it's a coincidence and following the legacy code paths while using some unexplainable zigbee Tuya glitches 🙂 However, it's not here and a state change is truly used though located at a very unexpected location.

However, all this doesn't change anything on my overall position. Everything is possible with DDFs, so I'll neither go with the default requests nor will I give up. In essence, adding a single line of code would be sufficient but practically, it will be just a few more. The current state changes are created, but not set up correctly. Will raise some PRs for making sirens and covers work shortly.

Copy link
Contributor

github-actions bot commented Aug 7, 2024

Hey @ThiemeNL, thanks for your pull request!

Tip

Modified bundles can be downloaded here.
Relative expire date

DDB changes

Modified

  • tuya/_TZE200_t1blo2bj_neo_siren.json : Neo (Tuya) smart siren ❌
    • Invalid enum value. Expected item from generic attributes definition, received 'config/on' - Invalid enum value. Expected item from generic attributes definition, received 'state/alarm' - The device is missing the device definition (subdevice1.schema.json) for the type "$TYPE_ALARM_SENSOR"

Validation

Caution

Some errors have been reported. Please check the error annotations here and the logs here.

🕜 Updated for commit 84492a2

@Zehir
Copy link
Collaborator

Zehir commented Aug 7, 2024

Not sure what is the problem reported by the validator because the file exist. Maybe an update of the base branch could help

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.

4 participants