Hi,
I have a big script, which run correctly one shelly is booted.
But I Tested the script on reboot and it craches.
After some investigation it seems, tha is sntp.
I use Shelly.getComponentStatus("sys"); and return me an null on boot:
Code
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,110 2.323 2 0|Subscription callback error: type error
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,109 2.318 2 0| at script_3.js:225
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,108 2.314 2 0| at script_3.js:774
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,107 2.311 2 0| at script_3.js:802
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,106 2.303 1 0|[POOL_] get_current_time() time: null
And hi see after that the shelly sync with SNTP server, but it should do this before:
Code
2022-09-13,09:32:36,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"120 3.073 2 2|mgos_sntp.c:64 SNTP reply from 192.168.1.101: time 1663054356.152770, local 3.151209, delta 1663054353.001561"
Here is part of my script that is very simple:
Code
let result = Shelly.getComponentStatus("sys");
print("[POOL_] get_current_time() time:", result.time);
let time = result.time; // "HH:MM"
// compute current time in float format (12h45 -> 12.75)
let t = JSON.parse(time.slice(0,2)) + JSON.parse(time.slice(3,5)) / 60;
This call isn't the first in my script, there is many others call before, and perhaps the shelly is busy to make own call on init.
So I don't know if it's a shelly bug, or find an other solution and perhaps catch this "null" return ?
extract of complete log:
Code
Date,Time,Level,Host Name,Category,Program,Messages,
2022-09-13,09:32:45,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"134 12.440 2 2|shelly_notification:145 Status change of sys: {""available_updates"":{}}"
2022-09-13,09:32:45,Notice,pc-149.home,user,shellyplus1-441793a56dd4,133 12.427 2 2|shelly_http.cpp:68 0x3ffd5704 HTTP got 200 OK and 2 byte response
2022-09-13,09:32:43,Notice,pc-149.home,user,shellyplus1-441793a56dd4,132 10.768 2 2|shelly_http.cpp:184 0x3ffd5704 HTTPS GET https://updates.shelly.cloud/update/Plus1 (SSL CA shelly_cloud.pem)
2022-09-13,09:32:43,Notice,pc-149.home,user,shellyplus1-441793a56dd4,131 10.749 2 2|shelly_update.cpp:170 Checking for updates.
2022-09-13,09:32:39,Notice,pc-149.home,user,shellyplus1-441793a56dd4,130 6.789 2 2|mg_rpc.c:314 shelly.getstatus via WS_in 192.168.1.44:56961
2022-09-13,09:32:38,Notice,pc-149.home,user,shellyplus1-441793a56dd4,129 5.891 2 2|mg_rpc.c:314 shelly.getconfig via WS_in 192.168.1.44:56961
2022-09-13,09:32:37,Notice,pc-149.home,user,shellyplus1-441793a56dd4,128 4.802 2 2|mg_rpc.c:314 shelly.getdeviceinfo via WS_in 192.168.1.44:56961
2022-09-13,09:32:37,Notice,pc-149.home,user,shellyplus1-441793a56dd4,127 4.642 2 2|mg_rpc.c:314 Shelly.GetStatus via SHC 35.233.16.150:6022
2022-09-13,09:32:37,Notice,pc-149.home,user,shellyplus1-441793a56dd4,126 4.511 2 1|shelly_notification:101 ch type=WS_in info=192.168.1.44:56961 has no DST
2022-09-13,09:32:37,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"125 4.501 2 2|shelly_notification:145 Status change of cloud: {""connected"":true}"
2022-09-13,09:32:37,Notice,pc-149.home,user,shellyplus1-441793a56dd4,124 4.478 2 2|mg_rpc.c:314 Shelly.GetConfig via SHC 35.233.16.150:6022
2022-09-13,09:32:37,Notice,pc-149.home,user,shellyplus1-441793a56dd4,123 4.462 2 2|shelly_cloud.cpp:165 shelly cloud is online
2022-09-13,09:32:37,Notice,pc-149.home,user,shellyplus1-441793a56dd4,122 4.455 2 2|mgos_rpc_channel_ws.:54 0x3ffd309c WS handshake resp 101
2022-09-13,09:32:36,Notice,pc-149.home,user,shellyplus1-441793a56dd4,121 3.871 2 2|mgos_http_server.c:180 0x3ffd6da8 HTTP connection from 192.168.1.44:56961
2022-09-13,09:32:36,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"120 3.073 2 2|mgos_sntp.c:64 SNTP reply from 192.168.1.101: time 1663054356.152770, local 3.151209, delta 1663054353.001561"
2022-09-13,09:32:36,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"119 3.047 2 2|shelly_notification:145 Status change of script:3: {""id"":3,""errors"":[""type_error""],""running"":false}"
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,118 2.385 2 2|shelly_mqtt_script_:117 MQTT unsubscribed ha/pool
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,117 2.379 2 2|mgos_mqtt_conn.c:624 MQTT0 unsub ha/pool
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,116 2.373 2 2|shelly_mqtt_script_:117 MQTT unsubscribed shellyplus1-441793a56dd4/number/cmd
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,115 2.364 2 2|mgos_mqtt_conn.c:624 MQTT0 unsub shellyplus1-441793a56dd4/number/cmd
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,114 2.355 2 2|shelly_mqtt_script_:117 MQTT unsubscribed shellyplus1-441793a56dd4/select/cmd
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,113 2.346 2 2|mgos_mqtt_conn.c:624 MQTT0 unsub shellyplus1-441793a56dd4/select/cmd
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,112 2.337 2 2|shelly_timer_script_:73 JS_Timer 0x3ffde47c is gone
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,111 2.330 2 2|shelly_timer_script_:73 JS_Timer 0x3ffd6794 is gone
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,110 2.323 2 0|Subscription callback error: type error
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,109 2.318 2 0| at script_3.js:225
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,108 2.314 2 0| at script_3.js:774
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,107 2.311 2 0| at script_3.js:802
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,106 2.303 1 0|[POOL_] get_current_time() time: null
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,105 2.292 1 0|[POOL] update_temp - update_temp_max: 0 update_temp_max_last: 0 temp_ext: 0
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,104 2.281 1 0|[POOL] update_temp - max today: 0 today: 0 yesterday: 0
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,103 2.268 1 0|[POOL] update_temp() lock_update => true
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,102 2.260 1 0|[POOL_DISABLE_TEMP] disable_temp null true
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,101 2.253 1 0|[POOL] update_temp 1 0
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,100 2.246 1 0|[MQTT-SELECT] AUTO Auto
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,99 2.239 1 0|[MQTT] listen SELECT Auto
2022-09-13,09:32:35,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"98 2.068 2 2|shelly_notification:145 Status change of mqtt: {""connected"":true}"
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,97 2.051 2 2|mgos_mqtt_conn.c:169 MQTT0 sub shellyplus1-441793a56dd4/rpc @ 1
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,96 2.043 2 2|mgos_mqtt_conn.c:169 MQTT0 sub ha/pool @ 1
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,95 2.036 2 2|mgos_mqtt_conn.c:169 MQTT0 sub shellyplus1-441793a56dd4/number/cmd @ 1
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,94 2.027 2 2|mgos_mqtt_conn.c:169 MQTT0 sub shellyplus1-441793a56dd4/select/cmd @ 1
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,93 2.018 2 2|mgos_mqtt_conn.c:242 MQTT0 CONNACK 0
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,92 2.004 2 2|mgos_mqtt_conn.c:189 MQTT0 TCP connected ok (0)
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,91 1.995 2 2|mgos_mdns.c:143 Listening on udp://:5353... 0x3ffdec08
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,90 1.983 2 2|mgos_mqtt_conn.c:442 MQTT0 connecting to 192.168.1.105:1883
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"89 1.975 2 2|mgos_net.c:104 WiFi STA: ready, IP 192.168.1.55, GW 192.168.1.1, DNS 8.8.8.8, NTP 192.168.1.101"
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,88 1.963 2 2|mgos_net.c:93 WiFi STA: connected
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"87 1.953 2 2|shelly_notification:145 Status change of wifi: {""rssi"":-77,""ssid"":""isynet"",""sta_ip"":""192.168.1.55"",""status"":""got ip""}"
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"86 1.932 2 2|shelly_notification:145 Status change of wifi: {""rssi"":-77,""ssid"":""isynet"",""sta_ip"":""192.168.1.55"",""status"":""connected""}"
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,85 1.912 2 2|shelly_wifi.cpp:395 Shelly Wifi IP acquired
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,84 1.904 2 2|shelly_wifi.cpp:374 Shelly Wifi Connected
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"83 1.898 2 2|mgos_wifi.c:86 WiFi STA: Connected, BSSID 26:5a:4c:1f:19:19 ch 1 RSSI -77"
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,82 1.888 2 2|mgos_net.c:89 WiFi STA: connecting
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"81 1.878 2 2|shelly_notification:145 Status change of wifi: {""rssi"":-77,""ssid"":null,""sta_ip"":null,""status"":""connecting""}"
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,80 1.780 2 2|shelly_mqtt_script_:112 MQTT subscribed to shellyplus1-441793a56dd4/select/cmd
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"79 1.735 2 2|I (2493) wifi:AP's beacon interval = 102400 us, DTIM period = 1"
2022-09-13,09:32:34,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"78 1.723 2 2|[0;32mI (2483) esp_netif_handlers: sta ip: 192.168.1.55, mask: 255.255.255.0, gw: 192.168.1.1[0m"
2022-09-13,09:32:32,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"344 207.869 2 2|shelly_notification:145 Status change of mqtt: {""connected"":false}"
2022-09-13,09:32:32,Notice,pc-149.home,user,shellyplus1-441793a56dd4,"343 207.854 2 2|shelly_notification:145 Status change of cloud: {""connected"":false}"
2022-09-13,09:32:32,Notice,pc-149.home,user,shellyplus1-441793a56dd4,342 207.840 2 2|mgos_mqtt_conn.c:221 MQTT0 disconnected
2022-09-13,09:32:31,Notice,pc-149.home,user,shellyplus1-441793a56dd4,341 207.832 2 2|shelly_cloud.cpp:182 shelly cloud is down
2022-09-13,09:32:31,Notice,pc-149.home,user,shellyplus1-441793a56dd4,340 207.818 2 2|mgos_mqtt_conn.c:469 MQTT0 disconnect
2022-09-13,09:32:31,Notice,pc-149.home,user,shellyplus1-441793a56dd4,339 207.013 2 2|mgos_system.c:58 Rebooting in 1000 ms
2022-09-13,09:32:31,Notice,pc-149.home,user,shellyplus1-441793a56dd4,338 207.006 2 2|mg_rpc.c:314 shelly.reboot via WS_in 192.168.1.44:51862
Alles anzeigen