3.0.10 release

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

3.0.10 release

Post 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
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: 3.0.10 release

Post 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.
yves
Posts: 52
Joined: 17 Sep 2021 18:05

Re: 3.0.10 release

Post 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
yves
Posts: 52
Joined: 17 Sep 2021 18:05

Re: 3.0.10 release

Post 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
yves
Posts: 52
Joined: 17 Sep 2021 18:05

Re: 3.0.10 release

Post 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
KGBEl
Posts: 47
Joined: 21 Feb 2023 00:37

Re: 3.0.10 release

Post 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?
User avatar
PoltoS
Posts: 7624
Joined: 26 Jan 2011 19:36

Re: 3.0.10 release

Post by PoltoS »

The controller should push the time to Z-Uno. Or it can make requests (in the new 3.0.12b)
KGBEl
Posts: 47
Joined: 21 Feb 2023 00:37

Re: 3.0.10 release

Post 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?
User avatar
PoltoS
Posts: 7624
Joined: 26 Jan 2011 19:36

Re: 3.0.10 release

Post by PoltoS »

Add a schedule and run this command in code device
KGBEl
Posts: 47
Joined: 21 Feb 2023 00:37

Re: 3.0.10 release

Post by KGBEl »

Thank you very much, tried "Virtual Device (JavaScript)" as Toggle Button, works absolutley perfect.
Thank's again.
Post Reply