diff --git a/devices/sh_core_esp8266/src/sh_core_esp8266.cpp b/devices/sh_core_esp8266/src/sh_core_esp8266.cpp index 58c5a30..9b4dfc6 100644 --- a/devices/sh_core_esp8266/src/sh_core_esp8266.cpp +++ b/devices/sh_core_esp8266/src/sh_core_esp8266.cpp @@ -211,10 +211,6 @@ sta_attempt_started_at = millis(); } -__attribute__((weak)) const char* core_get_event_path() { - return "/api/v1/devices/event"; // дефолт, в сервере можешь принять это или переопределить в прошивке -} - // -------------------- core HTTP helper -------------------- bool core_post_json_to_server(const String &path, const String &json_body, @@ -266,7 +262,7 @@ body += "}"; int http_code = -1; - (void)core_post_json_to_server(core_get_event_path(), body, 1500, http_code); + (void)core_post_json_to_server("/api/v1/devices/event", body, 1500, http_code); online_event_sent_for_this_connection = true; } diff --git a/server/SHServ/RequiredControlScriptsScope.php b/server/SHServ/RequiredControlScriptsScope.php index d3f9ebd..b7a34d7 100644 --- a/server/SHServ/RequiredControlScriptsScope.php +++ b/server/SHServ/RequiredControlScriptsScope.php @@ -9,12 +9,13 @@ $this -> add_event_handler("online", function(Device $device, Array $data) { $device -> device_ip = $data["data"]["device_ip"]; $device -> description = $device -> description . "\n" . json_encode($data); + $device -> connection_state = "active"; $device_info = $device -> device_api() -> get_about(); if($device_info and isset($device_info["data"]) and $device_info["data"]) { $device -> firmware_version = $device_info["data"]["firmware_version"]; } - + $device -> update(); }); }