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

Support for Sonoff Dual #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ricardojlrufino
Copy link

No description provided.

@@ -55,7 +55,7 @@ server.get('/devices/:deviceId/status', function (req, res) {
});

//switch the device
server.get('/devices/:deviceId/:state', function (req, res) {
server.get('/devices/:deviceId/:index/:state', function (req, res) {
Copy link
Owner

Choose a reason for hiding this comment

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

Sorry, but this would break the compatibility with the existing implementation. Could you create a secound "get" with this parameter? You might want to export the functionality to a new function and call it by both paths.

function devices(deviceId, index, state, res) {
....
}

server.get('/devices/:deviceId/:index/:state', function (req, res) {
devices(req.params.deviceId, req.params.index, req.params.state, res)
}

server.get('/devices/:deviceId/:state', function (req, res) {
devices(req.params.deviceId, req.params.index, req.params.state, res)
}

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