arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.04k stars 4.78k forks source link

Sonoff POW - Time Issue [1970-01-01] - Not updated #2656

Closed oblansundar closed 6 years ago

oblansundar commented 6 years ago

Hello everyone,

I am using Sonoff POW to monitor Power Consumption Data. I have used the latest version (5.13.1) of Sonoff-Tasmota. I am not able to get the correct time in the data that Sonoff POW sends under the topic - tele//SENSOR. Sample data:

{"Time":"1970-01-01T00:10:13","ENERGY":{"Total":0.025,"Yesterday":0.000,"Today":0.025,"Period":0,"Power":0,"Factor":0.00,"Voltage":223,"Current":0.000}}

output of STATUS 7:

{"StatusTIM":{"UTC":"Thu Jan 01 00:08:38 1970","Local":"Thu Jan 01 00:08:38 1970","StartDST":"Thu Jan 01 00:00:00 1970","EndDST":"Thu Jan 01 00:00:00 1970","Timezone":1}}

output of STATUS 5:

{"StatusNET":{"Hostname":"SONOFF_POW_01-1538","IPAddress":"YYY.YYY.YYY.YYY","Gateway":"YYY.YYY.YYY.YYY","Subnetmask":"255.255.192.0","DNSServer":"A","Mac":"BC:DD:C2:EA:66:02","Webserver":2,"WifiConfig":2}}

-DNS server is A

For Sonoff-Basic in same network:

{"StatusNET":{"Hostname":"SONOFF_BASIC_01","IPAddress":"YYY.YYY.YYY.YYY","Gateway":"YYY.YYY.YYY.YYY","Subnetmask":"255.255.192.0","DNSServer":"A","Mac":"DC:4F:22:2D:C8:A7","Webserver":2,"WifiConfig":2}}

-Same DNS server - no DNS issues here.

Also, I checked the NTP servers. They are all one and the same. So, I think this issue is not something that is network related but something else.

If you could suggest any other methods to set the correct time in this device, it would be helpful.

Thanks, Sundar.

Jason2866 commented 6 years ago

You blacklisted your private ip addresses. Got the pow a valid one? Or have you fixed values? Is the DNS server name resolved? Change for testing the DNS in the POW to a known and working fixed ip address

Frogmore42 commented 6 years ago

You either have a networking issue, but you have deleted all your IP addresses, so not easy to tell (and not necessary if you are using Private IP addresses).

Or, you have the NTP servers misconfigured, but you did not show what Tasmota thinks you want them to be.

Or, you have the much more unlikely issue I encounter when the Internet goes down for an extended period.

There is no output from status 0, which makes it hard to tell if there is enough Wi-Fi signal to get reliable networking. That is the first thing to check.

Next is that the DNS server setup is correct. There is no way to tell from the console if it is actually working or not, but you can tell what the value is. Your output shows "A", which can't be right, so I must assume you hid it for some reason.

Assuming you have a correct IP address there, the next thing is to make sure the values of the time servers are correct. They can get corrupted, so you have to look at the actual values reported by the device and not just the values you configured at some point in time.

Only AFTER you have verified ALL of that is correct AND you have already done a power cycle, you can try the final step. Remove ALL power from the device for at least 30min. Then turn it back on.

I have to do this to some of my devices after an outage because the underlying code in the SDK which is where the real NTP code lives gets confused and will never get the correct time.

Also, you didn't include status 0 info, so we can't tell which framework version you are using. Each version has different issues, which is why there is a request for that information in the issue template.

oblansundar commented 6 years ago

@Jason2866 But the Sonnoff POW and Sonoff Basic has the same DNS. Not sure why Sonoff POW is only not able to resolve. But as per your suggestion, I will try changing the DNS of Sonoff POW to 8.8.8.8 and see what happens.

Jason2866 commented 6 years ago

@oblansundar With more infos as @Frogmore42 noticed it would be a more systematic error search. You can post your ip adresses if you use peivate ip addresses (like 192.168.xxx.xxx or 10.0.x.x)

jeylites commented 6 years ago

I'm having the same issue NTP not sync wit local clock. I tried a few combination of servers, reboot boot AP router,

Hardware: Sonoff T1 Touch UK Tasmota: 5.13.1a Core: 2.4.1

/ -- Time - Up to three NTP servers in your region
#define NTP_SERVER1            "pool.ntp.org"       // [NtpServer1] 
#define NTP_SERVER2            "my.pool.ntp.org"    // [NtpServer2]
#define NTP_SERVER3            "3.asia.pool.ntp.org"  // [NtpServer3]
// -- Application ---------------------------------
#define APP_TIMEZONE           8                 // [Timezone]
00:00:00 Project ves1 VES 1 (Topic ves1, Fallback 24, GroupTopic sonoffs) Version 5.13.1a-2_4_1
00:00:00 WIF: Connecting to AP1 SUGAR in mode 11N as ves1-1256...
00:00:04 WIF: Connected
00:00:04 HTP: Web server active on ves1-1256 with IP address 192.168.0.24
00:00:05 MQT: Attempting connection...
00:00:05 MQT: Connected
00:00:05 MQT: tele/ves1/LWT = Online (retained)
00:00:05 MQT: cmnd/ves1/POWER = 
00:00:05 MQT: tele/ves1/INFO1 = {"Module":"Sonoff T1 3CH","Version":"5.13.1a","FallbackTopic":"24","GroupTopic":"sonoffs"}
00:00:05 MQT: tele/ves1/INFO2 = {"WebServerMode":"Admin","Hostname":"ves1-1256","IPAddress":"192.168.0.24"}
00:00:05 MQT: tele/ves1/INFO3 = {"RestartReason":"Software/System restart"}
00:00:06 MQT: stat/ves1/RESULT = {"POWER1":"OFF"}
00:00:06 MQT: stat/ves1/POWER1 = OFF
00:00:06 MQT: stat/ves1/RESULT = {"POWER2":"OFF"}
00:00:06 MQT: stat/ves1/POWER2 = OFF
00:00:06 MQT: stat/ves1/RESULT = {"POWER3":"ON"}
00:00:06 MQT: stat/ves1/POWER3 = ON
00:00:13 MQT: tele/ves1/STATE = {"Time":"1970-01-01T00:00:13","Uptime":"0T00:00:13","POWER1":"OFF","POWER2":"OFF","POWER3":"ON","Wifi":{"AP":1,"SSId":"SUGAR","RSSI":100,"APMac":"88:D7:F6:02:18:80"}}
00:00:13 MQT: stat/ves1/RESULT = {"POWER1":"OFF"}
00:00:13 MQT: stat/ves1/POWER1 = OFF
00:00:13 MQT: stat/ves1/RESULT = {"POWER2":"OFF"}
00:00:13 MQT: stat/ves1/POWER2 = OFF
00:00:13 MQT: stat/ves1/RESULT = {"POWER3":"ON"}
00:00:13 MQT: stat/ves1/POWER3 = ON
00:00:40 CMD: status 0
00:00:40 MQT: stat/veshinu1/STATUS = {"Status":{"Module":30,"FriendlyName":["VES 1","VES 12","VES 13"],"Topic":"ves1","ButtonTopic":"0","Power":4,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"ButtonRetain":0,"PowerRetain":0}}
00:00:40 MQT: stat/ves1/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://sonoff.maddox.co.uk/tasmota/sonoff.bin","RestartReason":"Software/System restart","Uptime":"0T00:00:40","StartupUTC":"","Sleep":0,"BootCount":4,"SaveCount":26,"SaveAddress":"FA000"}}
00:00:40 MQT: stat/ves1/STATUS2 = {"StatusFWR":{"Version":"5.13.1a","BuildDateTime":"2018-05-12T19:31:18","Boot":31,"Core":"2_4_1","SDK":"2.2.1(cfd48f3)"}}
00:00:40 MQT: stat/ves1/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["SUGAR","SALT"],"TelePeriod":300,"SetOption":["00008009","55818000"]}}
00:00:40 MQT: stat/ves1/STATUS4 = {"StatusMEM":{"ProgramSize":466,"Free":536,"Heap":18,"ProgramFlashSize":1024,"FlashSize":1024,"FlashMode":3}}
00:00:40 MQT: stat/ves1/STATUS5 = {"StatusNET":{"Hostname":"ves1-1256","IPAddress":"192.168.0.24","Gateway":"192.168.0.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.0.1","Mac":"60:01:94:97:44:E8","Webserver":2,"WifiConfig":4}}
00:00:40 MQT: stat/ves1/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.0.200","MqttPort":1883,"MqttClientMask":"24","MqttClient":"24","MqttUser":"admin","MqttType":2,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}}
00:00:40 MQT: stat/ves1/STATUS7 = {"StatusTIM":{"UTC":"Thu Jan 01 00:00:40 1970","Local":"Thu Jan 01 00:00:40 1970","StartDST":"Thu Jan 01 00:00:00 1970","EndDST":"Thu Jan 01 00:00:00 1970","Timezone":8}}
00:00:40 MQT: stat/ves1/STATUS10 = {"StatusSNS":{"Time":"1970-01-01T00:00:40"}}
00:00:40 MQT: stat/ves1/STATUS11 = {"StatusSTS":{"Time":"1970-01-01T00:00:40","Uptime":"0T00:00:40","POWER1":"OFF","POWER2":"OFF","POWER3":"ON","Wifi":{"AP":1,"SSId":"SUGAR","RSSI":100,"APMac":"88:D7:F6:02:18:80"}}}
00:00:46 CMD: timezone 99
Jason2866 commented 6 years ago

Try to build with Arduino v.2.3.0. There are many users with problems with v.2.4.0 and 2.4.1... You have disabled many options. Why? Your programm size is very small with 466kb. May you have killed needed feature.

jeylites commented 6 years ago

@Jason2866 I did a 2.3.0 build as well, still same issue. I have disabled things I'm not using in user_config.h

STATUS 0

00:00:00 Project jey1 JEY 1 (Topic jey1, Fallback 26, GroupTopic sonoffs) Version 5.13.1a-2_3_0
00:00:00 WIF: Connecting to AP1 SUGAR in mode 11N as jey1-4683...
00:00:06 WIF: Connected
00:00:06 HTP: Web server active on jey1-4683 with IP address 192.168.0.26
00:00:08 MQT: Attempting connection...
00:00:08 MQT: Connected
00:00:08 MQT: tele/jey1/LWT = Online (retained)
00:00:08 MQT: cmnd/jey1/POWER = 
00:00:08 MQT: tele/jey1/INFO1 = {"Module":"Sonoff T1 3CH","Version":"5.13.1a","FallbackTopic":"26","GroupTopic":"sonoffs"}
00:00:08 MQT: tele/jey1/INFO2 = {"WebServerMode":"Admin","Hostname":"jey1-4683","IPAddress":"192.168.0.26"}
00:00:08 MQT: tele/jey1/INFO3 = {"RestartReason":"Software/System restart"}
00:00:09 MQT: stat/jey1/RESULT = {"POWER1":"OFF"}
00:00:09 MQT: stat/jey1/POWER1 = OFF
00:00:09 MQT: stat/jey1/RESULT = {"POWER2":"OFF"}
00:00:09 MQT: stat/jey1/POWER2 = OFF
00:00:09 MQT: stat/jey1/RESULT = {"POWER3":"ON"}
00:00:09 MQT: stat/jey1/POWER3 = ON
00:00:10 MQT: stat/jey1/RESULT = {"POWER3":"OFF"}
00:00:10 MQT: stat/jey1/POWER3 = OFF
00:00:11 MQT: stat/jey1/RESULT = {"POWER3":"ON"}
00:00:11 MQT: stat/jey1/POWER3 = ON
00:00:12 MQT: stat/jey1/RESULT = {"POWER3":"OFF"}
00:00:12 MQT: stat/jey1/POWER3 = OFF
00:00:14 MQT: stat/jey1/RESULT = {"POWER1":"ON"}
00:00:14 MQT: stat/jey1/POWER1 = ON
00:00:17 MQT: tele/jey1/STATE = {"Time":"1970-01-01T00:00:17","Uptime":"0T00:00:16","POWER1":"ON","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"SUGAR","RSSI":88,"APMac":"88:D7:F6:02:18:80"}}
00:00:17 MQT: stat/jey1/RESULT = {"POWER1":"ON"}
00:00:17 MQT: stat/jey1/POWER1 = ON
00:00:17 MQT: stat/jey1/RESULT = {"POWER2":"OFF"}
00:00:17 MQT: stat/jey1/POWER2 = OFF
00:00:17 MQT: stat/jey1/RESULT = {"POWER3":"OFF"}
00:00:17 MQT: stat/jey1/POWER3 = OFF
00:00:21 MQT: stat/jey1/RESULT = {"POWER1":"OFF"}
00:00:21 MQT: stat/jey1/POWER1 = OFF
00:00:23 KNX: Received from 2.2.1 Command Write: 1 to Relay 1
00:00:23 MQT: stat/jey1/RESULT = {"POWER1":"ON"}
00:00:23 MQT: stat/jey1/POWER1 = ON
00:00:42 KNX: Received from 2.2.1 Command Write: 0 to Relay 1
00:00:42 MQT: stat/jey1/RESULT = {"POWER1":"OFF"}
00:00:42 MQT: stat/jey1/POWER1 = OFF
00:02:00 MQT: tele/jey1/UPTIME = {"Time":"1970-01-01T00:02:00","Uptime":"0T00:01:59"}
00:05:17 MQT: tele/jey1/STATE = {"Time":"1970-01-01T00:05:17","Uptime":"0T00:05:16","POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"SUGAR","RSSI":82,"APMac":"88:D7:F6:02:18:80"}}
00:05:17 MQT: stat/jey1/RESULT = {"POWER1":"OFF"}
00:05:17 MQT: stat/jey1/POWER1 = OFF
00:05:17 MQT: stat/jey1/RESULT = {"POWER2":"OFF"}
00:05:17 MQT: stat/jey1/POWER2 = OFF
00:05:17 MQT: stat/jey1/RESULT = {"POWER3":"OFF"}
00:05:17 MQT: stat/jey1/POWER3 = OFF
00:10:01 APP: Serial logging disabled
00:10:06 CMD: status 0
00:10:06 MQT: stat/jey1/STATUS = {"Status":{"Module":30,"FriendlyName":["JEY 1","JEY 12","JEY 13"],"Topic":"jey1","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"ButtonRetain":0,"PowerRetain":0}}
00:10:06 MQT: stat/jey1/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://sonoff.maddox.co.uk/tasmota/sonoff.bin","RestartReason":"Software/System restart","Uptime":"0T00:10:04","StartupUTC":"","Sleep":0,"BootCount":3,"SaveCount":19,"SaveAddress":"F9000"}}
00:10:06 MQT: stat/jey1/STATUS2 = {"StatusFWR":{"Version":"5.13.1a","BuildDateTime":"2018-05-12T20:24:53","Boot":31,"Core":"2_3_0","SDK":"1.5.3(aec24ac9)"}}
00:10:06 MQT: stat/jey1/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["SUGAR","SALT"],"TelePeriod":300,"SetOption":["02008009","55818000"]}}
00:10:06 MQT: stat/jey1/STATUS4 = {"StatusMEM":{"ProgramSize":456,"Free":544,"Heap":16,"ProgramFlashSize":1024,"FlashSize":1024,"FlashMode":3}}
00:10:06 MQT: stat/jey1/STATUS5 = {"StatusNET":{"Hostname":"jey1-4683","IPAddress":"192.168.0.26","Gateway":"192.168.0.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.0.1","Mac":"60:01:94:98:B2:4B","Webserver":2,"WifiConfig":4}}
00:10:06 MQT: stat/jey1/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.0.200","MqttPort":1883,"MqttClientMask":"26","MqttClient":"26","MqttUser":"admin","MqttType":2,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}}
00:10:06 MQT: stat/jey1/STATUS7 = {"StatusTIM":{"UTC":"Thu Jan 01 00:10:06 1970","Local":"Thu Jan 01 00:10:06 1970","StartDST":"Thu Jan 01 00:00:00 1970","EndDST":"Thu Jan 01 00:00:00 1970","Timezone":8}}
00:10:06 MQT: stat/jey1/STATUS10 = {"StatusSNS":{"Time":"1970-01-01T00:10:06"}}
00:10:06 MQT: stat/jey1/STATUS11 = {"StatusSTS":{"Time":"1970-01-01T00:10:06","Uptime":"0T00:10:04","POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"SUGAR","RSSI":88,"APMac":"88:D7:F6:02:18:80"}}}

user_config.h

/*
  user_config.h - user specific configuration for Sonoff-Tasmota

  Copyright (C) 2018  Theo Arends

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _USER_CONFIG_H_
#define _USER_CONFIG_H_

/*********************************************************************************************\
 * This file consists of TWO sections.
 *
 * SECTION 1:
 * The first section contains PARAMETERS overriding flash settings if define CFG_HOLDER is CHANGED.
 * All parameters can be persistent changed online using commands via MQTT, WebConsole or Serial.
 *   Corresponding MQTT/Serial/Console commands are shown in [brackets]
 *
 * SECTION 2:
 * The second section contains Enabled and Disabled FEATURES allowing different program size.
 *   Changes in this section do NOT need a change of define CFG_HOLDER.
 *
 * ATTENTION:
 * Users are advised to use the user_config_override.h file for most changes.
\*********************************************************************************************/

//#define USE_CONFIG_OVERRIDE                      // Uncomment to use user_config_override.h file. See README.md

/*********************************************************************************************\
 * SECTION 1
 * - After initial load any change here only take effect if CFG_HOLDER is changed too
\*********************************************************************************************/

// -- Master parameter control --------------------
#define CFG_HOLDER             0x20161201       // [Reset 1] Change this value to load SECTION1 configuration parameters to flash

// -- Project -------------------------------------
#define PROJECT                "jey1"          // PROJECT is used as the default topic delimiter
#define MODULE                 SONOFF_T13      // [Module] Select default model from sonoff_template.h (Should not be changed)

#define SAVE_DATA              1                 // [SaveData] Save changed parameters to Flash (0 = disable, 1 - 3600 seconds)
#define SAVE_STATE             1                 // [SetOption0] Save changed power state to Flash (0 = disable, 1 = enable)

// -- Wifi ----------------------------------------
#define WIFI_IP_ADDRESS        "192.168.0.26"         // [IpAddress1] Set to 0.0.0.0 for using DHCP or IP address
#define WIFI_GATEWAY           "192.168.0.1"   // [IpAddress2] If not using DHCP set Gateway IP address
#define WIFI_SUBNETMASK        "255.255.255.0"   // [IpAddress3] If not using DHCP set Network mask
#define WIFI_DNS               "192.168.0.1"    // [IpAddress4] If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY)

#define STA_SSID1              "SUGAR"                // [Ssid1] Wifi SSID
#define STA_PASS1              "12345678"                // [Password1] Wifi password
#define STA_SSID2              "SALT"                // [Ssid2] Optional alternate AP Wifi SSID
#define STA_PASS2              "12345678"                // [Password2] Optional alternate AP Wifi password
#define WIFI_CONFIG_TOOL       WIFI_RETRY    // [WifiConfig] Default tool if wifi fails to connect
                                                 //   (WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT)

// -- Syslog --------------------------------------
#define SYS_LOG_HOST           ""                // [LogHost] (Linux) syslog host
#define SYS_LOG_PORT           514               // [LogPort] default syslog UDP port
#define SYS_LOG_LEVEL          LOG_LEVEL_NONE    // [SysLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)
#define SERIAL_LOG_LEVEL       LOG_LEVEL_INFO    // [SerialLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)
#define WEB_LOG_LEVEL          LOG_LEVEL_INFO    // [WebLog] (LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE)

// -- Ota -----------------------------------------
#define OTA_URL                "http://sonoff.maddox.co.uk/tasmota/sonoff.bin"  // [OtaUrl]

// -- MQTT ----------------------------------------
#define MQTT_USE               1                 // [SetOption3] Select default MQTT use (0 = Off, 1 = On)

#define MQTT_HOST              "192.168.0.201"                // [MqttHost]
#define MQTT_FINGERPRINT1      "A5 02 FF 13 99 9F 8B 39 8E F1 83 4F 11 23 65 0B 32 36 FC 07"  // [MqttFingerprint1]
#define MQTT_FINGERPRINT2      "A5 02 FF 13 99 9F 8B 39 8E F1 83 4F 11 23 65 0B 32 36 FC 07"  // [MqttFingerprint2]
#define MQTT_PORT              1883              // [MqttPort] MQTT port (10123 on CloudMQTT)
#define MQTT_USER              ""       // [MqttUser] MQTT user
#define MQTT_PASS              ""       // [MqttPassword] MQTT password

#define MQTT_BUTTON_RETAIN     0                 // [ButtonRetain] Button may send retain flag (0 = off, 1 = on)
#define MQTT_POWER_RETAIN      0                 // [PowerRetain] Power status message may send retain flag (0 = off, 1 = on)
#define MQTT_SWITCH_RETAIN     0                 // [SwitchRetain] Switch may send retain flag (0 = off, 1 = on)

#define MQTT_STATUS_OFF        "OFF"             // [StateText1] Command or Status result when turned off (needs to be a string like "0" or "Off")
#define MQTT_STATUS_ON         "ON"              // [StateText2] Command or Status result when turned on (needs to be a string like "1" or "On")
#define MQTT_CMND_TOGGLE       "TOGGLE"          // [StateText3] Command to send when toggling (needs to be a string like "2" or "Toggle")
#define MQTT_CMND_HOLD         "HOLD"            // [StateText4] Command to send when button is kept down for over KEY_HOLD_TIME * 0.1 seconds (needs to be a string like "HOLD")

// -- MQTT topics ---------------------------------
  // Example "tasmota/bedroom/%topic%/%prefix%/" up to 80 characers
#define MQTT_FULLTOPIC         "%prefix%/%topic%/" // [FullTopic] Subscribe and Publish full topic name - Legacy topic

// %prefix% token options
#define SUB_PREFIX             "cmnd"            // [Prefix1] Sonoff devices subscribe to %prefix%/%topic% being SUB_PREFIX/MQTT_TOPIC and SUB_PREFIX/MQTT_GRPTOPIC
#define PUB_PREFIX             "stat"            // [Prefix2] Sonoff devices publish to %prefix%/%topic% being PUB_PREFIX/MQTT_TOPIC
#define PUB_PREFIX2            "tele"            // [Prefix3] Sonoff devices publish telemetry data to %prefix%/%topic% being PUB_PREFIX2/MQTT_TOPIC/UPTIME, POWER and TIME
                                                 //   May be named the same as PUB_PREFIX
// %topic% token options (also ButtonTopic and SwitchTopic)
#define MQTT_TOPIC             PROJECT           // [Topic] (unique) MQTT device topic
#define MQTT_GRPTOPIC          "sonoffs"         // [GroupTopic] MQTT Group topic
#define MQTT_CLIENT_ID         "26"       // [MqttClient] Also fall back topic using Chip Id = last 6 characters of MAC address

// -- MQTT - Telemetry ----------------------------
#define TELE_PERIOD            300               // [TelePeriod] Telemetry (0 = disable, 10 - 3600 seconds)

// -- MQTT - Domoticz -----------------------------
#define DOMOTICZ_UPDATE_TIMER  0                 // [DomoticzUpdateTimer] Send relay status (0 = disable, 1 - 3600 seconds)

// -- MQTT - Home Assistant Discovery -------------
#define HOME_ASSISTANT_DISCOVERY_ENABLE   0      // [SetOption19] Home Assistant Discovery (0 = Disable, 1 = Enable)

// -- HTTP ----------------------------------------
#define WEB_SERVER             2                 // [WebServer] Web server (0 = Off, 1 = Start as User, 2 = Start as Admin)
#define WEB_PASSWORD           ""                // [WebPassword] Web server Admin mode Password for WEB_USERNAME (empty string = Disable)
#define FRIENDLY_NAME          "JEY 1"          // [FriendlyName] Friendlyname up to 32 characters used by webpages and Alexa
#define EMULATION              EMUL_NONE         // [Emulation] Select Belkin WeMo (single relay/light) or Hue Bridge emulation (multi relay/light) (EMUL_NONE, EMUL_WEMO or EMUL_HUE)

// -- Time - Up to three NTP servers in your region
#define NTP_SERVER1            "sg.pool.ntp.org"       // [NtpServer1] Select first NTP server by name or IP address (129.250.35.250)
#define NTP_SERVER2            "my.pool.ntp.org"    // [NtpServer2] Select second NTP server by name or IP address (5.39.184.5)
#define NTP_SERVER3            "3.asia.pool.ntp.org"  // [NtpServer3] Select third NTP server by name or IP address (93.94.224.67)

// -- Location ------------------------------------
#define LATITUDE               48.858360         // [Latitude] Your location to be used with sunrise and sunset
#define LONGITUDE              2.294442          // [Longitude] Your location to be used with sunrise and sunset

// -- Application ---------------------------------
#define APP_TIMEZONE           8                 // [Timezone] +1 hour (Amsterdam) (-13 .. 14 = hours from UTC, 99 = use TIME_DST/TIME_STD)
#define APP_LEDSTATE           LED_POWER         // [LedState] Function of led
                                                 //   (LED_OFF, LED_POWER, LED_MQTTSUB, LED_POWER_MQTTSUB, LED_MQTTPUB, LED_POWER_MQTTPUB, LED_MQTT, LED_POWER_MQTT)
#define APP_PULSETIME          0                 // [PulseTime] Time in 0.1 Sec to turn off power for relay 1 (0 = disabled)
#define APP_POWERON_STATE      POWER_ALL_SAVED   // [PowerOnState] Power On Relay state
                                                 //   (POWER_ALL_OFF, POWER_ALL_ON, POWER_ALL_SAVED_TOGGLE, POWER_ALL_SAVED, POWER_ALL_ALWAYS_ON, POWER_ALL_OFF_PULSETIME_ON)
#define APP_BLINKTIME          10                // [BlinkTime] Time in 0.1 Sec to blink/toggle power for relay 1
#define APP_BLINKCOUNT         10                // [BlinkCount] Number of blinks (0 = 32000)
#define APP_SLEEP              0                 // [Sleep] Sleep time to lower energy consumption (0 = Off, 1 - 250 mSec)

#define KEY_HOLD_TIME          40                // [SetOption32] Number of 0.1 seconds to hold Button or external Pushbutton before sending HOLD message
#define SWITCH_MODE            TOGGLE            // [SwitchMode] TOGGLE, FOLLOW, FOLLOW_INV, PUSHBUTTON, PUSHBUTTON_INV, PUSHBUTTONHOLD, PUSHBUTTONHOLD_INV, PUSHBUTTON_TOGGLE (the wall switch state)
#define WS2812_LEDS            30                // [Pixels] Number of WS2812 LEDs to start with (max is 512)

#define TEMP_CONVERSION        0                 // [SetOption8] Return temperature in (0 = Celsius or 1 = Fahrenheit)
#define TEMP_RESOLUTION        1                 // [TempRes] Maximum number of decimals (0 - 3) showing sensor Temperature
#define HUMIDITY_RESOLUTION    1                 // [HumRes] Maximum number of decimals (0 - 3) showing sensor Humidity
#define PRESSURE_RESOLUTION    1                 // [PressRes] Maximum number of decimals (0 - 3) showing sensor Pressure
#define ENERGY_RESOLUTION      3                 // [EnergyRes] Maximum number of decimals (0 - 5) showing energy usage in kWh

/*********************************************************************************************\
 * END OF SECTION 1
 *
 * SECTION 2
 * - Enable a feature by removing both // in front of it
 * - Disable a feature by preceding it with //
\*********************************************************************************************/

//#define USE_ARDUINO_OTA                          // Add optional support for Arduino OTA (+4k5 code)

// -- Localization --------------------------------
  // If non selected the default en-GB will be used
//#define MY_LANGUAGE            bg-BG           // Bulgarian in Bulgaria
//#define MY_LANGUAGE            cs-CZ           // Czech in Czech
//#define MY_LANGUAGE            de-DE           // German in Germany
//#define MY_LANGUAGE            el-GR           // Greek in Greece
//#define MY_LANGUAGE            en-GB           // English in Great Britain. Enabled by Default
//#define MY_LANGUAGE            es-AR           // Spanish in Argentina
//#define MY_LANGUAGE            fr-FR           // French in France
//#define MY_LANGUAGE            hu-HU           // Hungarian in Hungary
//#define MY_LANGUAGE            it-IT           // Italian in Italy
//#define MY_LANGUAGE            nl-NL           // Dutch in the Netherlands
//#define MY_LANGUAGE            pl-PL           // Polish in Poland
//#define MY_LANGUAGE            pt-BR           // Portuguese in Brazil
//#define MY_LANGUAGE            pt-PT           // Portuguese in Portugal
//#define MY_LANGUAGE            ru-RU           // Russian in Russia
//#define MY_LANGUAGE            zh-CN           // Chinese (Simplified) in China
//#define MY_LANGUAGE            zh-TW           // Chinese (Traditional) in Taiwan

/*-------------------------------------------------------------------------------------------*\
 * Select ONE of possible three MQTT library types below
\*-------------------------------------------------------------------------------------------*/
  // Default MQTT driver for both non-TLS and TLS connections. Blocks network if MQTT server is unavailable.
  // #define MQTT_LIBRARY_TYPE      MQTT_PUBSUBCLIENT   // Use PubSubClient library
  // Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support
#define MQTT_LIBRARY_TYPE      MQTT_TASMOTAMQTT    // Use TasmotaMqtt library (+4k4 code, +4k mem) - non-TLS only
  // Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support
//#define MQTT_LIBRARY_TYPE      MQTT_ESPMQTTARDUINO // Use (patched) esp-mqtt-arduino library (+4k8 code, +4k mem) - non-TLS only

// -- MQTT ----------------------------------------
#define MQTT_TELE_RETAIN     0                   // Tele messages may send retain flag (0 = off, 1 = on)

// -- MQTT - Domoticz -----------------------------
  // #define USE_DOMOTICZ                             // Enable Domoticz (+6k code, +0.3k mem)
  // #define DOMOTICZ_IN_TOPIC    "domoticz/in"     // Domoticz Input Topic
  // #define DOMOTICZ_OUT_TOPIC   "domoticz/out"    // Domoticz Output Topic

// -- MQTT - Home Assistant Discovery -------------
  // #define USE_HOME_ASSISTANT                       // Enable Home Assistant Discovery Support (+2k code)
  // #define HOME_ASSISTANT_DISCOVERY_PREFIX "homeassistant"  // Home Assistant discovery prefix

// -- MQTT - TLS ----------------------------------
  // !!! TLS uses a LOT OF MEMORY so be careful to enable other options at the same time !!!
//#define USE_MQTT_TLS                             // Use TLS for MQTT connection (+53k code, +15k mem)

// -- KNX IP Protocol -----------------------------
#define USE_KNX                                  // Enable KNX IP Protocol Support (+23k code, +3k3 mem)

// -- HTTP ----------------------------------------
#define USE_WEBSERVER                            // Enable web server and wifi manager (+66k code, +8k mem)
  #define WEB_PORT             80                // Web server Port for User and Admin mode
  #define WEB_USERNAME         "admin"           // Web server Admin mode user name
  #define USE_EMULATION                          // Enable Belkin WeMo and Hue Bridge emulation for Alexa (+16k code, +2k mem)

// -- mDNS ----------------------------------------
  // #define USE_DISCOVERY                            // Enable mDNS for the following services (+8k code, +0.3k mem)
  // #define WEBSERVER_ADVERTISE                    // Provide access to webserver by name <Hostname>.local/
  // #define MQTT_HOST_DISCOVERY                    // Find MQTT host server (overrides MQTT_HOST if found)

// -- Time - Start Daylight Saving Time and timezone offset from UTC in minutes
#define TIME_DST    // Northern Hemisphere, Last sunday in march at 02:00 +120 minutes

// -- Time - Start Standard Time and timezone offset from UTC in minutes
#define TIME_STD    // Northern Hemisphere, Last sunday in october 02:00 +60 minutes

// -- Time ----------------------------------------
  // #define USE_TIMERS                               // Add support for up to 16 timers (+2k2 code)
  // #define USE_TIMERS_WEB                         // Add timer webpage support (+4k5 code)
  // #define USE_SUNRISE                            // Add support for Sunrise and sunset tools (+16k)
  // #define SUNRISE_DAWN_ANGLE DAWN_NORMAL       // Select desired Dawn Angle from (DAWN_NORMAL, DAWN_CIVIL, DAWN_NAUTIC, DAWN_ASTRONOMIC)

// -- Rules ---------------------------------------
  // #define USE_RULES                                // Add support for rules (+4k4 code)

// -- Internal Analog input -----------------------
  // #define USE_ADC_VCC                              // Display Vcc in Power status. Disable for use as Analog input on selected devices

// -- One wire sensors ----------------------------
                                                 // WARNING: Select none for default one DS18B20 sensor or enable one of the following two options for multiple sensors
//#define USE_DS18x20                              // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code)
//#define USE_DS18x20_LEGACY                       // Optional for more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code)

// -- I2C sensors ---------------------------------
  // #define USE_I2C                                  // I2C using library wire (+10k code, 0k2 mem, 124 iram)
  // #ifdef USE_I2C
  // #define USE_SHT                                // Add I2C emulating code for SHT1X sensor (+1k4 code)
  // #define USE_SHT3X                              // Add I2C code for SHT3x or SHTC3 sensor (+0k7 code)
  // #define USE_HTU                                // Add I2C code for HTU21/SI7013/SI7020/SI7021 sensor (+1k5 code)
  // #define USE_BMP                                // Add I2C code for BMP085/BMP180/BMP280/BME280 sensor (+4k code)
//    #define USE_BME680                           // Add additional support for BME680 sensor using Adafruit Sensor and BME680 libraries (+6k code)
  // #define USE_SGP30                              // Add I2C code for SGP30 sensor (+1k1 code)
  // #define USE_BH1750                             // Add I2C code for BH1750 sensor (+0k5 code)
//  #define USE_VEML6070                           // Add I2C code for VEML6070 sensor (+0k5 code)
//  #define USE_TSL2561                            // Add I2C code for TSL2561 sensor using library Joba_Tsl2561 (+2k3 code)
//  #define USE_ADS1115                            // Add I2C code for ADS1115 16 bit A/D converter based on Adafruit ADS1x15 library (no library needed) (+0k7 code)
//  #define USE_ADS1115_I2CDEV                     // Add I2C code for ADS1115 16 bit A/D converter using library i2cdevlib-Core and i2cdevlib-ADS1115 (+2k code)
//  #define USE_INA219                             // Add I2C code for INA219 Low voltage and current sensor (+1k code)
//  #define USE_MGS                                // Add I2C code for Xadow and Grove Mutichannel Gas sensor using library Multichannel_Gas_Sensor (+10k code)
  // #define MGS_SENSOR_ADDR    0x04              // Default Mutichannel Gas sensor i2c address
  // #endif  // USE_I2C

// -- SPI sensors ---------------------------------
//#define USE_SPI                                  // SPI using default library
  // #ifdef USE_SPI

  // #endif  // USE_SPI

// -- Serial sensors ------------------------------
  // #define USE_MHZ19                                // Add support for MH-Z19 CO2 sensor (+2k code)
  // #define USE_SENSEAIR                             // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code)
  // #define CO2_LOW              800               // Below this CO2 value show green light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1)
  // #define CO2_HIGH             1200              // Above this CO2 value show red light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1)
  // #define USE_PMS5003                              // Add support for PMS5003 and PMS7003 particle concentration sensor (+1k3 code)
  // #define USE_NOVA_SDS                             // Add support for SDS011 and SDS021 particle concentration sensor (+0k7 code)
  // #define USE_PZEM004T                             // Add support for PZEM004T Energy monitor (+2k code)
  // #define USE_SERIAL_BRIDGE                        // Add support for software Serial Bridge (+0k8 code)

// -- Low level interface devices -----------------
  // #define USE_IR_REMOTE                            // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+4k code, 0k3 mem, 48 iram)
//  #define USE_IR_HVAC                            // Support for HVAC system using IR (+2k code)
    // #define USE_IR_RECEIVE                         // Support for IR receiver (+5k5 code, 264 iram)

  // #define USE_WS2812                               // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by //
  // #define USE_WS2812_CTYPE     NEO_GRB           // WS2812 Color type (NEO_RGB, NEO_GRB, NEO_BRG, NEO_RBG, NEO_RGBW, NEO_GRBW)
//  #define USE_WS2812_DMA                         // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow

  // #define USE_ARILUX_RF                            // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0))

  // #define USE_SR04                                 // Add support for HC-SR04 ultrasonic devices (+1k code)

/*********************************************************************************************\
 * Select features and sensors enabled in previous version saving space
\*********************************************************************************************/

//#define USE_CLASSIC                             // Create sonoff-classic (See sonoff_post.h for selected features)

/*********************************************************************************************\
 * Select all sensors - overrides above undefines!!
\*********************************************************************************************/

//#define USE_ALL_SENSORS                          // Create sonoff-allsensors with all sensors enabled (See sonoff_post.h for selected sensors)

/*********************************************************************************************\
 * Select KNX without Emulation to save space
\*********************************************************************************************/

#define USE_KNX_NO_EMULATION                     // Create sonoff-knx with KNX but without Emulation (See sonoff_post.h)

/*********************************************************************************************\
 * Compile a minimal version if upgrade memory gets tight ONLY TO BE USED FOR UPGRADE STEP 1!
 *   To be used as step 1 during upgrade.
 *   Step 2 is re-compile with option BE_MINIMAL commented out.
\*********************************************************************************************/

//#define BE_MINIMAL                               // Minimal version if upgrade memory gets tight (-45k code, -2k mem)

/*********************************************************************************************\
 * No user configurable items below
\*********************************************************************************************/

#if defined(USE_MQTT_TLS) && defined(USE_WEBSERVER)
  #error "Select either USE_MQTT_TLS or USE_WEBSERVER as there is just not enough memory to play with"
#endif

#endif  // _USER_CONFIG_H_
Jason2866 commented 6 years ago

Do you have no DHCP Server running? Because you use statice IP. In most routers you can assign always the same IP to the device (via MAC address). For test use the ntp servers Theo used in original setup. Disable domoticz, home assistant and knx if you dont use it

oblansundar commented 6 years ago

The time in my Sonoff POW got fixed automatically. I did not do anything except using the new firmware - 5.14.0.

@jeylites You can close this after your issue is fixed.

jeylites commented 6 years ago

Sorry, I didn’t report back. Mine was a AP router issue. I moved all the devices to the main router and it worked right after.