ayasystems / PowerMaxEsp8266

PowerMax gateway ESP8266
GNU General Public License v3.0
8 stars 1 forks source link

Time sync #9

Closed Element2 closed 10 months ago

Element2 commented 2 years ago

I am now able to compile without errors, thanks to the latest change. So am now trying to get the panel to sync with the ESP system time. As far as I can see and understand (and that is very little), the time sync is part of this function in the PowerMaxAlarm lib:

//Should be called when panel is enrolled and entered download mode successfully void PowerMaxAlarm::powerLinkEnrolled()

precondition is that the ESP has the system time already set. This happens only when successfully logged on to an MQTT server, right? So we have to wait for that. And the panel should be in download mode.

What I want to try is to activate the time sync when the status of the panel changes to DISARMED. That way I can test if the time is synced when the DISARM button is pushed in the web interface of the ESP. To do this we have to add these calls to the onStatusChange() switch case? :

sendCommand(Pmax_DL_EXIT); sendCommand(Pmax_DL_START); powerLinkEnrolled(); sendCommand(Pmax_DL_EXIT);

But I have no idea if my thinking is correct.

(Not sure what the function os_getLocalTime() should do. I have set the return value to TRUE)

Anyways, I have a feeling you already tried to make the time sync working, but maybe with your knowledge we can give it another try to make it work? I can compile and test against a Powermax system.

ayasystems commented 10 months ago

Put the issue into the library github not here https://github.com/irekzielinski/PowerMaxAlarm