Z-Uno2: zunoIsChannelUpdated() not working

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
yves
Posts: 50
Joined: 17 Sep 2021 18:05

Z-Uno2: zunoIsChannelUpdated() not working

Post by yves »

Hi,

It seems that zunoIsChannelUpdated() function is not working (with HC2): it returns false whatever happen.
Here is my config:
  • Z-Uno bootloader version:3.0.9
    Security:none
    Frequency:EU
    Device included:yes
    Device included securely by controller:no
    Controller:Fibaro HC2
And here is the code:

Code: Select all

#include "Arduino.h"
#include "ArduinoTypes.h"

#if (ZUNO_CORE_VERSION_MAJOR < 3)
#error "-------             This code should be complied for ZUNO 2 target"
#endif
#define SPDBGSTART(X) Serial.begin(X)
#define SPDBG(...)      Serial.print(__VA_ARGS__)
#define SPDBGLN(...)    Serial.println(__VA_ARGS__)
#define BUILTIN_LED_PIN 13
 
ZUNO_DISABLE(NO_MULTIBINARY_SWITCH0);
ZUNO_ENABLE(WITH_CC_SENSOR_MULTILEVEL WITH_CC_SENSOR_BINARY WITH_CC_BASIC WITH_CC_SWITCH_MULTILEVEL WITH_CC_SWITCH_BINARY);

uint32_t au32myZwaveValues[10];

 #define MULTILEVELCHAN_TYPE_1   ZUNO_SENSOR_MULTILEVEL_TYPE_TANK_CAPACITY
  #define MULTILEVELCHAN_PROP_1   SENSOR_MULTILEVEL_PROPERTIES_COMBINER(SENSOR_MULTILEVEL_SCALE_LITER, 4, 0)  


ZUNO_SETUP_CHANNELS(
  ZUNO_SWITCH_BINARY(&au32myZwaveValues[0], NULL),
  ZUNO_SWITCH_BINARY(&au32myZwaveValues[1], NULL),
  ZUNO_SWITCH_MULTILEVEL(&au32myZwaveValues[2], NULL),
  ZUNO_SWITCH_MULTILEVEL(&au32myZwaveValues[3], NULL),
  {ZUNO_SENSOR_MULTILEVEL_CHANNEL_NUMBER, MULTILEVELCHAN_TYPE_1, MULTILEVELCHAN_PROP_1,   (void*)&au32myZwaveValues[4], MACRO_CAST_POINTER_TO_VOID(0),  (void*)0, (void*)0},
  {ZUNO_SENSOR_MULTILEVEL_CHANNEL_NUMBER, MULTILEVELCHAN_TYPE_1, MULTILEVELCHAN_PROP_1,   (void*)&au32myZwaveValues[5], MACRO_CAST_POINTER_TO_VOID(0),  (void*)0, (void*)0});
// SETUP      SETUP      SETUP      SETUP      SETUP      SETUP      SETUP     
//_________________________________________________________________________________
void setup() {

  SPDBGSTART(115200);  SPDBGLN("  SetupStart  ");
  
  pinMode(BUILTIN_LED_PIN, OUTPUT);
/*  if(zunoStartDeviceConfiguration()) {
    SPDBGLN("NewConf");
		zunoAddChannel(1,0,0);
		zunoSetZWChannel( 0, 0x01 | ZWAVE_CHANNEL_MAPPED_BIT);
		zunoAddChannel(1,0,0);
		zunoSetZWChannel( 1, 0x02);
    
		zunoAddChannel(2,0,0);
		zunoSetZWChannel( 2, 0x03);
		zunoAddChannel(2,0,0);
		zunoSetZWChannel( 3, 0x04);
    
    zunoAddChannel(ZUNO_SENSOR_MULTILEVEL_CHANNEL_NUMBER,MULTILEVELCHAN_TYPE_1,MULTILEVELCHAN_PROP_1);
		zunoSetZWChannel( 4, 0x05);
    zunoAddChannel(ZUNO_SENSOR_MULTILEVEL_CHANNEL_NUMBER,MULTILEVELCHAN_TYPE_1,MULTILEVELCHAN_PROP_1);
		zunoSetZWChannel( 5, 0x06);
//		zunoAddAssociation(1, 0);
		zunoCommitCfg();
	}
  zunoAppendChannelHandler( 0,  1, CHANNEL_HANDLER_SINGLE_VALUEMAPPER, (void*)&au32myZwaveValues[0]);
	zunoAppendChannelHandler( 1,  1, CHANNEL_HANDLER_SINGLE_VALUEMAPPER, (void*)&au32myZwaveValues[1]);
	zunoAppendChannelHandler( 2,  1, CHANNEL_HANDLER_SINGLE_VALUEMAPPER, (void*)&au32myZwaveValues[2]);
	zunoAppendChannelHandler( 3,  1, CHANNEL_HANDLER_SINGLE_VALUEMAPPER, (void*)&au32myZwaveValues[3]);
	zunoAppendChannelHandler( 4,  4, CHANNEL_HANDLER_SINGLE_VALUEMAPPER, (void*)&au32myZwaveValues[4]);
	zunoAppendChannelHandler( 5,  4, CHANNEL_HANDLER_SINGLE_VALUEMAPPER, (void*)&au32myZwaveValues[5]);*/
 
  SPDBGLN("INIT Done");
}

//  LOOP               LOOP               LOOP               LOOP               LOOP             
//_________________________________________________________________________________
void loop() {
  static uint32_t u32Count=0;
  uint8_t u8i;
  uint8_t u8New = 0;
  uint8_t bChgt=false;

  digitalWrite(BUILTIN_LED_PIN, HIGH);delay(2000);
  digitalWrite(BUILTIN_LED_PIN, LOW);delay(500);
  SPDBG("Map:");SPDBGLN(g_channels_data.update_map);
  for(u8i=0;u8i<6;u8i++)
  { 
    if (zunoIsChannelUpdated(u8i+1))
    {
      SPDBG(u8i);SPDBG(" is new");SPDBGLN(au32myZwaveValues[u8i]);
      u8New++;
    }
  }
  if (u8New == 0)
  {
    SPDBGLN("No news");
    for(u8i=0;u8i<6;u8i++)
    { 
      SPDBGLN(au32myZwaveValues[u8i]);
    }
  }
  au32myZwaveValues[4]=au32myZwaveValues[2]*100;
  au32myZwaveValues[5]=au32myZwaveValues[3]*200;
  zunoSendReport(5);
  zunoSendReport(6);
  u32Count++;
}
During investigations, I have slightly modified ZWSupport.c(&.h) to get access to g_channels_data.update_map : it is effectively always 0.

Have a nice day,
Yves
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Z-Uno2: zunoIsChannelUpdated() not working

Post by p0lyg0n1 »

Hi,
Let's check that the controller correctly detects all channels. Try this example https://z-uno.z-wave.me/examples/Certified10Ch/ for yourself. It contains almost the same channels that you have and it should definitely be displayed correctly in the controller.
If it works, then add zunoIsChannelUpdated() to it and check that the value is changing.
You can check that the data from the controller comes by uncomenting LOGGING_DEBUG, then all incoming packets will be displayed on TX0. If you want to transfer them to USB, add LOGGING_UART=Serial next to LOGGING_DBG.

With respect,
Alex.
yves
Posts: 50
Joined: 17 Sep 2021 18:05

Re: Z-Uno2: zunoIsChannelUpdated() not working

Post by yves »

HI Alex,
My controller detects all channels:
  • Even if it is a complicated job for me (as you know ;) ), at the end, I get all my channels on the HC2 interface.
  • If the zuno board brings modifications to the channels, they are correcty reported on the HC2 interface.
  • Last, but not least, modifications of channels values, made with the HC2 interface (or with scenes), are correctly reported to the corresponding "au32myZwaveValues[ChannelNum-1]"defined at initialization.
The issue is that zunoIsChannelUpdated does not catch the changes brough by the HC2.

Did you notice that, in my joined code, the dynamic inclusion is hidden by /* ---*/ so that channels are (only?) statically included.
May be there is a trick here ?
And all of this may be related to my other question https://forum.z-wave.me/viewtopic.php?p=93719#p93719 ?


Regards,
Yves
yves
Posts: 50
Joined: 17 Sep 2021 18:05

Re: Z-Uno2: zunoIsChannelUpdated() not working

Post by yves »

Hi Alex,

As you asked, I have tried https://z-uno.z-wave.me/examples/Certified10Ch/, first without any modification.

Here are my comments:
  • Inclusion in fibaro HC2 still requires 'my cumbersome 3 steps procedure '
  • when done, HC2 interface looks as (you) waited...
  • once zunoIsChannelUpdated(Channel) is added in loop, the result is the same as in 'my code': it always returns false

Here is my modified test loop:

Code: Select all

void loop() {
  uint8_t u8i;
  uint8_t u8New=0;
  for(u8i=0;u8i<6;u8i++)
  { 
    if (zunoIsChannelUpdated(u8i+1))
    {
      SPDBG(u8i);SPDBGLN(" is new");
      u8New++;
    }
  }
  if (u8New == 0)
  {
    SPDBGLN("No news");
  }
  delay(2000);
My fibaro HC2 firmware version is 4.620, cores are loaded below 20%, Ram use is around 40%, and storage close to 15%
And my 3 included other z-uno1 boards works as expected ;) .
PS: While including, I am close to The fibaro HC2, and I use the "unexplained anywhere" compilation option: TX power ultra +10db.

Regards,
Yves
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Z-Uno2: zunoIsChannelUpdated() not working

Post by p0lyg0n1 »

Hi Yves,
I tried it on my controller and then looked at the system code again and it looks like you're right. At some point we broke the SET command flags. We'll fix it right away - I'll post an update and write here. Thanks for the help with debugging, we missed this feature.

With respect,
Alex.
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Z-Uno2: zunoIsChannelUpdated() not working

Post by p0lyg0n1 »

Hi,
Try the new version. We corrected zunoIsChannelUpdated() in 3.09b9. Reinstall the version. First, delete the old version from the packages folder, then install it as usual via BoardManager.

Best regards,
Alex.
Post Reply