Skip to content

Commit

Permalink
accept boolean & string in deviceState.create
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles committed Sep 25, 2016
1 parent 9176b8b commit a49b29a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/core/devicestate/deviceState.create.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
var Promise = require('bluebird');

module.exports = function(state){

if (state.value === true || state.value == 'true') {
state.value = 1;
} else if (state.value === false || state.value == 'false') {
state.value = 0;
}

return DeviceState.create(state)
.then(function(state){
var event = {
Expand Down

0 comments on commit a49b29a

Please sign in to comment.