C API - data callbacks

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
lluzak
Posts: 7
Joined: 09 Jul 2014 00:41

C API - data callbacks

Post by lluzak »

Hi

I have a problem with creating proper callbacks for data changes on devices. I have device with ID=3 which has commandClass 0x20 ( simple switch ), and i would like to create callback for that.

Code: Select all

ZDataHolder basic_level_holder;
ZWBYTE device_id = 3;
basic_level_holder = zway_find_device_instance_cc_data(zway, device_id, 0, 0x20, ".");

if(basic_level_holder)
{
    return zway_data_add_callback(zway, basic_level_holder, (ZDataChangeCallback) print_basic_holder, TRUE, NULL);
}
else
{
    zway_log(zway, Information, ZSTR("data holder is empty\n\n\n"));
    return InvalidArg;
}
Above code is creating callback but, when i'm manually turning switch on and off it's not being fire. What do i wrong ?

I also notice that in Debug mode, when i manually turn switch on device i am getting logs:

Code: Select all

[2014-08-12 21:13:48.226] SETDATA devices.1.instances.1.commandClasses.32.data.srcNodeId = 3 (0x00000003)
[2014-08-12 21:13:48.238] SETDATA devices.1.instances.1.commandClasses.32.data.srcInstanceId = 0 (0x00000000)
[2014-08-12 21:13:48.248] SETDATA devices.1.instances.1.commandClasses.32.data.level = 0 (0x00000000)
Why data are being saved on controller device ?
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: C API - data callbacks

Post by pofs »

lluzak wrote:

Code: Select all

basic_level_holder = zway_find_device_instance_cc_data(zway, device_id, 0, 0x20, ".");
What is "."? There's no such name. For Basic CC you should use "level".
lluzak wrote: I also notice that in Debug mode, when i manually turn switch on device i am getting logs:

Code: Select all

[2014-08-12 21:13:48.226] SETDATA devices.1.instances.1.commandClasses.32.data.srcNodeId = 3 (0x00000003)
[2014-08-12 21:13:48.238] SETDATA devices.1.instances.1.commandClasses.32.data.srcInstanceId = 0 (0x00000000)
[2014-08-12 21:13:48.248] SETDATA devices.1.instances.1.commandClasses.32.data.level = 0 (0x00000000)
Why data are being saved on controller device ?
Check your device parameters. Likely device is sending BASIC_SET to controller instead of sending BASIC_REPORT.
lluzak
Posts: 7
Joined: 09 Jul 2014 00:41

Re: C API - data callbacks

Post by lluzak »

Thanks for reply, is there a way to create global callback for all devices, because for example i would like to listen for changes of 0x20 command class in all devices, which possess this command class. Or i need to explicitly create callback for each one of them ?
lluzak
Posts: 7
Joined: 09 Jul 2014 00:41

Re: C API - data callbacks

Post by lluzak »

I still have problem with data being set in controller instead of device. Even in ExpertUI it's doing exactly the same thing. How can i cange BASIC_SET being set on device instead of controller ?
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: C API - data callbacks

Post by pofs »

lluzak wrote:I still have problem with data being set in controller instead of device. Even in ExpertUI it's doing exactly the same thing. How can i cange BASIC_SET being set on device instead of controller ?
Look into your device manual, it should describe configuration parameters and association groups. It is all device dependent.
lluzak
Posts: 7
Joined: 09 Jul 2014 00:41

Re: C API - data callbacks

Post by lluzak »

thanks, now i get it, but even if i set association group "1", which is responsible for sending notification about state changes, i can't point it to send to my own device, i need it to be pointing to controller, am i right ? some right now the situation, where controller is holding data is correct. The question is, is there a way to reroute this data to my device profile.

#EDIT
nevermind, you were right, the association group "3", which should send information to controller wasn't set. Right i'm getting binary switch CC (0x25).
Post Reply