Adjust time?
-
Hello
My controller is Domoticz and it set up to show local time so that works, but the time in my sensors/node is off by 2h.
My time 20:00
Sensor shows 18:00Where do I correct this, can't seem to find any config file?
Any idea?
Regards
-
Guess you always could add 60 * 60 * 2 to the time received from controller here:
https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/examples/TimeAwareSensor/TimeAwareSensor.ino#L51
-
Domoticz shows your correct local time, but are you sure that the timezone on the Domoticz "server" is correctly configured?
-
I checked the time on my Raspberry with Putty and it seems correct.
@hek: How do you mean, should I use TimeAwareSensor.ino Im seeing this problem on 'IrrigationController.ino' atm
-
Like I said, add (or subtract) where the time is received. Should be a smililar line in the irrigation controller.
But @pjeterinfo answer is probably better. Check the timezone setting on the Domoticz server.
-
Dident find any similar line, but could this be the problem?
-
Yes, sounds like your problem.
-
thx, dunno how to solve that tho, maybe someone else had the same problem?
-
This is from the Domoticz forum:
At the moment this is used: case I_TIME: //send time in seconds from 1970 with timezone offset { time_t atime = mytime(NULL); struct tm ltime; localtime_r(&atime, <ime); sstr << mktime(<ime); SendCommand(node_id, child_sensor_id, message_type, I_TIME, sstr.str()); } I would expect it to be local time now If your gateway system set to the correct timezone ?
Does the serial gateway modify the time before sending it to the nodes/sensors?
-
No, it doesn't.
-
@moffen666 said:
Does the serial gateway modify the time before sending it to the nodes/sensors?
UTC is the convention for time sync. UTC-local offset has to be adjusted in the callback function.
(I'm adding this because I had the same issue/request for MYSController: one can choose UTC or local time for sync...)
-
Thx tekka
Im way in over my head here, but do I adjust the callback function in my Irrigation controller sketch.
The time reported from my sensors in the webUI is correct its only the time on my LCD in the irrigation controller that's off -2h.
Regards
-
@moffen666 when doen right, it should be fixed in the gateway. Otherwise you need to adjust in all sensors and run into problemen when daylight-saving changes.
-
@tekka said:
UTC is the convention for time sync. UTC-local offset has to be adjusted in the callback function.
(I'm adding this because I had the same issue/request for MYSController: one can choose UTC or local time for sync...)I am a little confused and running into the time difference issue. What is the 'standard' for the controller to report time?
-
If we want to be able to use the same (unmodified) sketch all over the world, I'd put my vote for letting the controller sending out local time (time adjusted).
I do it like that in the Vera plugin anyway.
-
@moffen666 @hek Solved in latest beta of Domoticz thanks to very quick reaction of @GizMoCuz . Domoticz was sending UTC
-
I've got the same problem with Fhem. Does anybody know where to change that in the fhem Module?
-
Amazing, what a great community here and over at Domoticz....
Thank you all so much, just makes me glad!
Regards
-
Is there a Domoticz fix for this? Because if it's returning UTC, you cannot use the time correctly through out the year. UTC doesn't have summer and winter time correction. This means that you have to recalibrate the time in your sensor, depening on the current date. In my opinion things like that should be handled by the Home Automation Server. But that's just my opinion
Ow. Responded to quick. Didn't saw the response of @AWI. I second @moffen666 I love the MySensor and Domoticz community