Hey there,
in the gardena smartphone-app you are able to request new data from the sensor. Is there any way to do this from OH2?
May @gerrieg can say something to this?
Greetings
Fabian
Hey there,
in the gardena smartphone-app you are able to request new data from the sensor. Is there any way to do this from OH2?
May @gerrieg can say something to this?
Greetings
Fabian
I don’t have the sensor and therefore i did not know that there is also a command for it. Do you know the command that is sent? Or do you know how to find it out?
If i have the command, i can implement it
not sure if that helps:
out of the Explorer Debugger:
command.send(), abilityName: ambient_temperature , name: measure_ambient_temperature
command.send(), abilityName: light , name: measure_light
command.send(), abilityName: humidity , name: measure_soil_humidity
command.send(), abilityName: radio , name: measure_rf_link
this is the corresponding command.js by gardena (copy from Debugger)
define(‘smartgarden-web/services/command’, [‘exports’], function (exports) {
‘use strict’;
Object.defineProperty(exports, “__esModule”, {
value: true
});
var Service = Ember.Service,
Logger = Ember.Logger,
inject = Ember.inject,
isEmpty = Ember.isEmpty,
RSVP = Ember.RSVP;
exports.default = Service.extend({
store: inject.service(),
flashMessages: inject.service(),
/**
* @param {string} deviceId - the id of the device
* @param {string} abilityName - the ability name you want to refresh
* @param {string} name - the name of the command
* @param {object} parameters - an object with extra params, optional
* @returns {promise} - returns a promise that has been sent to the server
*/
send: function send(deviceId, abilityName, name) {
var _this = this;
var parameters = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
Logger.info('command.send(), abilityName:', abilityName, ', name:', name);
var promise = Ember.RSVP.resolve();
try {
promise = this.create(deviceId, abilityName, name, parameters).save();
} catch (error) {
Logger.error(error.message);
this.get('flashMessages').add({ translationKey: 'Global.Command.Failed' });
}
return promise.catch(function (response) {
return _this._handleCommandPromiseFailure(response);
});
},
/**
* @param {string} deviceId - the id of the device
* @param {string} abilityName - the ability name you want to refresh
* @param {string} name - the name of the command
* @param {object} parameters - an object with extra params, optional
* @returns {promise} - returns a promise that can has not been sent to the server
*/
create: function create(deviceId, abilityName, name) {
var parameters = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
this._validateParams(deviceId, abilityName, name);
return this._createCommand(deviceId, abilityName, name, parameters);
},
_handleCommandPromiseFailure: function _handleCommandPromiseFailure(response) {
this.get('flashMessages').add({ translationKey: 'Global.Command.Failed' });
return RSVP.reject(response);
},
_validateParams: function _validateParams(deviceId, abilityName, name) {
if (isEmpty(deviceId)) {
throw new Error('Parameter devicesId should not be empty');
}
if (isEmpty(abilityName)) {
throw new Error('Parameter abilityName should not be empty');
}
if (isEmpty(name)) {
throw new Error('Parameter name should not be empty');
}
},
_createCommand: function _createCommand(deviceId, abilityName, name) {
var parameters = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var command = this.get('store').createRecord('command');
// SG-854 - ugly fix: avoid exception if ID attribute is missing
command.set('id', 1);
command.set('deviceId', deviceId);
command.set('abilityName', abilityName);
command.set('name', name);
command.set('parameters', parameters);
return command;
}
});
});