Skip to content

Commit

Permalink
Sync to Tasmota
Browse files Browse the repository at this point in the history
  • Loading branch information
ascillato authored Sep 6, 2019
2 parents 2147c4b + 2fa5833 commit 2b3d137
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions sonoff/_changelog.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* 6.6.0.10 20190905
* Redesign Tuya support by Shantur Rathore (#6353)
* Add command Reset 99 to reset bootcount to zero (#684, #6351)
* Change command Time 1/2/3 to select JSON time format ISO, ISO + Epoch or Epoch for legacy reason
*
* 6.6.0.9 20190828
* Change theoretical baudrate range to 300..19660500 bps in 300 increments (#6294)
Expand Down
4 changes: 2 additions & 2 deletions sonoff/support.ino
Original file line number Diff line number Diff line change
Expand Up @@ -876,13 +876,13 @@ char* ResponseGetTime(uint32_t format, char* time_str)
{
switch (format) {
case 1:
snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str());
snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s\",\"Epoch\":%u"), GetDateAndTime(DT_LOCAL).c_str(), UtcTime());
break;
case 2:
snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":%u"), UtcTime());
break;
default:
snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s\",\"Epoch\":%u"), GetDateAndTime(DT_LOCAL).c_str(), UtcTime());
snprintf_P(time_str, TIMESZ, PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str());
}
return time_str;
}
Expand Down
6 changes: 3 additions & 3 deletions sonoff/support_command.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1271,8 +1271,8 @@ void CmndReset(void)
void CmndTime(void)
{
// payload 0 = (re-)enable NTP
// payload 1 = Time format {"Time":"2019-09-04T14:31:29","Epoch":1567600289}
// payload 2 = Time format {"Time":"2019-09-04T14:31:29"}
// payload 1 = Time format {"Time":"2019-09-04T14:31:29"}
// payload 2 = Time format {"Time":"2019-09-04T14:31:29","Epoch":1567600289}
// payload 3 = Time format {"Time":1567600289}
// payload 4 = reserved
// payload 1451602800 - disable NTP and set time to epoch
Expand All @@ -1283,7 +1283,7 @@ void CmndTime(void)
Settings.flag2.time_format = XdrvMailbox.payload -1;
format = Settings.flag2.time_format;
} else {
format = 0; // {"Time":"2019-09-04T14:31:29","Epoch":1567600289}
format = 1; // {"Time":"2019-09-04T14:31:29","Epoch":1567600289}
RtcSetTime(XdrvMailbox.payload);
}
}
Expand Down

0 comments on commit 2b3d137

Please sign in to comment.