I'm currently trying to implement a simple temperature sensor in FLiRS mode. The sensor works when it initiates an update of the temperature (using an interrupt, for example); however, if I query the temperature from the device using my my Z-Wave controller, I oftentimes get readings of the value 0. Does anyone have an idea what I'm doing wrong?
By going through the log, I recognized that there are often two updates that follow a request; one that updates the temperature value to a realistic value and one that updates it to zero.
I'm usually using OpenHAB, however I've also tried the Z-Way server.
The problem also occurs when I return a constant value (other than 0) from the getter function of the channel. Thus, it's not a problem with the sensor.
Here is my current implementation:
Code: Select all
// demo sketch for connecting OneWire temperature sensor DS18B20 to Z-Uno
// add library ds18b20
#include "ZUNO_DS18B20.h"
// pin connection ds18b20
#define PIN_DS18B20 11
OneWire ow(PIN_DS18B20);
// onewire connection temperature sensors
DS18B20Sensor ds1820(&ow);
byte addr1[8];
int temp;
// set up channel
ZUNO_SETUP_CHANNELS(
ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE,
SENSOR_MULTILEVEL_SCALE_CELSIUS,
SENSOR_MULTILEVEL_SIZE_TWO_BYTES,
SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS,
getterTemp)
);
ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE);
ZUNO_SETUP_DEBUG_MODE(DEBUG_ON);
void setup() {
}
void loop() {
delayMicroseconds(250);
ds1820.scanAloneSensor(addr1);
float temperature = ds1820.getTemperature(addr1);
temp = int(temperature*100);
zunoSendReport(1);
zunoSendDeviceToSleep();
}
int getterTemp() {
return temp;
}