Skip to content

Commit

Permalink
add /blink1/lastColor API endpoint, issue #142
Browse files Browse the repository at this point in the history
  • Loading branch information
todbot committed Jul 1, 2020
1 parent 0c5a5ca commit 5f34ac0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/server/apiServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ app.get('/blink1/fadeToRGB', function(req, res) {
});
});

app.get('/blink1/lastColor', function(req, res) {
var status = "success";
var ledn = Number(req.query.ledn) || 0;
var blink1_id = Number(req.query.blink1_id) || 0; // undefined means all blink1 devices

var color = Blink1Service.getCurrentColor(blink1_id, ledn);

res.json( {
blink1Serials: Blink1Service.getAllSerials(),
lastColor: color.toHexString(),
// lastTime: secs,
lastLedn: ledn,
cmd: "lastColor",
status: status
});
});

app.get('/blink1/pattern(s)?', function(req,res) {
res.json({
status: "pattern results",
Expand Down

0 comments on commit 5f34ac0

Please sign in to comment.