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 -
Home Assistant update changed USB port name
Home Assistant • 14 Jan 2024, 17:25 • therik 15 Jan 2024, 10:26 -
HVAC type sensor in homeassistant
Home Assistant • 17 Aug 2024, 10:50 • tbowmo 17 Aug 2024, 20:51 -
mysensors regularly disconnect from HA
Home Assistant • 1 Oct 2021, 20:25 • keithellis 29 Aug 2023, 18:09 -
Node 2 is unknown warning in Homeassistant.
Home Assistant • 10 Mar 2019, 19:27 • badisensors 15 Oct 2024, 20:33 -
Hi,
Home Assistant • 1 Sept 2024, 20:57 • diltech 1 Sept 2024, 20:57