Razberry, Z-Uno, Timeparameter.set?

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
KGBEl
Posts: 50
Joined: 21 Feb 2023 00:37

Re: Razberry, Z-Uno, Timeparameter.set?

Post by KGBEl »

Ahh, I missed that.
Is that 3.0.12?
amatilda
Posts: 70
Joined: 26 Sep 2021 22:09

Re: Razberry, Z-Uno, Timeparameter.set?

Post by amatilda »

KGBEl wrote:
19 Mar 2024 23:25
Ahh, I missed that.
Is that 3.0.12?
Yes
KGBEl
Posts: 50
Joined: 21 Feb 2023 00:37

Re: Razberry, Z-Uno, Timeparameter.set?

Post by KGBEl »

Thanks a lot!
KGBEl
Posts: 50
Joined: 21 Feb 2023 00:37

Re: Razberry, Z-Uno, Timeparameter.set?

Post by KGBEl »

Hello again.
Since last time I've tried to make an external RTC work on my Z-Uno 2,
(Re: Is there a Library available for using a Real Time Clock shield).
That did not work so now i'm back and I have tried your suggested use of

Code: Select all

ZUNO_ENABLE(WITH_CC_TIME);
and changed

Code: Select all

#define TIME_PERIOD_REPEAT		
to

Code: Select all

		((uint64_t)10 * 60 * 1000 * 1000)// 10 min
The program takes advantage of:

Code: Select all

zunoAttachSysHandler(ZUNO_HANDLER_NOTIFICATON_TIME_STAMP, 0, (void*) &myUpdateTimeHandler);

But if I don't update the time via TimeParameterClass (Toggle button at the controller) it don't update the time at all.
Though Z-Uno:s internal RTC is about one second slow every minute, gives about 5 minutes every 12 hours,
it would be great if you could correct my misstakes in this small program.

Code: Select all

// ************************************** ShowTime_20250421110316.ino *************************************

    // This sketch uses TimeParameter command class to setup RTC value from controller.
    // You have to call TimeParameter.Set according to you z-wave controller manual.
    
    #include <ZWCCTimerParametrs.h>
    #include <ZWCCTime.h>

    ZUNO_ENABLE(WITH_CC_TIME_PARAMETERS); // Add needed CC

    ZUNO_ENABLE(WITH_CC_TIME);
    
    ZUNO_CUSTOM_CC(ZUNO_CC_VERSION(COMMAND_CLASS_TIME_PARAMETERS, 1)); // Setup custom CC version - add it to NIF
    
    // Just copied from above...
    ZUNO_CUSTOM_CC(ZUNO_CC_VERSION(COMMAND_CLASS_TIME, 1)); // Is this really correct? What about the "1", what is it for.
    
    #define MY_SERIAL Serial

    
    // Calls every time controller sends TimeParameter.Set
    void myUpdateTimeHandler(){

      MY_SERIAL.println("*** Time updated:");
      //MY_SERIAL.println((uint32_t)zunoGetTimeStamp());
      //MY_SERIAL.println(" *** ");
      
    }

    time_t ts;  // Timestamp
    
    void setup(){ 
        
        MY_SERIAL.begin(9600);
        MY_SERIAL.println("************************************** ShowTime_20250421110316.ino *************************************");  
        
        // Bind custom handler to system timestamp notification 
        zunoAttachSysHandler(ZUNO_HANDLER_NOTIFICATON_TIME_STAMP, 0, (void*) &myUpdateTimeHandler);
        
    }
    void loop(){
        
        
        //ts = (zunoGetTimeStamp() + 3600);
        ts = (zunoGetTimeStamp());
        
        // Print timestamp
        MY_SERIAL.printf("*** Current 'TimeStamp:' %lu  ->  ",(uint32_t)ts); // uint32_t
        
        tm timeinfo;
        
        // Transform timestamp to timeinfo
        gmtime_r(&ts, &timeinfo);
        
        // Print date & time in readable format
        MY_SERIAL.printf("%04d-%02d-%02d %02d:%02d:%02d\n\n", timeinfo.tm_year+1900, timeinfo.tm_mon+1, timeinfo.tm_mday,  timeinfo.tm_hour/*timeinfo.tm_hour +1*/, timeinfo.tm_min, timeinfo.tm_sec);
        
        // Wait a little...
        delay(10000);
    }
My guess is that I don't understand how to manage (WITH_CC_TIME).

So my questions is:
What have I done wrong?
and
How can I make it work?
nachtfalke50
Posts: 12
Joined: 30 Apr 2020 16:09

Re: Razberry, Z-Uno, Timeparameter.set?

Post by nachtfalke50 »

Hey, I think the TimeParameter.Set is referring to setting the time on the Z-Wave controller itself. It looks like you might need to use a specific command in the Z-Wave SDK to set it up. Since you're using the Razzberry controller, you should be able to do this via the Z-Wave network API.
KGBEl
Posts: 50
Joined: 21 Feb 2023 00:37

Re: Razberry, Z-Uno, Timeparameter.set?

Post by KGBEl »

Thanks for answer.

TimeParameter.Set is used in the controller for sending the controllers
time to Z-Uno (zway.devices[device_nr].instances[0].commandClasses[139].Set()) and it works perfekt, except for I have
to do it manually from the controller.

WITH_CC_TIME should (as I understand) send controller time automatically depending on period set in ZWCCTime.cpp.
I set the period to 10 minutes but even if time i sent I don't kow how to recieve it in a proper way.
amatilda
Posts: 70
Joined: 26 Sep 2021 22:09

Re: Razberry, Z-Uno, Timeparameter.set?

Post by amatilda »

Hi.

At the moment ZUNO_ENABLE can only be in one instance.

Try this:

Code: Select all

    ZUNO_ENABLE(
		WITH_CC_TIME_PARAMETERS
		WITH_CC_TIME
	);
KGBEl
Posts: 50
Joined: 21 Feb 2023 00:37

Re: Razberry, Z-Uno, Timeparameter.set?

Post by KGBEl »

Thank you for answering.

I changed as you suggested, it updates the first timestamp after start

Code: Select all

�************************************** ShowTime_20250421110316.ino *************************************
*** Current 'TimeStamp:' 1746445769  ->  2025-05-05 11:49:29

*** Current 'TimeStamp:' 1746453888  ->  2025-05-05 14:04:48

*** Current 'TimeStamp:' 1746453898  ->  2025-05-05 14:04:58
It gives the right time within a couple of seconds but it never updates time again, should be
every 10 min, so I don't understand how I can catch "right time" and make use of it in the program.

There has to be something that I have missed to do in the code??
Post Reply