-
Notifications
You must be signed in to change notification settings - Fork 378
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
Extend normalized payload #800
Extend normalized payload #800
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff already, few comments
vendor/milesight-iot/ws301.js
Outdated
@@ -49,7 +49,7 @@ function normalizeUplink(input) { | |||
return { | |||
data: { | |||
action: { | |||
contactState: input.data.door.toUpperCase() | |||
contactState: input.data.door ? "OPEN":"CLOSED" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is it a boolean? Before you assumed it was a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i think so, im basically copying what is used above:
decoded.door = bytes[i] === 0 ? "close" : "open"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in this case input.data.door
is either close
or open
. Not CLOSE
or OPEN
and not a boolean.
To convert close
or open
to CLOSED
or OPEN
respectively, you need to contactState: input.data.door === "close" ? "CLOSED" : input.data.door === "open ? "OPEN" : undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finally see how it should work now, apologies.
Summary
Extend the normalized payload function to 20 devices.
Changes
Checklist for Reviewers
profileIDs
should not bevendorID
and should be a unique value for every profile.index.yaml
file.