Hi there,
I tried to extend my sketch for my weather sensor with 4 parameters for compensation of measured values. It seems to be really simple, but as always problems occurs
It seems that the configuration callback isn't called at all. At least my parameters are not changing. I tried to add a Serial.print to the function but I doesn't get anything (can it be that Serial isn't allowed in callbacks, I remember I've read somewhere about that).
Do you have any other tips to try?
I can post my sketch if this helps and I'm on 1.6.5.
Thank you, bye!
Config Parameters are note set/received
Re: Config Parameters are note set/received
Have you tried the example presented here: http://z-uno.z-wave.me/Reference/ZUNO_S ... R_HANDLER/ ?
Re: Config Parameters are note set/received
Post your sketch here, or you can send me it by means of PM. Don't worry, we will help you.
Re: Config Parameters are note set/received
No problem, there is no magic in it
I attached it because of the 2 needed local libs.
@Poltos: I copied the example more or less from the blinking sample and changed it a bit. Maybe it has todo with the zuno sleep but I tried it without that and the problem is the same.
I attached it because of the 2 needed local libs.
@Poltos: I copied the example more or less from the blinking sample and changed it a bit. Maybe it has todo with the zuno sleep but I tried it without that and the problem is the same.
- Attachments
-
- zwave_weathersensor.zip
- (8.32 KiB) Downloaded 446 times
Re: Config Parameters are note set/received
Does someone have a working example of user channels?
Re: Config Parameters are note set/received
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
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.
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();
}
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.
- Attachments
-
- Снимок экрана 2017-12-13 в 17.52.40.png (88.61 KiB) Viewed 8717 times
Re: Config Parameters are note set/received
Hi,
i have the same problem. I have latest firmware version 2.1.4 and i unable to receive or set new configuration via Command class.
I'm using ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed) but the function "config_parameter_changed" was never called by the system.
I see on ZWave controller log that the config command was sent successfully. Any idea to resolve? thank you.
i have the same problem. I have latest firmware version 2.1.4 and i unable to receive or set new configuration via Command class.
I'm using ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed) but the function "config_parameter_changed" was never called by the system.
I see on ZWave controller log that the config command was sent successfully. Any idea to resolve? thank you.
Re: Config Parameters are note set/received
Hi,
i fixed the problem changing the option size from 4 to 2 bytes, according to latest 2.1.4 update. Please update the public documentation!
Thank you.
i fixed the problem changing the option size from 4 to 2 bytes, according to latest 2.1.4 update. Please update the public documentation!
Thank you.
Re: Config Parameters are note set/received
Well noted, we will fix the doc