Hi,
I am sorry. We have a lot of work with new release and have no time to reply fast.
So, I tried your code. It works with my Razberry controller fine (configuration parameters work, I don't have a sensors I just comment all the sensor code).
See the attached screenshot.
The code is
Code: Select all
//#include "BH1750.h"
//#include "BME280.h"
#include <Wire.h>
//BME280 bme280; // Temp/Hum/Pressure Sensor BME280
//BH1750 bh1750; // Light Sensor BH1750
#define MAX_DWORD 4294967295
//#define DEBUG
#define MY_SERIAL Serial0
ZUNO_SETUP_DEBUG_MODE(DEBUG_ON);
// set up channel
ZUNO_SETUP_CHANNELS(
// Temperature
ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE,
SENSOR_MULTILEVEL_SCALE_CELSIUS,
SENSOR_MULTILEVEL_SIZE_TWO_BYTES,
SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS,
getterTemp),
// Pressure
ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_BAROMETRIC_PRESSURE ,
SENSOR_MULTILEVEL_SCALE_KILO_PASCAL,
SENSOR_MULTILEVEL_SIZE_FOUR_BYTES,
SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS,
getterPressureKiloPascal),
// Hum
ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_RELATIVE_HUMIDITY ,
SENSOR_MULTILEVEL_SCALE_PERCENTAGE_VALUE ,
SENSOR_MULTILEVEL_SIZE_ONE_BYTE,
SENSOR_MULTILEVEL_PRECISION_ZERO_DECIMALS,
getterHum),
// Light
ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_LUMINANCE,
SENSOR_MULTILEVEL_SCALE_LUX,
SENSOR_MULTILEVEL_SIZE_TWO_BYTES,
SENSOR_MULTILEVEL_PRECISION_ZERO_DECIMALS,
getterLight)
);
//ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_SLEEPING);
ZUNO_SETUP_BATTERY_LEVELS(2400,3000);
dword lightLuxComp = 0, tempDegreesComp = 0, pressureKiloPascalComp = 0,humPercentComp = 0;
long lightLux = 0,lightLuxOld = 0;
word tempDegrees = 0,tempDegreesOld = 0;
long pressureKiloPascal = 0,pressureKiloPascalOld = 0;
byte humPercent = 0,humPercentOld = 0;
void config_parameter_changed(byte param, dword * value)
{
switch(param)
{
case 64: // Light
lightLuxComp = *value;
break;
case 65: // Temperature
tempDegreesComp = *value;
if (tempDegreesComp>10000) tempDegreesComp=10000;
break;
case 66: // Pressure
pressureKiloPascalComp = *value;
if (pressureKiloPascalComp>10000) pressureKiloPascalComp=10000;
break;
case 67: // Humidity
humPercentComp = *value;
if (humPercentComp>100) humPercentComp=100;
break;
}
}
ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed);
void setup()
{
#ifdef DEBUG
Serial.begin();
#endif
zunoLoadCFGParam(64,&lightLuxComp);
lightLuxComp=(lightLuxComp==MAX_DWORD)?0:lightLuxComp;
MY_SERIAL.println(lightLuxComp);
zunoLoadCFGParam(65,&tempDegreesComp);
tempDegreesComp=(tempDegreesComp==MAX_DWORD)?0:tempDegreesComp;
zunoLoadCFGParam(66,&pressureKiloPascalComp);
pressureKiloPascalComp=(pressureKiloPascalComp==MAX_DWORD)?0:pressureKiloPascalComp;
zunoLoadCFGParam(67,&humPercentComp);
humPercentComp=(humPercentComp==MAX_DWORD)?0:humPercentComp;
//Wire.begin();
}
void readLightSensor()
{
/* bh1750.begin(BH1750_ONE_TIME_HIGH_RES_MODE, BH1750_I2CADDR_LOW);
delay(180); // delay for meassurement of bh1750
bh1750.readLightLevel();
lightLux = bh1750.lightLux + lightLuxComp;*/
}
void readTempSensor()
{
/*
bme280.begin();
bme280.setOversampling(4);
char result = bme280.startMeasurement();
if (result == 0)
{
#ifdef DEBUG
Serial.println("BMx280: Initialisierungsfehler");
#endif
return;
}
tempDegrees = bme280.getTemperature100() + tempDegreesComp;
pressureKiloPascal = (bme280.getPressure100()/10.0) + pressureKiloPascalComp; // x/1000*100 = x/10
humPercent = max(100,bme280.getHum() + humPercentComp);*/
}
void sendData()
{
#ifdef DEBUG
Serial.print("Params: ");
Serial.print(lightLuxComp);
Serial.print(", ");
Serial.print(tempDegreesComp);
Serial.print(", ");
Serial.print(pressureKiloPascalComp);
Serial.print(", ");
Serial.println(humPercentComp);
#endif
#ifdef DEBUG
Serial.print("Light ");
Serial.print(lightLux);
Serial.println(" Lux");
Serial.print("Temperature ");
Serial.print(tempDegrees/100.0);
Serial.println(" C");
Serial.print("Pressure ");
Serial.print(pressureKiloPascal/10);
Serial.println(" kPa");
/*if(bme280.chip_id == 96)
{
Serial.print("Humidity ");
Serial.print(humPercent);
Serial.println(" %");
}*/
#endif
if (tempDegreesOld != tempDegrees)
{
zunoSendReport(1);
tempDegreesOld = tempDegrees;
}
if (pressureKiloPascalOld != pressureKiloPascal)
{
zunoSendReport(2);
pressureKiloPascalOld = pressureKiloPascal;
}
if (humPercent != humPercentOld)
{
zunoSendReport(3);
humPercentOld = humPercent;
}
if (lightLux != lightLuxOld)
{
zunoSendReport(4);
lightLuxOld = lightLux;
}
}
word getterLight()
{
return lightLux;
}
word getterTemp()
{
return tempDegrees;
}
long getterPressureKiloPascal()
{
return pressureKiloPascal;
}
byte getterHum()
{
return humPercent;
}
void loop()
{
#ifdef DEBUG
delay(5000); // time to open the serial console to view debug messages
#endif
readLightSensor();
readTempSensor();
sendData();
zunoSendDeviceToSleep();
}
It looks like I know the reason why it's not working on your board. May be you use the prerelease version(2.1.1 from test-ucxx). Please try to reinstall the latest stable version from the main URL(
http://rus.z-wave.me/files/z-uno/packag ... index.json). To reinstall Z-Uno packages you have to do this:
1. Remove Z-Uno package folder from Arduino (sometthing like <...>/Arduino15/packages/Z-Uno and <...>/Arduino15/packages/staging/Z-Uno - you will see it if you tap to "preferences.txt" link in preferences window of Arduino )
2. Check that you have the right URL in "Additionals Board Manager URLs".
3. Install Z-Uno board (release 2.1.1) using "Board manager".
Alex.