Page 1 of 1

3.0.10 release

Posted: 10 Apr 2023 09:25
by yves
Hello,
Cloud someone explain/develop what is written in the 3.0.10 release note:
  • Time Parameter Command Class added and uses the internal RTC.

is there really an embeded RTC on Z-uno 2?
or is there a link with:
  • Added libraries for ZUnoShield2, DAC102S085, PN7150, Ds1307Rtc, SpiFlash, ModBusRtu.


thanks

Re: 3.0.10 release

Posted: 11 Apr 2023 09:40
by p0lyg0n1
Hi,
ZUno 2 has a built-in RTC timer. It has been used since version 3.09 to get the values of micros()/millis(). The Time Parameter command class is used to set the time on the device from the controller, by default it configures the built-in RTC. In order to use the Time Parameter class, it must be enabled via ZUNO_ENABLE. The Z-Wave controller must also support this class of commands. Some controllers set the time when the device is connected to the network, some have additional items in the device menu for this. In the Z-Way controller, this functionality is located in the Expert Interface in the Expert Commands section. The built-in RTC retains its value up to and including EM4 mode. Example of using the built-in RTC:

Code: Select all

ZUNO_ENABLE(LOGGING_DBG WITH_CC_TIME_PARAMETERS);
ZUNO_CUSTOM_CC(ZUNO_CC_VERSION(COMMAND_CLASS_TIME_PARAMETERS, 1));
#define MY_SERIAL Serial0
void myUpdateTimeHandler(){
    MY_SERIAL.print("*** Time was updated:");
    MY_SERIAL.println((uint32_t)zunoGetTimeStamp());
}
void setup(){ 
    MY_SERIAL.begin();
    MY_SERIAL.println("START!");   
    zunoAttachSysHandler(ZUNO_HANDLER_NOTIFICATON_TIME_STAMP, 0, (void*) &myUpdateTimeHandler);
}
void loop(){
    MY_SERIAL.print("*** Current TS:");
    time_t ts = zunoGetTimeStamp();
    MY_SERIAL.println((uint32_t)ts);
    tm timeinfo;
    gmtime_r(&ts, &timeinfo);
    MY_SERIAL.printf("%02d.%02d.%04d %02d:%02d:%02d\n\n", timeinfo.tm_mday, timeinfo.tm_mon+1, timeinfo.tm_year+1900, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
    delay(1000);
}
Best regards,
Alex.

Re: 3.0.10 release

Posted: 13 Apr 2023 08:27
by yves
Hi Alex,
Thanks I think I will try this today 'against' a Home Center 3

In case of power failure is this RTC backuped by something (battery/superCapa?)

Best regards,
Yves

Re: 3.0.10 release

Posted: 13 Apr 2023 17:10
by yves
Hi Alex,

I have tried and I obtain 'strange' result:
  • Your example works well during integration of the Z-uno2 into the Home center 3 z-wave network,
    and I see the message *** Time was updated:
  • But, if I unplug or reset the module, it restarts with time set to 13.04.2023 12:55:33 and I never see the message *** Time was updated:. Note that 13.04.2023 12:55:33 is may be the time when I try first ?
I am not sure who/where is the culprit between HC3 and Z-uno module...
After a reset, the z-uno module is not supposed to ask time to HC3? is there a way to do so?

Some "progress": in fact the starting time printed after reset or power on is the time of when the code was uploaded, but in GMT+0 instead of GMT+2 (after inclusion time is GMT +2).

thanks,
Yves

Re: 3.0.10 release

Posted: 14 Apr 2023 17:03
by yves
Hi Alex,
  • Just to let you know: I have found a workaround that does not use Time Parameter class but more classical(?) configuration parameters to send Unix time.
    It works...
Two questions:
  • the RTC provided time suffers from a big shift, it underestimates exact time about 1%. I have observed that among 4 Z-uno2 (and in fact it was also the case among 5 old Z-uno1).
    1% sounds acceptable, but this is around 1s every 2 mn or 7 hours/month error.
    Even my very old fashion pendulum clock has better perf ;) !
    May be you should remove R from 'RTC' :D ?
  • With Z-uno2, is there still an overflow issue with the RTC given time after 50days ? (50 days = 2^32 seconds)
Best Regards,
Yves


PS:My discoveries, for people interested in the subject:
  • The embeded RTC is not backuped in case of power loss
  • It restarts with T0 equal to code build time
  • RTC given time is late approx 1% off elapsed time since last time set
  • Fibaro's Home Center 3 does not seem to provide Time Parameter class parameter easily/at all

Re: 3.0.10 release

Posted: 28 Feb 2024 15:37
by KGBEl
Hello, according to above.
I have a Z-Uno ver2, rel 3.0.10, controller Razzberry 7 pro on a RaspBerry 4.

With the same example as above and if z-uno power down, it will, when on again,
show the same time as set when the program where built.

************************************** VisaTiden.ino *************************************
*** Current TimeStamp: 1709118678
2024-02-28 12:11:18

*** Current TimeStamp: 1709118708
2024-02-28 12:11:48

�************************************** VisaTiden.ino *************************************
*** Current TimeStamp: 1709118678
2024-02-28 12:11:18

*** Current TimeStamp: 1709118708
2024-02-28 12:11:48

After built and monitor print, the two above, I disconnected usb from my computer and went for lunch.
When I came back, about an hour later, I connected Z-Uno to my computer and got the last print.

What can I do to be sure that the right time is shown?

Re: 3.0.10 release

Posted: 14 Mar 2024 04:52
by PoltoS
The controller should push the time to Z-Uno. Or it can make requests (in the new 3.0.12b)

Re: 3.0.10 release

Posted: 14 Mar 2024 21:19
by KGBEl
Thank you for answering.

I now how I manually can make the conroller to push timestamp to Z-Uno, via ExpertUI.

How can I for ex. make the controller to auto-push let's say once every 24 hour?

Do you mean that Z-Uno can make a request if I update to 3.0.12b?

How do I do to program that request?

Re: 3.0.10 release

Posted: 15 Mar 2024 05:45
by PoltoS
Add a schedule and run this command in code device

Re: 3.0.10 release

Posted: 15 Mar 2024 16:37
by KGBEl
Thank you very much, tried "Virtual Device (JavaScript)" as Toggle Button, works absolutley perfect.
Thank's again.