code: function setPossibleStates(id, objarr, options, cb) {
      if (!adapter) return cb && cb('adapter not set');
  	if (options === undefined) options = {};
      if (typeof options === 'function') {
          cb = options;
          options = {};
      }
      adapter.getObject(id, function(err, obj) {
          if (err || !obj) return;
          if (objarr.remove || options.remove) {
              if (obj.common.states === undefined) return cb && cb('does not exist');
              delete obj.common.states;
          } else {
              if (!options.force && obj.common.states) return cb && cb('already set');
              obj.common.states = {};
              if (Array.isArray(objarr)) {
                  objarr.forEach(function (v) {
                      obj.common.states[v] = v;
                  });
              } else {
                  obj.common.states = objarr;
              }
          }
          if (options.removeNativeValues && obj.native) delete obj.native.values;
          adapter.setObject(id, obj, function(err, _obj) {
              cb && cb(err, obj);
          });
      })
  }
docs: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////