Skip to content

Support for Sonoff Dual#33

Open
ricardojlrufino wants to merge 1 commit intomdopp:masterfrom
ricardojlrufino:patch-1
Open

Support for Sonoff Dual#33
ricardojlrufino wants to merge 1 commit intomdopp:masterfrom
ricardojlrufino:patch-1

Conversation

@ricardojlrufino
Copy link
Copy Markdown

No description provided.


//switch the device
server.get('/devices/:deviceId/:state', function (req, res) {
server.get('/devices/:deviceId/:index/:state', function (req, res) {
Copy link
Copy Markdown
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