Receiving only UTC time from Home Assistant controller
-
I'm not sure if this is a MySensors or Home Assistant issue, but using the example at https://www.mysensors.org/build/display to read the time from my HA controller, it always pulls the UTC time where in the MySensors library documentation here it states that
void receiveTime(unsigned long ts);
returns ts "Adjusted for timezone by controller."I have the time_zone parameter correctly configured in my Home Assistant's configuration.yaml file.
As a workaround I have the sensor node convert the time using this piece of code:
#include <Timezone.h> #include <TimeLib.h> TimeChangeRule CEST = { "CEST", Last, Sun, Mar, 12, 120 }; // Central European Summer Time, 2 hrs offset TimeChangeRule CET = { "CET ", Last, Sun, Nov, 5, 60 }; // Central European Standard Time, 1 hr offset Timezone CE(CEST, CET); : : TimeChangeRule * tcr; time_t t = CE.toLocal(controllerTime, &tcr); RTC.set(t);
But it would good to know if its a bug or I'm just doing something incorrect?
-
@Paul-Derbyshire
Hi!
This is a bug or at least a deviation from the mysensors API. We should fix it. Should be just a matter of using the correct time function, I think.
-
@martinhjelmare is this something I can help contribute too?
-
@Paul-Derbyshire
Yes! Make a PR to pymysensors repository at github. I think
calendar.timegm(time.localtime())
should return the correct time.
-
Suggested Topics
-
Forum Theme Problems
Announcements • 8 Apr 2014, 07:05 • hek 8 Apr 2014, 07:05 -
Node 2 is unknown warning in Homeassistant.
Home Assistant • 10 Mar 2019, 19:27 • badisensors 15 Oct 2024, 20:33 -
2x BME 280 on 2x arduino nano hangs in HomeAssistant
Home Assistant • 27 Jul 2024, 12:25 • HJ_SK 11 Aug 2024, 19:56 -
Home Assistant update changed USB port name
Home Assistant • 14 Jan 2024, 17:25 • therik 15 Jan 2024, 10:26 -
How I delete a node from HA and start over.
Home Assistant • 18 Oct 2024, 02:05 • OldSurferDude 18 Oct 2024, 02:05 -
Where to change settings?
Home Assistant • 15 Mar 2023, 14:58 • eiten 25 Jul 2024, 19:19