-
Notifications
You must be signed in to change notification settings - Fork 8
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
Notify on keydown #9
Open
inquirer5
wants to merge
15
commits into
sushilks:master
Choose a base branch
from
inquirer5:notify-on-keydown
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3a57ff7
Change to update on key down
21d6254
Update version
0182e76
Add configuration
b433f05
Send action data
0277a29
Merge branch 'master' into notify-on-keydown
M-blip-p f735891
Add logs for disconnect
M-blip-p b8a5bdf
Add status updates and cleanup handlers
M-blip-p 9c14e4a
replace this references
M-blip-p 5e8d465
Additional cleanup
M-blip-p cdf12ec
Fix reference
M-blip-p 64e0859
Remove done callback
M-blip-p ad69f26
Support reconnecting
M-blip-p f48cca2
Add reconnect message
M-blip-p d81ee4a
- Add reconnecting status
M-blip-p b4c740b
Simplify close logic
M-blip-p File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ module.exports = function (RED) { | |
var configNode = RED.nodes.getNode(status.confignode); | ||
this.devName = status.name; | ||
this.devId = parseInt(configNode.deviceMap[this.devName]); | ||
this.sendObj = !!configNode.includeAction; | ||
// register a callback on config node so that it can call this | ||
// node | ||
// then it will call the this.send(msg), msg = {payload: "hi"} | ||
|
@@ -17,20 +18,20 @@ module.exports = function (RED) { | |
/* | ||
for dimmer action is always 1 | ||
for pico action.param | ||
FullOn => a=2, p=4 | ||
up => a=5, p=4 | ||
down => a=6 p=4 | ||
off => a=4, p=4 | ||
FullOn => a=2, p=3 | ||
up => a=5, p=3 | ||
down => a=6 p=3 | ||
off => a=4, p=3 | ||
for on off switch | ||
action =1 p=0 or 100 | ||
*/ | ||
if (action == '1') { | ||
// either dimmre of switch | ||
node.send({ | ||
payload: value | ||
payload: node.sendObj ? d : value | ||
}); | ||
} else if (value === 4) { | ||
var m = ''; | ||
} else if (value === 3 || node.sendObj) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should likely test |
||
var m = action; | ||
if (action === 2) | ||
m = 'on'; | ||
else if (action === 5) | ||
|
@@ -39,8 +40,11 @@ module.exports = function (RED) { | |
m = 'down'; | ||
else if (action === 4) | ||
m = 'off'; | ||
|
||
d.action = m; | ||
d.param = value === 3 ? 'keydown' : 'keyup'; | ||
node.send({ | ||
payload: m | ||
payload: node.sendObj ? d : m | ||
}); | ||
} | ||
} | ||
|
@@ -50,6 +54,14 @@ module.exports = function (RED) { | |
}); | ||
} | ||
}).bind(null, this)); | ||
|
||
const statusHandler = status => this.status(status); | ||
|
||
// Update node status | ||
configNode.statusEvent.on('update', statusHandler); | ||
|
||
// Cleanup on close | ||
this.on('close', () => configNode.statusEvent.removeListener('update', statusHandler)); | ||
} | ||
RED.nodes.registerType('lutron-status', LutronStatusNode); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Pre-existing issue, but this is missing Button 2 (
a=3
), and it's also missing the buttons for the PJ2-4B model (8
/9
/10
/11
), which is rather a problem as that's the model I have 😅