_LM_ 445 Napisano Marzec 22, 2021 Udostępnij Napisano Marzec 22, 2021 Cześć, problem jest taki że po przyznaniu statycznego IP urządzenie nie jest widziane w zakładce Devices na stronie remoteme.org. Urządzenie jest za to widoczne w otoczeniu sieciowym, działa nawet upload OTA. Wklejam część kodu, pewnie trzeba coś ustawić w klasach RemoteMe ale nie radzę sobie z tym const char *ssid = "*****"; const char *password = "*****"; IPAddress staticIP(192,168,0,22); IPAddress gateway(192,168,0,9); IPAddress subnet(255,255,255,0); Adafruit_BME280 bme; RemoteMe& remoteMe = RemoteMe::getInstance(TOKEN, DEVICE_ID); Ticker tmr,timeout; // timer dziala tylko gdy g_BootBit jest w stanie wysokim ADC_MODE(ADC_VCC); void readSens(char * bf); void RemoteTimeOut(void); void onBMEzewnetrznyChange(String s); //*************** CODE FOR COMFORTABLE VARIABLE SET ********************* inline void setBMEzewnetrzny(String s) {remoteMe.getVariables()->setText("BMEzewnetrzny", s); } bool g_BootBit = false; // bit ustawiony gdy ma dzialac arduino OTA char buf[50]; // bufor na tekst bool g_BMEstatus; // status bme void setup() { pinMode(OTAPIN,INPUT_PULLUP); g_BootBit = !digitalRead(OTAPIN); // g_boot jest w stanie wysokim gdy pin zwarty Serial.begin(115200); Serial.println("Booting..."); WiFi.config(staticIP, gateway, subnet); WiFi.begin(ssid, password); WiFi.mode(WIFI_STA); while (WiFi.waitForConnectResult() != WL_CONNECTED) { Serial.println("Connection Failed! Sleep..."); ESP.deepSleep(SLEEPTIME); // jesli nie powiodlo sie laczenie z siecia. (Todo: uruchomic kreatora WiFi?) } ArduinoOTA.onStart([]() { Serial.println("OTA Start"); }); ArduinoOTA.onEnd([]() { Serial.println("OTA End"); Serial.println("Rebooting..."); }); ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { Serial.printf("Progress: %u%%\r\n", (progress / (total / 100))); }); ArduinoOTA.onError([](ota_error_t error) { Serial.printf("Error[%u]: ", error); if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed"); else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed"); else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed"); else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed"); else if (error == OTA_END_ERROR) Serial.println("End Failed"); }); ArduinoOTA.begin(); Serial.println("Ready"); Serial.print("IP address: "); Serial.println(WiFi.localIP()); Serial.print("ESP Board MAC Address: "); Serial.println(WiFi.macAddress()); Wire.begin(); g_BMEstatus = bme.begin(0x76); if(g_BMEstatus)Serial.println("BME OK");else Serial.println("BME False"); remoteMe.getVariables()->observeText("BMEzewnetrzny" ,onBMEzewnetrznyChange); remoteMe.setConnector(new RemoteMeSocketConnector); remoteMe.sendRegisterDeviceMessage(DEVICE_NAME); if(g_BootBit)tmr.attach(5,readSens, buf); } bool pomiar = true; // bit pomocniczy zeby nie dublowac pomiarow void loop() { ArduinoOTA.handle(); if (remoteMe.loop() && pomiar) { if (!g_BootBit) { // jesli Boot bit w stanie wysokim to funkcje odczytu sensorow przejmuje timer readSens(buf); pomiar = false; // jednorazowo } } } wołam kolegę @remoteme_org Cytuj Link to post Share on other sites
_LM_ 445 Marzec 22, 2021 Autor tematu Udostępnij Marzec 22, 2021 Ok już po sprawie, miałem źle ustawioną bramę 1 Cytuj Link to post Share on other sites
Pomocna odpowiedź
Dołącz do dyskusji, napisz odpowiedź!
Jeśli masz już konto to zaloguj się teraz, aby opublikować wiadomość jako Ty. Możesz też napisać teraz i zarejestrować się później.
Uwaga: wgrywanie zdjęć i załączników dostępne jest po zalogowaniu!