How to match device value data type in Homeseer?

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
Jors Vandoren
Posts: 5
Joined: 21 Jul 2018 21:02

How to match device value data type in Homeseer?

Post by Jors Vandoren »

Hello,

I've made a circuit for a fluxmeter based on the Z-uno device from Zwave>Me and the GA1A1S202WP device from AdaFruit.
I've added the corresponding sketch to show how the datatype is defined in the Z-uno device.

Code: Select all

 
/*  Test sketch for the Adafruit Analog Light Sensor 

Connect lightsensor output to Analog Pin 1 
Connect 12v to VCC (7 to 18V)  
Connect pin GND to GND  
Connect pin 3.3v to pin A0 (as EXTERNAL REF) 
*/

// outputpin of GA1A1S202WP on pin A1 (second analog input)

#define PIN_GA A1

// setup the z-wave parameters

ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_ALWAYS_AWAKE);
ZUNO_SETUP_ASSOCIATIONS(ZUNO_ASSOCIATION_GROUP_SET_VALUE);

// set up channels

ZUNO_SETUP_CHANNELS(
   ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_LUMINANCE,
							SENSOR_MULTILEVEL_SCALE_LUX,
							SENSOR_MULTILEVEL_SIZE_FOUR_BYTES,
							SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS,
							getterLux)
);

float rawRange = 1024;  // maxvalue at 3.3V measurement
float logRange = 5.0;   // 3.3V ==> 10^5 lux
int   rawValue;         // measured value 0 to 1024
float logLux;           // intermediate value for calculation
float LuxValue;         // Calculated measured value in Lux

void setup() {
    
analogReference(EXTERNAL); // define A0 as external reference for the ADC connected to 3.3V pin
 
   Serial.begin();
    Serial.println("Adafruit Analog Light sensor test");  
}

void loop() {
    // obtaining readings from the sensor GA1A1S202WP

    rawValue = analogRead(PIN_GA);  
    Serial.print("Raw = ");
    Serial.print(rawValue);
    Serial.print(" - Lux = ");
    LuxValue = RawToLux(rawValue);
    Serial.println(LuxValue);
    
// send data to channel

    zunoSendReport(1);

 // send every 10 seconds

    delay(10000);
}

float RawToLux(int raw)
{
  float logLux = raw * logRange / rawRange;
  return pow(10, logLux);
}



float getterLux() 
{
    return LuxValue;
}
The electronics are working and are reporting the expected values in the serial monitor of the arduino IDE.
Serial monitor report.PNG
Serial monitor report.PNG (24.45 KiB) Viewed 3154 times
But I can't match the right datatype in HS3 for the device value.
The created device in HS3 when including the device into the z-wave network has apparently a 1 byte datatype.
Do I need to add something in the setup of the channel?
DeviceInfo1.PNG
DeviceInfo1.PNG (47.37 KiB) Viewed 3154 times
Serial monitor report.PNG
Serial monitor report.PNG (24.45 KiB) Viewed 3154 times

The device value is regulary refreshed but reports always 255 or 2,55(looks like it is overblown).
It looks like the Luminance device is always reporting it's max value of 255 (1byte).

How can I match the HS3 device value datatype to the one defined in the sketch (C# float (4bytes))?

I've posted this question on the Homeseer HS3 forum but got no answer leading to a solution yet.
https://forums.homeseer.com/showthread.php?t=196859

Is there any kind of certification process needed to get a sketch running on Homeseer?
I understand this could be needed for the device Z-uno to work with the Z-wave plugin in HS3 and from what I've been reading on this forum I expected this was the case with the Z-Wave plugin as of version 3.0.1.146?

thanks,

Joris
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: How to match device value data type in Homeseer?

Post by PoltoS »

Do not use float, but DWORD in your getter, because you use SENSOR_MULTILEVEL_SIZE_FOUR_BYTES
Jors Vandoren
Posts: 5
Joined: 21 Jul 2018 21:02

Re: How to match device value data type in Homeseer - SOLVED

Post by Jors Vandoren »

Thanks, the float was my mistake. All is working as intended.
Post Reply