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

Update tuya.ts #7756

Merged
merged 8 commits into from
Jul 13, 2024
Merged

Update tuya.ts #7756

merged 8 commits into from
Jul 13, 2024

Conversation

oroGithub
Copy link
Contributor

Added new device:
'_TZE204_dapwryy7'
('5.8 GHz human presence sensor')

Added new device:
'_TZE204_dapwryy7'
('5.8 GHz human presence sensor')
correcting lint fail.
next try to comply with lint :)
last try
],
meta: {
tuyaDatapoints: [
[
Copy link
Owner

Choose a reason for hiding this comment

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

Could you also return a presence here (a boolean) and add e.presence() to exposes? Example:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done and tested :)
Now I have to figure out how to get it in here haha. Let's try this

Suggested change
[
[
1,
null,
{
from: (v) => {
const lookup = {none: tuya.enum(0), presence: tuya.enum(1), peaceful: tuya.enum(2), 'small movement': tuya.enum(3), 'large movement': tuya.enum(4)};
const presenceState = Object.entries(lookup).find((i) => i[1].valueOf() === v)[0];
return {
presence: presenceState != 'none',
presence_state: presenceState,
};
},
},
],

src/devices/tuya.ts Outdated Show resolved Hide resolved
@Koenkk
Copy link
Owner

Koenkk commented Jul 11, 2024

Could you also submit a picture for the docs? This can be done by:

  1. Create a fork by clicking here
  2. Go to the public/images/devices directory, Add file -> Upload files
  3. Upload the files and press Commit changes
  4. Press Contribute -> Open pull request -> update title/description -> Create pull request

Make sure that:

  • The filename is MODEL.png (update model accordingly)
  • The size is 512x512
  • The background is transparent (use e.g. Adobe remove background)

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
Copy link
Contributor Author

@oroGithub oroGithub left a comment

Choose a reason for hiding this comment

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

Suggestions implemented-

],
meta: {
tuyaDatapoints: [
[
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done and tested :)
Now I have to figure out how to get it in here haha. Let's try this

Suggested change
[
[
1,
null,
{
from: (v) => {
const lookup = {none: tuya.enum(0), presence: tuya.enum(1), peaceful: tuya.enum(2), 'small movement': tuya.enum(3), 'large movement': tuya.enum(4)};
const presenceState = Object.entries(lookup).find((i) => i[1].valueOf() === v)[0];
return {
presence: presenceState != 'none',
presence_state: presenceState,
};
},
},
],

toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
exposes: [
e
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
e
e.presence(),
e

Comment on lines 10742 to 10751
1,
'presence_state',
tuya.valueConverterBasic.lookup({
'none': tuya.enum(0),
'presence': tuya.enum(1),
'peaceful': tuya.enum(2),
'small movement': tuya.enum(3),
'large movement': tuya.enum(4),
}),
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
1,
'presence_state',
tuya.valueConverterBasic.lookup({
'none': tuya.enum(0),
'presence': tuya.enum(1),
'peaceful': tuya.enum(2),
'small movement': tuya.enum(3),
'large movement': tuya.enum(4),
}),
],

@Koenkk
Copy link
Owner

Koenkk commented Jul 12, 2024

Could you update your code with these changes?

added
- a boolean presence return value and
- e.presence() to exposes
@oroGithub
Copy link
Contributor Author

Could you update your code with these changes?

Done ... I think. I've lost track of things a bit.

oroGithub and others added 2 commits July 12, 2024 13:09
The model name was changed because there was already a picture with the previous model name.
@Koenkk Koenkk merged commit 23336fe into Koenkk:master Jul 13, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Jul 13, 2024

thanks!

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.

2 participants