├── .gitignore ├── .metadata ├── README.md ├── android ├── app │ ├── build.gradle │ ├── google-services.json │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flutter_iot │ │ │ │ └── MainActivity.java │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── door-closed.png ├── door-open.png ├── humidity.png ├── motion.png └── temperature.png ├── docs ├── 1.jpg ├── 2.jpg ├── 3.jpg ├── demo.gif └── hardware.jpg ├── firmware ├── ESP8266_BME280 │ └── ESP8266_BME280.ino ├── HiGrow_Sensor_Blynk │ └── HiGrow_Sensor_Blynk.ino ├── Mijia_ESP32_Usb │ └── Mijia_ESP32_Usb.ino ├── MotionDetector │ └── MotionDetector.ino └── Xiaomi_ESP32_Blynk │ └── Xiaomi_ESP32_Blynk.ino ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── GoogleService-Info.plist │ ├── Info.plist │ └── main.m ├── lib └── main.dart ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart └── web └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter Internet of Things Demo 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | This project demonstrate how flutter mobile app integrates with the Blynk Iot Platform. 13 | Monitor the following sensory data:- 14 | - Temperature 15 | - Humidity 16 | - Door State 17 | - Movement/Motion 18 | 19 | Future work will be using supervised machine learning classification algorithms to detect human pressence in the room. 20 | 21 | https://github.com/armut/Occupancy-Detection 22 | 23 | ## Getting Started 24 | 25 | This project is a starting point for a Flutter application. 26 | 27 | A few resources to get you started if this is your first Flutter project: 28 | 29 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 30 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 31 | 32 | For help getting started with Flutter, view our 33 | [online documentation](https://flutter.dev/docs), which offers tutorials, 34 | samples, guidance on mobile development, and a full API reference. 35 | 36 | # Arduino ESP32 Firmware 37 | 38 | ## First Arduino Sketch consist of the following sensory data 39 | * Room's temperature 40 | * Room's humidity 41 | * Room's door state 42 | 43 | firmware/Xiaomi_ESP32_Blynk/Xiaomi_ESP32_Blynk.ino 44 | 45 | ``` 46 | #define BLYNK_PRINT Serial 47 | 48 | #include 49 | #include 50 | #include 51 | //#include 52 | #include "BLEDevice.h" 53 | #include "soc/soc.h" 54 | #include "soc/rtc_cntl_reg.h" 55 | 56 | String receivedTemperatureValue = ""; 57 | String receivedHumidityValue = ""; 58 | #define uS_TO_S_FACTOR 1000000 //Conversion factor for micro seconds to seconds 59 | #define TIME_TO_SLEEP 20 //Time ESP32 will go to sleep (in seconds) 60 | RTC_DATA_ATTR int bootCount = 0; 61 | 62 | static BLEAddress *addressOfOurThermometer; 63 | BLERemoteService* remoteServiceOfTheThermometer; 64 | static BLERemoteCharacteristic* characteristicOfTheTemperatureMeasurementValue; 65 | BLERemoteDescriptor* descriptorForStartingAndEndingNotificationsFromCharacteristic; 66 | BLEClient* thisOurMicrocontrollerAsClient; 67 | unsigned long startTime PROGMEM ; 68 | const int doorSensor = 4; 69 | const int greenLED = 2; 70 | 71 | // You should get Auth Token in the Blynk App. 72 | // Go to the Project Settings (nut icon). 73 | char auth[] = "xxx"; 74 | 75 | // Your WiFi credentials. 76 | // Set password to "" for open networks. 77 | char ssid[] = "xxx"; 78 | char pass[] = "xxxx"; 79 | 80 | BlynkTimer timer; 81 | 82 | class theEventsThatWeAreInterestedInDuringScanning: public BLEAdvertisedDeviceCallbacks { 83 | void onResult(BLEAdvertisedDevice advertisedDevice) { 84 | if (advertisedDevice.getName() == "MJ_HT_V1") { 85 | advertisedDevice.getScan()->stop(); 86 | addressOfOurThermometer = new BLEAddress(advertisedDevice.getAddress()); } } }; 87 | 88 | static void notifyAsEachTemperatureValueIsReceived(BLERemoteCharacteristic* pBLERemoteCharacteristic, uint8_t* receivedNotification, size_t length, bool isNotify) { 89 | 90 | for (int i=2; i<=5; i++) { 91 | receivedTemperatureValue += (char)*(receivedNotification+i); 92 | } 93 | 94 | for (int i=9; i<=12; i++) { 95 | receivedHumidityValue += (char)*(receivedNotification+i); 96 | } 97 | Serial.println(receivedTemperatureValue); 98 | Serial.println(receivedHumidityValue); 99 | delay(3000); 100 | if (receivedTemperatureValue.length() < 0 && receivedHumidityValue.length() < 0) return; 101 | 102 | int doorstate = digitalRead(doorSensor); 103 | if(doorstate == 1){ 104 | Blynk.virtualWrite(V2, "Open"); 105 | Serial.println("Open"); 106 | digitalWrite(greenLED,HIGH); 107 | }else{ 108 | Blynk.virtualWrite(V2, "Closed"); 109 | Serial.println("Closed"); 110 | digitalWrite(greenLED,LOW); 111 | } 112 | delay(2000); 113 | Blynk.virtualWrite(V0, receivedTemperatureValue); 114 | Blynk.virtualWrite(V1, receivedHumidityValue); 115 | Serial.println("Disconnect from BLE device."); 116 | thisOurMicrocontrollerAsClient->disconnect(); 117 | hibernate(); 118 | } 119 | 120 | void hibernate() { 121 | esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); 122 | Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) + 123 | " Seconds"); 124 | Serial.println("Going to sleep now."); 125 | Serial.flush(); 126 | delay(1000); 127 | esp_deep_sleep_start(); 128 | } 129 | 130 | void readTempHumidity() { 131 | if (thisOurMicrocontrollerAsClient->isConnected() == false) { 132 | thisOurMicrocontrollerAsClient->disconnect(); 133 | delay(20); 134 | thisOurMicrocontrollerAsClient->connect(*addressOfOurThermometer); 135 | startTime = millis(); 136 | } // Here the our ESP32 as a client asks for a connection to the desired target device. 137 | 138 | if( thisOurMicrocontrollerAsClient->isConnected() == false ) { 139 | Serial.println(F("e4 Connection couln't be established")); 140 | } 141 | 142 | if (remoteServiceOfTheThermometer == nullptr) { 143 | remoteServiceOfTheThermometer = thisOurMicrocontrollerAsClient->getService("226c0000-6476-4566-7562-66734470666d"); 144 | } 145 | 146 | if (remoteServiceOfTheThermometer == nullptr) { 147 | thisOurMicrocontrollerAsClient->disconnect(); 148 | } 149 | 150 | if (characteristicOfTheTemperatureMeasurementValue == nullptr) { 151 | characteristicOfTheTemperatureMeasurementValue = remoteServiceOfTheThermometer->getCharacteristic("226caa55-6476-4566-7562-66734470666d"); 152 | } 153 | 154 | if (characteristicOfTheTemperatureMeasurementValue == nullptr) { 155 | thisOurMicrocontrollerAsClient->disconnect(); 156 | } 157 | 158 | if(characteristicOfTheTemperatureMeasurementValue != nullptr){ 159 | characteristicOfTheTemperatureMeasurementValue->registerForNotify(notifyAsEachTemperatureValueIsReceived); 160 | } 161 | 162 | if (descriptorForStartingAndEndingNotificationsFromCharacteristic == nullptr) { 163 | descriptorForStartingAndEndingNotificationsFromCharacteristic = characteristicOfTheTemperatureMeasurementValue->getDescriptor(BLEUUID((uint16_t)0x2902)); 164 | } 165 | 166 | if (descriptorForStartingAndEndingNotificationsFromCharacteristic == nullptr) { 167 | thisOurMicrocontrollerAsClient->disconnect(); 168 | } 169 | 170 | uint8_t startNotifications[2] = {0x01,0x00}; 171 | if(descriptorForStartingAndEndingNotificationsFromCharacteristic != nullptr){ 172 | descriptorForStartingAndEndingNotificationsFromCharacteristic->writeValue(startNotifications, 2, false); 173 | } 174 | // Ideas: https://stackoverflow.com/questions/1269568/how-to-pass-a-constant-array-literal-to-a-function-that-takes-a-pointer-without 175 | startTime = millis(); 176 | while( ( (millis() - startTime) < 5000) && (receivedTemperatureValue.length() < 4) ) 177 | { 178 | if (thisOurMicrocontrollerAsClient->isConnected() == false) { 179 | } 180 | } 181 | 182 | characteristicOfTheTemperatureMeasurementValue->registerForNotify(NULL); 183 | uint8_t endNotifications[2] = {0x00,0x00}; 184 | descriptorForStartingAndEndingNotificationsFromCharacteristic->writeValue(endNotifications, 2, false); 185 | 186 | if (receivedTemperatureValue.length() < 4) Serial.println(F("e14 No proper temperature measurement value catched.")); 187 | thisOurMicrocontrollerAsClient->disconnect(); 188 | } 189 | 190 | void setup() { 191 | Serial.begin(115200); 192 | WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); 193 | Serial.setDebugOutput(0); 194 | pinMode(doorSensor, INPUT); 195 | pinMode(greenLED, OUTPUT); 196 | BLEDevice::init("esp32tempsensor"); 197 | BLEScan* myBLEScanner = BLEDevice::getScan(); 198 | myBLEScanner->setAdvertisedDeviceCallbacks(new theEventsThatWeAreInterestedInDuringScanning()); 199 | myBLEScanner->setActiveScan(true); 200 | while (addressOfOurThermometer == nullptr) { 201 | myBLEScanner->start(30); startTime=millis(); 202 | while ( (millis()-startTime <50) && (addressOfOurThermometer == nullptr) ) { delay(1); } } 203 | thisOurMicrocontrollerAsClient = BLEDevice::createClient(); 204 | digitalWrite(greenLED,LOW); 205 | Blynk.begin(auth, ssid, pass); 206 | Blynk.syncAll(); 207 | timer.setInterval(1000L, readTempHumidity); 208 | timer.setInterval(30*1000, reconnectBlynk); //run every 30s 209 | } 210 | 211 | void reconnectBlynk() { 212 | if (!Blynk.connected()) { 213 | Serial.println("Lost connection"); 214 | if(Blynk.connect()) { 215 | Serial.println("Reconnected"); 216 | } 217 | else { 218 | Serial.println("Not reconnected"); 219 | } 220 | } 221 | } 222 | 223 | void loop() { 224 | if (Blynk.connected()) { // If connected run as normal 225 | Blynk.run(); 226 | } 227 | timer.run(); 228 | } 229 | 230 | ``` 231 | ## Second Arduino Sketch consist of the following sensory data 232 | * Human/living life form movment 233 | 234 | firmware/MotionDetector/MotionDetector.ino 235 | 236 | ``` 237 | #include 238 | #include 239 | const int motionSensor PROGMEM = 12; 240 | 241 | const char* ssid = "xxx"; 242 | const char* password = "xxx"; 243 | WiFiClient espClient; 244 | 245 | void invokeRequest(String value){ 246 | HTTPClient http; 247 | http.begin(value); //Specify the URL 248 | int httpCode = http.GET(); //Make the request 249 | 250 | if (httpCode > 0) { //Check for the returning code 251 | 252 | String payload = http.getString(); 253 | Serial.println(httpCode); 254 | Serial.println(payload); 255 | } 256 | 257 | else { 258 | Serial.println("Error on HTTP request"); 259 | ESP.restart(); 260 | } 261 | 262 | http.end(); //Free the resources 263 | 264 | } 265 | void turnONLight(){ 266 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdffx2506590484c/update/V1?value=255"); //v1 to 255 267 | delay(50); 268 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdfxf2506590484c/update/V2?value=255"); //v2 to 255 269 | delay(50); 270 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdxff2506590484c/update/V3?value=255"); //v3 to 255 271 | delay(50); 272 | invokeRequest("http://blynk-cloud.com/238dc3bbbcfc4ed39a97c2x12d51f313a/update/V3?value=1"); //v3 to 1 273 | delay(50); 274 | } 275 | 276 | void offLight(){ 277 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fxdff2506590484c/update/V1?value=0"); //v1 to 0 278 | delay(50); 279 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdfxf2506590484c/update/V2?value=0"); //v2 to 0 280 | delay(50); 281 | invokeRequest("http://blynk-cloud.com/85a4ddxf0b61149149fdff2506590484c/update/V3?value=0"); //v3 to 0 282 | delay(50); 283 | invokeRequest("http://blynk-cloud.com/238dc3bbbcfcx4ed39a97c212d51f313a/update/V3?value=0"); //v3 to 1 284 | delay(50); 285 | } 286 | void setup_wifi() { 287 | delay(10); 288 | // We start by connecting to a WiFi network 289 | Serial.println(); 290 | Serial.print("Connecting to "); 291 | Serial.println(ssid); 292 | 293 | WiFi.begin(ssid, password); 294 | 295 | while (WiFi.status() != WL_CONNECTED) { 296 | delay(500); 297 | Serial.print("."); 298 | } 299 | 300 | Serial.println(""); 301 | Serial.println("WiFi connected"); 302 | Serial.println("IP address: "); 303 | Serial.println(WiFi.localIP()); 304 | } 305 | 306 | 307 | void setup() { 308 | Serial.begin(115200); 309 | Serial.setDebugOutput(0); 310 | pinMode(motionSensor, INPUT); 311 | setup_wifi(); 312 | printWifiStatus(); 313 | offLight(); 314 | } 315 | 316 | void loop() { 317 | int motion = digitalRead(motionSensor); 318 | Serial.println(motion); 319 | if(motion == 1){ 320 | Serial.println("MOTION DETECTED!!!"); 321 | Serial.println("LOSER !!!"); 322 | turnONLight(); 323 | delay(15000); 324 | offLight(); 325 | } 326 | Serial.println("WINNER !!!"); 327 | delay(2000); 328 | } 329 | 330 | void printWifiStatus() { 331 | // print the SSID of the network you're attached to: 332 | Serial.print("SSID: "); 333 | Serial.println(WiFi.SSID()); 334 | 335 | // print your WiFi shield's IP address: 336 | IPAddress ip = WiFi.localIP(); 337 | Serial.print("IP Address: "); 338 | Serial.println(ip); 339 | 340 | // print the received signal strength: 341 | long rssi = WiFi.RSSI(); 342 | Serial.print("signal strength (RSSI):"); 343 | Serial.print(rssi); 344 | Serial.println(" dBm"); 345 | } 346 | 347 | ``` -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.example.flutter_iot" 37 | minSdkVersion 16 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | 63 | apply plugin: 'com.google.gms.google-services' -------------------------------------------------------------------------------- /android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "999431981277", 4 | "firebase_url": "https://mijia-thermostat.firebaseio.com", 5 | "project_id": "mijia-thermostat", 6 | "storage_bucket": "mijia-thermostat.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:999431981277:android:70678bb0b07b2375", 12 | "android_client_info": { 13 | "package_name": "com.example.flutter_iot" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "999431981277-j9sgjjvtlfa29rq5cbhv8ta7rd373d1m.apps.googleusercontent.com", 19 | "client_type": 3 20 | } 21 | ], 22 | "api_key": [ 23 | { 24 | "current_key": "AIzaSyCfGnx3sDUolTv7-4t7-jVI19UhIYb6AYU" 25 | } 26 | ], 27 | "services": { 28 | "appinvite_service": { 29 | "other_platform_oauth_client": [ 30 | { 31 | "client_id": "999431981277-j9sgjjvtlfa29rq5cbhv8ta7rd373d1m.apps.googleusercontent.com", 32 | "client_type": 3 33 | } 34 | ] 35 | } 36 | } 37 | } 38 | ], 39 | "configuration_version": "1" 40 | } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/flutter_iot/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.flutter_iot; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | classpath 'com.google.gms:google-services:4.2.0' 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | jcenter() 17 | } 18 | } 19 | 20 | rootProject.buildDir = '../build' 21 | subprojects { 22 | project.buildDir = "${rootProject.buildDir}/${project.name}" 23 | } 24 | subprojects { 25 | project.evaluationDependsOn(':app') 26 | } 27 | 28 | task clean(type: Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /assets/door-closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/assets/door-closed.png -------------------------------------------------------------------------------- /assets/door-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/assets/door-open.png -------------------------------------------------------------------------------- /assets/humidity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/assets/humidity.png -------------------------------------------------------------------------------- /assets/motion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/assets/motion.png -------------------------------------------------------------------------------- /assets/temperature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/assets/temperature.png -------------------------------------------------------------------------------- /docs/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/docs/1.jpg -------------------------------------------------------------------------------- /docs/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/docs/2.jpg -------------------------------------------------------------------------------- /docs/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/docs/3.jpg -------------------------------------------------------------------------------- /docs/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/docs/demo.gif -------------------------------------------------------------------------------- /docs/hardware.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/docs/hardware.jpg -------------------------------------------------------------------------------- /firmware/ESP8266_BME280/ESP8266_BME280.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define SEALEVELPRESSURE_HPA (1013.25) 7 | 8 | Adafruit_BME280 bme; 9 | 10 | float temperature, humidity, pressure, altitude; 11 | 12 | /*Put your SSID & Password*/ 13 | const char* ssid = "kenken64"; // Enter SSID here 14 | const char* password = "7730112910100"; //Enter Password here 15 | 16 | ESP8266WebServer server(80); 17 | 18 | void setup() { 19 | Serial.begin(115200); 20 | delay(200); 21 | 22 | bme.begin(0x76); 23 | 24 | Serial.println("Connecting to "); 25 | Serial.println(ssid); 26 | 27 | //connect to your local wi-fi network 28 | WiFi.begin(ssid, password); 29 | 30 | //check wi-fi is connected to wi-fi network 31 | while (WiFi.status() != WL_CONNECTED) { 32 | delay(1000); 33 | Serial.print("."); 34 | } 35 | Serial.println(""); 36 | Serial.println("WiFi connected..!"); 37 | Serial.print("Got IP: "); Serial.println(WiFi.localIP()); 38 | 39 | server.on("/", handle_OnConnect); 40 | server.onNotFound(handle_NotFound); 41 | 42 | server.begin(); 43 | Serial.println("HTTP server started"); 44 | 45 | } 46 | void loop() { 47 | server.handleClient(); 48 | } 49 | 50 | void handle_OnConnect() { 51 | temperature = bme.readTemperature(); 52 | humidity = bme.readHumidity(); 53 | pressure = bme.readPressure() / 100.0F; 54 | altitude = bme.readAltitude(SEALEVELPRESSURE_HPA); 55 | server.send(200, "text/html", SendHTML(temperature,humidity,pressure,altitude)); 56 | } 57 | 58 | void handle_NotFound(){ 59 | server.send(404, "text/plain", "Not found"); 60 | } 61 | 62 | String SendHTML(float temperature,float humidity,float pressure,float altitude){ 63 | String ptr = ""; 64 | ptr +=""; 65 | ptr +=""; 66 | ptr +="Fridge Sensor"; 67 | ptr +=""; 68 | ptr +=""; 69 | ptr +=""; 70 | ptr +=""; 86 | ptr +=""; 87 | ptr +=""; 88 | ptr +="
"; 89 | ptr +=""; 90 | ptr +="
"; 91 | ptr +="
"; 92 | ptr +="
"; 93 | ptr +=""; 98 | ptr +="
"; 99 | ptr +="
Temperature
"; 100 | ptr +="
"; 101 | ptr +=(int)temperature; 102 | ptr +="°C
"; 103 | ptr +="
"; 104 | ptr +="
"; 105 | ptr +="
"; 106 | ptr +=""; 110 | ptr +="
"; 111 | ptr +="
Humidity
"; 112 | ptr +="
"; 113 | ptr +=(int)humidity; 114 | ptr +="%
"; 115 | ptr +="
"; 116 | ptr +="
"; 117 | ptr +="
"; 118 | ptr +=""; 127 | ptr +="
"; 128 | ptr +="
Pressure
"; 129 | ptr +="
"; 130 | ptr +=(int)pressure; 131 | ptr +="hPa
"; 132 | ptr +="
"; 133 | ptr +="
"; 134 | ptr +="
"; 135 | ptr +=""; 142 | ptr +="
"; 143 | ptr +="
Altitude
"; 144 | ptr +="
"; 145 | ptr +=(int)altitude; 146 | ptr +="m
"; 147 | ptr +="
"; 148 | ptr +="
"; 149 | ptr +=""; 150 | ptr +=""; 151 | return ptr; 152 | 153 | } 154 | -------------------------------------------------------------------------------- /firmware/HiGrow_Sensor_Blynk/HiGrow_Sensor_Blynk.ino: -------------------------------------------------------------------------------- 1 | #define BLYNK_PRINT Serial 2 | 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | // Auth Token in the Blynk App. 10 | // Go to the Project Settings (nut icon). 11 | char auth[] = "238dc3bbbcfc4ed39a97c212d51f313a"; 12 | 13 | // WiFi credentials. 14 | // Set password to "" for open networks. 15 | char ssid[] = "kenken64"; 16 | char pass[] = "7730112910100"; 17 | 18 | 19 | #define DHTPIN 22 // What digital pin is connected to 20 | const int soilpin = 32; 21 | const int POWER_PIN = 34; 22 | const int LIGHT_PIN = 33; 23 | 24 | #define DHTTYPE DHT11 // DHT 11 25 | //#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321 26 | //#define DHTTYPE DHT21 // DHT 21, AM2301 27 | 28 | DHT dht(DHTPIN, DHTTYPE); 29 | BlynkTimer timer; 30 | 31 | // This function sends Arduino's up time every second to Virtual Pin (5). 32 | // In the app, Widget's reading frequency should be set to PUSH. This means 33 | // that you define how often to send data to Blynk App. 34 | void sendSensor() 35 | { 36 | float h = dht.readHumidity(); 37 | float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit 38 | 39 | int soilmoisture = analogRead(soilpin); 40 | int lightlevel = analogRead(LIGHT_PIN); 41 | 42 | 43 | if (isnan(h) || isnan(t)) { 44 | Serial.println("Failed to read from DHT sensor!"); 45 | return; 46 | } 47 | 48 | if (isnan(t)) { 49 | return; 50 | } 51 | if (t > 25) { 52 | Blynk.notify(String("Teperature is too high: ") + t); 53 | } 54 | // send any value at any time. 55 | // No more that 10 values per second. 56 | Blynk.virtualWrite(V5, h); 57 | Blynk.virtualWrite(V6, t); 58 | Blynk.virtualWrite(V7, soilmoisture); 59 | Blynk.virtualWrite(V8, lightlevel); 60 | } 61 | 62 | 63 | 64 | void setup() 65 | { 66 | // Debug console 67 | Serial.begin(9600); 68 | Blynk.begin(auth, ssid, pass); 69 | dht.begin(); 70 | // Setup a function to be called every second 71 | timer.setInterval(1000L, sendSensor); 72 | } 73 | 74 | void loop() 75 | { 76 | Blynk.run(); 77 | timer.run(); 78 | } 79 | -------------------------------------------------------------------------------- /firmware/Mijia_ESP32_Usb/Mijia_ESP32_Usb.ino: -------------------------------------------------------------------------------- 1 | #include "BLEDevice.h" 2 | #include "soc/soc.h" 3 | #include "soc/rtc_cntl_reg.h" 4 | 5 | String receivedTemperatureValue = ""; 6 | String receivedHumidityValue = ""; 7 | #define uS_TO_S_FACTOR 1000000 //Conversion factor for micro seconds to seconds 8 | #define TIME_TO_SLEEP 10 //Time ESP32 will go to sleep (in seconds) 9 | RTC_DATA_ATTR int bootCount = 0; 10 | RTC_DATA_ATTR int reconnectCount = 0; 11 | long OnTime1 = 250; 12 | long OnTime2 = 360; 13 | unsigned long previousMillis1 = 0; 14 | unsigned long previousMillis2 = 0; 15 | TaskHandle_t restartDeviceTaskHandle = NULL; 16 | 17 | static BLEAddress *addressOfOurThermometer; 18 | BLERemoteService* remoteServiceOfTheThermometer; 19 | static BLERemoteCharacteristic* characteristicOfTheTemperatureMeasurementValue; 20 | BLERemoteDescriptor* descriptorForStartingAndEndingNotificationsFromCharacteristic; 21 | BLEClient* thisOurMicrocontrollerAsClient; 22 | unsigned long startTime PROGMEM ; 23 | 24 | class theEventsThatWeAreInterestedInDuringScanning: public BLEAdvertisedDeviceCallbacks { 25 | void onResult(BLEAdvertisedDevice advertisedDevice) { 26 | if (advertisedDevice.getName() == "MJ_HT_V1") { 27 | advertisedDevice.getScan()->stop(); 28 | addressOfOurThermometer = new BLEAddress(advertisedDevice.getAddress()); } } }; 29 | 30 | static void notifyAsEachTemperatureValueIsReceived(BLERemoteCharacteristic* pBLERemoteCharacteristic, uint8_t* receivedNotification, size_t length, bool isNotify) { 31 | unsigned long currentMillis = millis(); 32 | if((currentMillis - previousMillis2 >= OnTime2)) 33 | { 34 | delay(500); 35 | for (int i=2; i<=5; i++) { 36 | receivedTemperatureValue += (char)*(receivedNotification+i); 37 | } 38 | 39 | for (int i=9; i<=12; i++) { 40 | receivedHumidityValue += (char)*(receivedNotification+i); 41 | } 42 | Serial.println("TEMPERATURE|"+receivedTemperatureValue); 43 | Serial.println("HUMIDITY|"+receivedHumidityValue); 44 | delay(3000); 45 | if (receivedTemperatureValue.length() < 0 && receivedHumidityValue.length() < 0) return; 46 | thisOurMicrocontrollerAsClient->disconnect(); 47 | hibernate(); 48 | previousMillis2 = currentMillis; 49 | } 50 | 51 | } 52 | 53 | void hibernate() { 54 | esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); 55 | Serial.flush(); 56 | delay(500); 57 | esp_deep_sleep_start(); 58 | } 59 | 60 | 61 | void readTempHumidity() { 62 | unsigned long currentMillis = millis(); 63 | if((currentMillis - previousMillis1 >= OnTime1)) 64 | { 65 | if (thisOurMicrocontrollerAsClient->isConnected() == false) { 66 | thisOurMicrocontrollerAsClient->disconnect(); 67 | delay(20); 68 | thisOurMicrocontrollerAsClient->connect(*addressOfOurThermometer); 69 | startTime = millis(); 70 | } // Here the our ESP32 as a client asks for a connection to the desired target device. 71 | 72 | if( thisOurMicrocontrollerAsClient->isConnected() == false ) { 73 | //Serial.println(F("e4 Connection couln't be established")); 74 | } 75 | 76 | if (remoteServiceOfTheThermometer == nullptr) { 77 | remoteServiceOfTheThermometer = thisOurMicrocontrollerAsClient->getService("226c0000-6476-4566-7562-66734470666d"); 78 | } 79 | 80 | if (remoteServiceOfTheThermometer == nullptr) { 81 | thisOurMicrocontrollerAsClient->disconnect(); 82 | } 83 | 84 | if (characteristicOfTheTemperatureMeasurementValue == nullptr) { 85 | characteristicOfTheTemperatureMeasurementValue = remoteServiceOfTheThermometer->getCharacteristic("226caa55-6476-4566-7562-66734470666d"); 86 | } 87 | 88 | if (characteristicOfTheTemperatureMeasurementValue == nullptr) { 89 | thisOurMicrocontrollerAsClient->disconnect(); 90 | } 91 | 92 | if(characteristicOfTheTemperatureMeasurementValue != nullptr){ 93 | characteristicOfTheTemperatureMeasurementValue->registerForNotify(notifyAsEachTemperatureValueIsReceived); 94 | } 95 | 96 | if (descriptorForStartingAndEndingNotificationsFromCharacteristic == nullptr) { 97 | descriptorForStartingAndEndingNotificationsFromCharacteristic = characteristicOfTheTemperatureMeasurementValue->getDescriptor(BLEUUID((uint16_t)0x2902)); 98 | } 99 | 100 | if (descriptorForStartingAndEndingNotificationsFromCharacteristic == nullptr) { 101 | thisOurMicrocontrollerAsClient->disconnect(); 102 | } 103 | 104 | uint8_t startNotifications[2] = {0x01,0x00}; 105 | if(descriptorForStartingAndEndingNotificationsFromCharacteristic != nullptr){ 106 | descriptorForStartingAndEndingNotificationsFromCharacteristic->writeValue(startNotifications, 2, false); 107 | } 108 | // Ideas: https://stackoverflow.com/questions/1269568/how-to-pass-a-constant-array-literal-to-a-function-that-takes-a-pointer-without 109 | startTime = millis(); 110 | while( ( (millis() - startTime) < 5000) && (receivedTemperatureValue.length() < 4) ) 111 | { 112 | if (thisOurMicrocontrollerAsClient->isConnected() == false) { 113 | } 114 | } 115 | 116 | characteristicOfTheTemperatureMeasurementValue->registerForNotify(NULL); 117 | uint8_t endNotifications[2] = {0x00,0x00}; 118 | descriptorForStartingAndEndingNotificationsFromCharacteristic->writeValue(endNotifications, 2, false); 119 | 120 | if (receivedTemperatureValue.length() < 4) Serial.println(F("e14 No proper temperature measurement value catched.")); 121 | BLEScan* myBLEScanner = BLEDevice::getScan(); 122 | myBLEScanner->setActiveScan(false); 123 | thisOurMicrocontrollerAsClient->disconnect(); 124 | previousMillis1 = currentMillis; 125 | } 126 | } 127 | 128 | void setup() { 129 | ++bootCount; 130 | Serial.begin(115200); 131 | 132 | BLEDevice::init("ESP32MijiaTempSensor"); 133 | BLEScan* myBLEScanner = BLEDevice::getScan(); 134 | myBLEScanner->setAdvertisedDeviceCallbacks(new theEventsThatWeAreInterestedInDuringScanning()); 135 | myBLEScanner->setActiveScan(true); 136 | while (addressOfOurThermometer == nullptr) { 137 | myBLEScanner->start(30); startTime=millis(); 138 | while ( (millis()-startTime <50) && (addressOfOurThermometer == nullptr) ) { delay(1); } } 139 | thisOurMicrocontrollerAsClient = BLEDevice::createClient(); 140 | 141 | } 142 | 143 | void loop() { 144 | delay(1000); 145 | } 146 | -------------------------------------------------------------------------------- /firmware/MotionDetector/MotionDetector.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | const int motionSensor PROGMEM = 12; 4 | 5 | const char* ssid = "xxx"; 6 | const char* password = "xxx"; 7 | WiFiClient espClient; 8 | 9 | void invokeRequest(String value){ 10 | HTTPClient http; 11 | http.begin(value); //Specify the URL 12 | int httpCode = http.GET(); //Make the request 13 | 14 | if (httpCode > 0) { //Check for the returning code 15 | 16 | String payload = http.getString(); 17 | Serial.println(httpCode); 18 | Serial.println(payload); 19 | } 20 | 21 | else { 22 | Serial.println("Error on HTTP request"); 23 | ESP.restart(); 24 | } 25 | 26 | http.end(); //Free the resources 27 | 28 | } 29 | void turnONLight(){ 30 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdff2506590484c/update/V1?value=255"); //v1 to 255 31 | delay(50); 32 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdff2506590484c/update/V2?value=255"); //v2 to 255 33 | delay(50); 34 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdff2506590484c/update/V3?value=255"); //v3 to 255 35 | delay(50); 36 | invokeRequest("http://blynk-cloud.com/238dc3bbbcfc4ed39a97c212d51f313a/update/V3?value=1"); //v3 to 1 37 | delay(50); 38 | } 39 | 40 | void offLight(){ 41 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdff2506590484c/update/V1?value=0"); //v1 to 0 42 | delay(50); 43 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdff2506590484c/update/V2?value=0"); //v2 to 0 44 | delay(50); 45 | invokeRequest("http://blynk-cloud.com/85a4ddf0b61149149fdff2506590484c/update/V3?value=0"); //v3 to 0 46 | delay(50); 47 | invokeRequest("http://blynk-cloud.com/238dc3bbbcfc4ed39a97c212d51f313a/update/V3?value=0"); //v3 to 1 48 | delay(50); 49 | } 50 | void setup_wifi() { 51 | delay(10); 52 | // We start by connecting to a WiFi network 53 | Serial.println(); 54 | Serial.print("Connecting to "); 55 | Serial.println(ssid); 56 | 57 | WiFi.begin(ssid, password); 58 | 59 | while (WiFi.status() != WL_CONNECTED) { 60 | delay(500); 61 | Serial.print("."); 62 | } 63 | 64 | Serial.println(""); 65 | Serial.println("WiFi connected"); 66 | Serial.println("IP address: "); 67 | Serial.println(WiFi.localIP()); 68 | } 69 | 70 | 71 | void setup() { 72 | Serial.begin(115200); 73 | Serial.setDebugOutput(0); 74 | pinMode(motionSensor, INPUT); 75 | setup_wifi(); 76 | printWifiStatus(); 77 | offLight(); 78 | } 79 | 80 | void loop() { 81 | int motion = digitalRead(motionSensor); 82 | Serial.println(motion); 83 | if(motion == 1){ 84 | Serial.println("MOTION DETECTED!!!"); 85 | Serial.println("LOSER !!!"); 86 | turnONLight(); 87 | delay(15000); 88 | offLight(); 89 | } 90 | Serial.println("WINNER !!!"); 91 | delay(2000); 92 | } 93 | 94 | void printWifiStatus() { 95 | // print the SSID of the network you're attached to: 96 | Serial.print("SSID: "); 97 | Serial.println(WiFi.SSID()); 98 | 99 | // print your WiFi shield's IP address: 100 | IPAddress ip = WiFi.localIP(); 101 | Serial.print("IP Address: "); 102 | Serial.println(ip); 103 | 104 | // print the received signal strength: 105 | long rssi = WiFi.RSSI(); 106 | Serial.print("signal strength (RSSI):"); 107 | Serial.print(rssi); 108 | Serial.println(" dBm"); 109 | } 110 | -------------------------------------------------------------------------------- /firmware/Xiaomi_ESP32_Blynk/Xiaomi_ESP32_Blynk.ino: -------------------------------------------------------------------------------- 1 | #define BLYNK_PRINT Serial 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "BLEDevice.h" 8 | #include "soc/soc.h" 9 | #include "soc/rtc_cntl_reg.h" 10 | 11 | String receivedTemperatureValue = ""; 12 | String receivedHumidityValue = ""; 13 | #define uS_TO_S_FACTOR 1000000 //Conversion factor for micro seconds to seconds 14 | #define TIME_TO_SLEEP 5 //Time ESP32 will go to sleep (in seconds) 15 | RTC_DATA_ATTR int bootCount = 0; 16 | RTC_DATA_ATTR int reconnectCount = 0; 17 | long OnTime1 = 250; 18 | long OnTime2 = 500; 19 | unsigned long previousMillis1 = 0; 20 | unsigned long previousMillis2 = 0; 21 | 22 | 23 | static BLEAddress *addressOfOurThermometer; 24 | BLERemoteService* remoteServiceOfTheThermometer; 25 | static BLERemoteCharacteristic* characteristicOfTheTemperatureMeasurementValue; 26 | BLERemoteDescriptor* descriptorForStartingAndEndingNotificationsFromCharacteristic; 27 | BLEClient* thisOurMicrocontrollerAsClient; 28 | unsigned long startTime PROGMEM ; 29 | 30 | // You should get Auth Token in the Blynk App. 31 | // Go to the Project Settings (nut icon). 32 | char auth[] = "238dc3bbbcfc4ed39a97c212d51f313a"; 33 | 34 | // Your WiFi credentials. 35 | // Set password to "" for open networks. 36 | char ssid[] = "kenken64"; 37 | char pass[] = "7730112910100"; 38 | BlynkTimer timer; 39 | 40 | class theEventsThatWeAreInterestedInDuringScanning: public BLEAdvertisedDeviceCallbacks { 41 | void onResult(BLEAdvertisedDevice advertisedDevice) { 42 | if (advertisedDevice.getName() == "MJ_HT_V1") { 43 | advertisedDevice.getScan()->stop(); 44 | addressOfOurThermometer = new BLEAddress(advertisedDevice.getAddress()); } } }; 45 | 46 | static void notifyAsEachTemperatureValueIsReceived(BLERemoteCharacteristic* pBLERemoteCharacteristic, uint8_t* receivedNotification, size_t length, bool isNotify) { 47 | unsigned long currentMillis = millis(); 48 | if((currentMillis - previousMillis2 >= OnTime2)) 49 | { 50 | delay(500); 51 | for (int i=2; i<=5; i++) { 52 | receivedTemperatureValue += (char)*(receivedNotification+i); 53 | } 54 | 55 | for (int i=9; i<=12; i++) { 56 | receivedHumidityValue += (char)*(receivedNotification+i); 57 | } 58 | Serial.println(receivedTemperatureValue); 59 | Serial.println(receivedHumidityValue); 60 | if (receivedTemperatureValue.length() < 0 && receivedHumidityValue.length() < 0) return; 61 | delay(4000); 62 | Blynk.virtualWrite(V0, receivedTemperatureValue); 63 | delay(1000); 64 | Blynk.virtualWrite(V1, receivedHumidityValue); 65 | delay(60000); 66 | ESP.restart(); 67 | previousMillis2 = currentMillis; 68 | } 69 | } 70 | void readTempHumidity() { 71 | unsigned long currentMillis = millis(); 72 | if((currentMillis - previousMillis1 >= OnTime1)) 73 | { 74 | if (thisOurMicrocontrollerAsClient->isConnected() == false) { 75 | thisOurMicrocontrollerAsClient->disconnect(); 76 | delay(20); 77 | thisOurMicrocontrollerAsClient->connect(*addressOfOurThermometer); 78 | startTime = millis(); 79 | } // Here the our ESP32 as a client asks for a connection to the desired target device. 80 | 81 | if( thisOurMicrocontrollerAsClient->isConnected() == false ) { 82 | Serial.println(F("e4 Connection couln't be established")); 83 | ESP.restart(); 84 | } 85 | 86 | if (remoteServiceOfTheThermometer == nullptr) { 87 | remoteServiceOfTheThermometer = thisOurMicrocontrollerAsClient->getService("226c0000-6476-4566-7562-66734470666d"); 88 | } 89 | 90 | if (remoteServiceOfTheThermometer == nullptr) { 91 | thisOurMicrocontrollerAsClient->disconnect(); 92 | } 93 | 94 | if (characteristicOfTheTemperatureMeasurementValue == nullptr) { 95 | characteristicOfTheTemperatureMeasurementValue = remoteServiceOfTheThermometer->getCharacteristic("226caa55-6476-4566-7562-66734470666d"); 96 | } 97 | 98 | if (characteristicOfTheTemperatureMeasurementValue == nullptr) { 99 | thisOurMicrocontrollerAsClient->disconnect(); 100 | } 101 | 102 | if(characteristicOfTheTemperatureMeasurementValue != nullptr){ 103 | characteristicOfTheTemperatureMeasurementValue->registerForNotify(notifyAsEachTemperatureValueIsReceived); 104 | } 105 | 106 | if (descriptorForStartingAndEndingNotificationsFromCharacteristic == nullptr) { 107 | descriptorForStartingAndEndingNotificationsFromCharacteristic = characteristicOfTheTemperatureMeasurementValue->getDescriptor(BLEUUID((uint16_t)0x2902)); 108 | } 109 | 110 | if (descriptorForStartingAndEndingNotificationsFromCharacteristic == nullptr) { 111 | thisOurMicrocontrollerAsClient->disconnect(); 112 | } 113 | 114 | uint8_t startNotifications[2] = {0x01,0x00}; 115 | if(descriptorForStartingAndEndingNotificationsFromCharacteristic != nullptr){ 116 | descriptorForStartingAndEndingNotificationsFromCharacteristic->writeValue(startNotifications, 2, false); 117 | } 118 | // Ideas: https://stackoverflow.com/questions/1269568/how-to-pass-a-constant-array-literal-to-a-function-that-takes-a-pointer-without 119 | startTime = millis(); 120 | while( ( (millis() - startTime) < 5000) && (receivedTemperatureValue.length() < 4) ) 121 | { 122 | if (thisOurMicrocontrollerAsClient->isConnected() == false) { 123 | } 124 | } 125 | 126 | characteristicOfTheTemperatureMeasurementValue->registerForNotify(NULL); 127 | uint8_t endNotifications[2] = {0x00,0x00}; 128 | descriptorForStartingAndEndingNotificationsFromCharacteristic->writeValue(endNotifications, 2, false); 129 | 130 | if (receivedTemperatureValue.length() < 4) Serial.println(F("e14 No proper temperature measurement value catched.")); 131 | previousMillis1 = currentMillis; 132 | } 133 | } 134 | 135 | void setup() { 136 | Serial.begin(115200); 137 | delay(300); 138 | Serial.println(WiFi.getMode()); 139 | WiFi.mode(WIFI_STA); 140 | delay(1000); 141 | Serial.print("WIFI status = "); 142 | Serial.println(WiFi.getMode()); 143 | 144 | Blynk.begin(auth, ssid, pass, IPAddress(188,166,206,43), 80); 145 | btStart(); 146 | Blynk.syncAll(); 147 | 148 | timer.setInterval(1000L, readTempHumidity); 149 | timer.setInterval(30*1000, reconnectBlynk); //run every 30s 150 | delay(300); 151 | BLEDevice::init(""); 152 | BLEScan* myBLEScanner = BLEDevice::getScan(); 153 | myBLEScanner->setAdvertisedDeviceCallbacks(new theEventsThatWeAreInterestedInDuringScanning()); 154 | myBLEScanner->setActiveScan(true); 155 | while (addressOfOurThermometer == nullptr) { 156 | myBLEScanner->start(30); startTime=millis(); 157 | while ( (millis()-startTime <50) && (addressOfOurThermometer == nullptr) ) { delay(1); } } 158 | thisOurMicrocontrollerAsClient = BLEDevice::createClient(); 159 | } 160 | 161 | void reconnectBlynk() { 162 | if (!Blynk.connected()) { 163 | Serial.println("Lost connection"); 164 | if(Blynk.connect()) { 165 | ++reconnectCount; 166 | Serial.println("Reconnected"); 167 | if(reconnectCount > 6){ 168 | ESP.restart(); 169 | } 170 | } 171 | else { 172 | Serial.println("Not reconnected"); 173 | } 174 | } 175 | } 176 | 177 | void loop() { 178 | timer.run(); 179 | if (Blynk.connected()) { 180 | Blynk.run(); 181 | } else { 182 | ESP.restart(); 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 48 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 49 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 50 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 64 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 9740EEB11CF90186004384FC /* Flutter */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 3B80C3931E831B6300D905FE /* App.framework */, 75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 76 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 77 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 78 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 79 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 80 | ); 81 | name = Flutter; 82 | sourceTree = ""; 83 | }; 84 | 97C146E51CF9000F007C117D = { 85 | isa = PBXGroup; 86 | children = ( 87 | 9740EEB11CF90186004384FC /* Flutter */, 88 | 97C146F01CF9000F007C117D /* Runner */, 89 | 97C146EF1CF9000F007C117D /* Products */, 90 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 97C146EF1CF9000F007C117D /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 97C146EE1CF9000F007C117D /* Runner.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 97C146F01CF9000F007C117D /* Runner */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 106 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 107 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 108 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 109 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 110 | 97C147021CF9000F007C117D /* Info.plist */, 111 | 97C146F11CF9000F007C117D /* Supporting Files */, 112 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 113 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 114 | ); 115 | path = Runner; 116 | sourceTree = ""; 117 | }; 118 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 97C146F21CF9000F007C117D /* main.m */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | /* End PBXGroup section */ 127 | 128 | /* Begin PBXNativeTarget section */ 129 | 97C146ED1CF9000F007C117D /* Runner */ = { 130 | isa = PBXNativeTarget; 131 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 132 | buildPhases = ( 133 | 9740EEB61CF901F6004384FC /* Run Script */, 134 | 97C146EA1CF9000F007C117D /* Sources */, 135 | 97C146EB1CF9000F007C117D /* Frameworks */, 136 | 97C146EC1CF9000F007C117D /* Resources */, 137 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 138 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 139 | ); 140 | buildRules = ( 141 | ); 142 | dependencies = ( 143 | ); 144 | name = Runner; 145 | productName = Runner; 146 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 147 | productType = "com.apple.product-type.application"; 148 | }; 149 | /* End PBXNativeTarget section */ 150 | 151 | /* Begin PBXProject section */ 152 | 97C146E61CF9000F007C117D /* Project object */ = { 153 | isa = PBXProject; 154 | attributes = { 155 | LastUpgradeCheck = 0910; 156 | ORGANIZATIONNAME = "The Chromium Authors"; 157 | TargetAttributes = { 158 | 97C146ED1CF9000F007C117D = { 159 | CreatedOnToolsVersion = 7.3.1; 160 | }; 161 | }; 162 | }; 163 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 164 | compatibilityVersion = "Xcode 3.2"; 165 | developmentRegion = English; 166 | hasScannedForEncodings = 0; 167 | knownRegions = ( 168 | en, 169 | Base, 170 | ); 171 | mainGroup = 97C146E51CF9000F007C117D; 172 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 173 | projectDirPath = ""; 174 | projectRoot = ""; 175 | targets = ( 176 | 97C146ED1CF9000F007C117D /* Runner */, 177 | ); 178 | }; 179 | /* End PBXProject section */ 180 | 181 | /* Begin PBXResourcesBuildPhase section */ 182 | 97C146EC1CF9000F007C117D /* Resources */ = { 183 | isa = PBXResourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 187 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 188 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 189 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 190 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXShellScriptBuildPhase section */ 197 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 198 | isa = PBXShellScriptBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | inputPaths = ( 203 | ); 204 | name = "Thin Binary"; 205 | outputPaths = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 210 | }; 211 | 9740EEB61CF901F6004384FC /* Run Script */ = { 212 | isa = PBXShellScriptBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | inputPaths = ( 217 | ); 218 | name = "Run Script"; 219 | outputPaths = ( 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | shellPath = /bin/sh; 223 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 224 | }; 225 | /* End PBXShellScriptBuildPhase section */ 226 | 227 | /* Begin PBXSourcesBuildPhase section */ 228 | 97C146EA1CF9000F007C117D /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 233 | 97C146F31CF9000F007C117D /* main.m in Sources */, 234 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXSourcesBuildPhase section */ 239 | 240 | /* Begin PBXVariantGroup section */ 241 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 242 | isa = PBXVariantGroup; 243 | children = ( 244 | 97C146FB1CF9000F007C117D /* Base */, 245 | ); 246 | name = Main.storyboard; 247 | sourceTree = ""; 248 | }; 249 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 250 | isa = PBXVariantGroup; 251 | children = ( 252 | 97C147001CF9000F007C117D /* Base */, 253 | ); 254 | name = LaunchScreen.storyboard; 255 | sourceTree = ""; 256 | }; 257 | /* End PBXVariantGroup section */ 258 | 259 | /* Begin XCBuildConfiguration section */ 260 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 261 | isa = XCBuildConfiguration; 262 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_ANALYZER_NONNULL = YES; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_COMMA = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 275 | CLANG_WARN_EMPTY_BODY = YES; 276 | CLANG_WARN_ENUM_CONVERSION = YES; 277 | CLANG_WARN_INFINITE_RECURSION = YES; 278 | CLANG_WARN_INT_CONVERSION = YES; 279 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 280 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 283 | CLANG_WARN_STRICT_PROTOTYPES = YES; 284 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 285 | CLANG_WARN_UNREACHABLE_CODE = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = NO; 289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 290 | ENABLE_NS_ASSERTIONS = NO; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu99; 293 | GCC_NO_COMMON_BLOCKS = YES; 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 301 | MTL_ENABLE_DEBUG_INFO = NO; 302 | SDKROOT = iphoneos; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | VALIDATE_PRODUCT = YES; 305 | }; 306 | name = Profile; 307 | }; 308 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 309 | isa = XCBuildConfiguration; 310 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 311 | buildSettings = { 312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 313 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 314 | DEVELOPMENT_TEAM = S8QB4VV633; 315 | ENABLE_BITCODE = NO; 316 | FRAMEWORK_SEARCH_PATHS = ( 317 | "$(inherited)", 318 | "$(PROJECT_DIR)/Flutter", 319 | ); 320 | INFOPLIST_FILE = Runner/Info.plist; 321 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 322 | LIBRARY_SEARCH_PATHS = ( 323 | "$(inherited)", 324 | "$(PROJECT_DIR)/Flutter", 325 | ); 326 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterIot; 327 | PRODUCT_NAME = "$(TARGET_NAME)"; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 355 | CLANG_WARN_STRICT_PROTOTYPES = YES; 356 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 357 | CLANG_WARN_UNREACHABLE_CODE = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = dwarf; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | ENABLE_TESTABILITY = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_DYNAMIC_NO_PIC = NO; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 379 | MTL_ENABLE_DEBUG_INFO = YES; 380 | ONLY_ACTIVE_ARCH = YES; 381 | SDKROOT = iphoneos; 382 | TARGETED_DEVICE_FAMILY = "1,2"; 383 | }; 384 | name = Debug; 385 | }; 386 | 97C147041CF9000F007C117D /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_COMMA = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 407 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 408 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 409 | CLANG_WARN_STRICT_PROTOTYPES = YES; 410 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 416 | ENABLE_NS_ASSERTIONS = NO; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_NO_COMMON_BLOCKS = YES; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 427 | MTL_ENABLE_DEBUG_INFO = NO; 428 | SDKROOT = iphoneos; 429 | TARGETED_DEVICE_FAMILY = "1,2"; 430 | VALIDATE_PRODUCT = YES; 431 | }; 432 | name = Release; 433 | }; 434 | 97C147061CF9000F007C117D /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 440 | ENABLE_BITCODE = NO; 441 | FRAMEWORK_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "$(PROJECT_DIR)/Flutter", 444 | ); 445 | INFOPLIST_FILE = Runner/Info.plist; 446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 447 | LIBRARY_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterIot; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | VERSIONING_SYSTEM = "apple-generic"; 454 | }; 455 | name = Debug; 456 | }; 457 | 97C147071CF9000F007C117D /* Release */ = { 458 | isa = XCBuildConfiguration; 459 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 460 | buildSettings = { 461 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 462 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 463 | ENABLE_BITCODE = NO; 464 | FRAMEWORK_SEARCH_PATHS = ( 465 | "$(inherited)", 466 | "$(PROJECT_DIR)/Flutter", 467 | ); 468 | INFOPLIST_FILE = Runner/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 470 | LIBRARY_SEARCH_PATHS = ( 471 | "$(inherited)", 472 | "$(PROJECT_DIR)/Flutter", 473 | ); 474 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterIot; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | VERSIONING_SYSTEM = "apple-generic"; 477 | }; 478 | name = Release; 479 | }; 480 | /* End XCBuildConfiguration section */ 481 | 482 | /* Begin XCConfigurationList section */ 483 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 97C147031CF9000F007C117D /* Debug */, 487 | 97C147041CF9000F007C117D /* Release */, 488 | 249021D3217E4FDB00AE95B9 /* Profile */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 97C147061CF9000F007C117D /* Debug */, 497 | 97C147071CF9000F007C117D /* Release */, 498 | 249021D4217E4FDB00AE95B9 /* Profile */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 506 | } 507 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @import Firebase; 5 | 6 | @implementation AppDelegate 7 | 8 | - (BOOL)application:(UIApplication *)application 9 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 10 | [FIRApp configure]; 11 | [GeneratedPluginRegistrant registerWithRegistry:self]; 12 | // Override point for customization after application launch. 13 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenken64/flutter_iot/162dc4188d3d159e488d88222aefd24126eaee3d/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/GoogleService-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CLIENT_ID 6 | 999431981277-k6nr69bqaat034mntgc6369f26nlutda.apps.googleusercontent.com 7 | REVERSED_CLIENT_ID 8 | com.googleusercontent.apps.999431981277-k6nr69bqaat034mntgc6369f26nlutda 9 | API_KEY 10 | AIzaSyAoZGOyfjrjCzLr4Xx2yZAlF-_aG7xukAc 11 | GCM_SENDER_ID 12 | 999431981277 13 | PLIST_VERSION 14 | 1 15 | BUNDLE_ID 16 | com.example.flutteriot 17 | PROJECT_ID 18 | mijia-thermostat 19 | STORAGE_BUCKET 20 | mijia-thermostat.appspot.com 21 | IS_ADS_ENABLED 22 | 23 | IS_ANALYTICS_ENABLED 24 | 25 | IS_APPINVITE_ENABLED 26 | 27 | IS_GCM_ENABLED 28 | 29 | IS_SIGNIN_ENABLED 30 | 31 | GOOGLE_APP_ID 32 | 1:999431981277:ios:8f973cd62f1f2d86 33 | DATABASE_URL 34 | https://mijia-thermostat.firebaseio.com 35 | 36 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_iot 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io' show Platform; 3 | 4 | import 'package:carousel_slider/carousel_slider.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:http/http.dart' as http; 7 | import 'dart:convert'; 8 | import 'package:firebase_core/firebase_core.dart'; 9 | import 'package:firebase_database/firebase_database.dart'; 10 | 11 | 12 | final List imgList = [ 13 | 'https://i.ytimg.com/vi/ifrHogDujXw/maxresdefault.jpg', 14 | 'https://compote.slate.com/images/eb1853bf-8feb-471a-8402-00bd5bf8b30f.jpg', 15 | 'https://www.simpsondoor.com/door-idea-gallery/fullsize/wood-double-doors-8420.jpg', 16 | 'https://d2gk6qz8djobw9.cloudfront.net/slider/1499945767.jpg', 17 | ]; 18 | 19 | final List imgIconList = [ 20 | 'assets/door-closed.png', 21 | 'assets/door-open.png', 22 | 'assets/humidity.png', 23 | 'assets/temperature.png', 24 | 'assets/motion.png', 25 | ]; 26 | 27 | final List imgObjectNames = [ 28 | 'Temperature', 29 | 'Humidity', 30 | 'Door Sensor', 31 | 'Motion', 32 | ]; 33 | 34 | 35 | Future main() async { 36 | final FirebaseApp app = await FirebaseApp.configure( 37 | name: 'mijia-thermostat', 38 | options: Platform.isIOS 39 | ? const FirebaseOptions( 40 | googleAppID: '1:999431981277:ios:8f973cd62f1f2d86', 41 | gcmSenderID: '999431981277', 42 | databaseURL: 'https://mijia-thermostat.firebaseio.com', 43 | ) 44 | : const FirebaseOptions( 45 | googleAppID: '1:999431981277:android:70678bb0b07b2375', 46 | apiKey: 'AIzaSyCfGnx3sDUolTv7-4t7-jVI19UhIYb6AYU', 47 | databaseURL: 'https://mijia-thermostat.firebaseio.com', 48 | ), 49 | ); 50 | runApp(MaterialApp( 51 | title: 'Flutter iot', 52 | home: CarouselDemo(app: app), 53 | )); 54 | } 55 | //void main() => runApp(CarouselDemo()); 56 | 57 | final Widget placeholder = Container(color: Colors.grey); 58 | 59 | final List child = map( 60 | imgList, 61 | (index, i) { 62 | return Container( 63 | margin: EdgeInsets.all(5.0), 64 | child: ClipRRect( 65 | borderRadius: BorderRadius.all(Radius.circular(5.0)), 66 | child: Stack(children: [ 67 | Image.network(i, fit: BoxFit.cover, width: 500.0, 68 | height: 400.0,), 69 | Positioned( 70 | bottom: 0.0, 71 | left: 0.0, 72 | right: 0.0, 73 | child: Container( 74 | decoration: BoxDecoration( 75 | gradient: LinearGradient( 76 | colors: [Color.fromARGB(200, 0, 0, 0), Color.fromARGB(0, 0, 0, 0)], 77 | begin: Alignment.bottomCenter, 78 | end: Alignment.topCenter, 79 | ), 80 | ), 81 | padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0), 82 | child: Text( 83 | imgObjectNames[index], 84 | style: TextStyle( 85 | color: Colors.white, 86 | fontSize: 20.0, 87 | fontWeight: FontWeight.bold, 88 | ), 89 | ), 90 | ), 91 | ), 92 | ]), 93 | ), 94 | ); 95 | }, 96 | ).toList(); 97 | 98 | List map(List list, Function handler) { 99 | List result = []; 100 | for (var i = 0; i < list.length; i++) { 101 | result.add(handler(i, list[i])); 102 | } 103 | 104 | return result; 105 | } 106 | 107 | 108 | List iconsIot = [ 109 | Icon( 110 | Icons.ac_unit, 111 | color: Colors.blue[500], 112 | size: 50, 113 | ), 114 | Icon( 115 | Icons.beach_access, 116 | color: Colors.blue[500], 117 | size: 50, 118 | ), 119 | Icon( 120 | Icons.beenhere, 121 | color: Colors.blue[500], 122 | size: 50, 123 | ), 124 | Icon( 125 | Icons.directions_run, 126 | color: Colors.blue[500], 127 | size: 50, 128 | ), 129 | ]; 130 | 131 | class CarouselWithIndicator extends StatefulWidget { 132 | CarouselWithIndicator({this.app}); 133 | final FirebaseApp app; 134 | @override 135 | _CarouselWithIndicatorState createState() => _CarouselWithIndicatorState(); 136 | } 137 | 138 | class _CarouselWithIndicatorState extends State { 139 | int _current = 0; 140 | var iconIndex = 0; 141 | var descriptions = ""; 142 | var value = ""; 143 | var values; 144 | bool visibilityTag = false; 145 | DatabaseReference _tempThresholdRef; 146 | DatabaseReference _notificationRef; 147 | @override 148 | void dispose() { 149 | super.dispose(); 150 | } 151 | 152 | @override 153 | void initState() { 154 | super.initState(); 155 | _fetchData(_current); 156 | _tempThresholdRef = FirebaseDatabase.instance.reference().child('tempthreshold'); 157 | // Demonstrates configuring the database directly 158 | final FirebaseDatabase database = FirebaseDatabase(app: widget.app); 159 | _notificationRef = database.reference().child('notification'); 160 | database.reference().child('tempthreshold').once().then((DataSnapshot snapshot) { 161 | print('Connected to second database and read ${snapshot.value}'); 162 | }); 163 | database.setPersistenceEnabled(true); 164 | database.setPersistenceCacheSizeBytes(10000000); 165 | } 166 | 167 | _createRecord(){ 168 | _tempThresholdRef.set({ 169 | 'value': '4', 170 | 'message': 'temperature is above 4 Celcius' 171 | }); 172 | } 173 | 174 | _fetchData(_current) async { 175 | print("Attempting to fetch data from network.."); 176 | if(_current == 0){ 177 | final url = "http://blynk-cloud.com/238dc3bbbcfc4ed39a97c212d51f313a/get/V0"; 178 | final response = await http.get(url); 179 | if(response.statusCode == 200){ 180 | print(response.body); 181 | final map = json.decode(response.body); 182 | setState(() { 183 | this.descriptions = "Temperature"; 184 | var withoutbracket = map.toString().replaceAll("[", ''); 185 | withoutbracket = withoutbracket.replaceAll("]", ''); 186 | this.value = withoutbracket; 187 | this.iconIndex = _current; 188 | this.visibilityTag = true; 189 | }); 190 | } 191 | } 192 | 193 | if(_current == 1){ 194 | final url2 = "http://blynk-cloud.com/238dc3bbbcfc4ed39a97c212d51f313a/get/V1"; 195 | final response2 = await http.get(url2); 196 | if(response2.statusCode == 200){ 197 | print(response2.body); 198 | final map = json.decode(response2.body); 199 | setState(() { 200 | this.descriptions = "Humidity"; 201 | var withoutbracket = map.toString().replaceAll("[", ''); 202 | withoutbracket = withoutbracket.replaceAll("]", ''); 203 | this.value = withoutbracket; 204 | this.iconIndex = _current; 205 | }); 206 | } 207 | } 208 | 209 | if(_current == 2){ 210 | print("door sensor >>"); 211 | final url3 = "http://blynk-cloud.com/238dc3bbbcfc4ed39a97c212d51f313a/get/V2"; 212 | final response3 = await http.get(url3); 213 | if(response3.statusCode == 200){ 214 | print(response3.body); 215 | final map = json.decode(response3.body); 216 | setState(() { 217 | this.descriptions = "Door state"; 218 | var withoutbracket = map.toString().replaceAll("[", ''); 219 | withoutbracket = withoutbracket.replaceAll("]", ''); 220 | this.value = withoutbracket; 221 | this.iconIndex = _current; 222 | }); 223 | } 224 | } 225 | 226 | if(_current == 3){ 227 | print("motion >>"); 228 | final url3 = "http://blynk-cloud.com/238dc3bbbcfc4ed39a97c212d51f313a/get/V3"; 229 | final response3 = await http.get(url3); 230 | if(response3.statusCode == 200){ 231 | print(response3.body); 232 | final map = json.decode(response3.body); 233 | setState(() { 234 | this.descriptions = "Movement"; 235 | var withoutbracket = map.toString().replaceAll("[", ''); 236 | withoutbracket = withoutbracket.replaceAll("]", ''); 237 | if(withoutbracket == '1'){ 238 | withoutbracket = "Motion detected"; 239 | }else{ 240 | withoutbracket = "No motion detected"; 241 | } 242 | this.value = withoutbracket; 243 | this.iconIndex = _current; 244 | }); 245 | } 246 | } 247 | } 248 | 249 | @override 250 | Widget build(BuildContext context) { 251 | return Column(children: [ 252 | CarouselSlider( 253 | items: child, 254 | autoPlay: false, 255 | enlargeCenterPage: true, 256 | aspectRatio: 2.0, 257 | onPageChanged: (index) { 258 | setState(() { 259 | _current = index; 260 | _fetchData(_current); 261 | _createRecord(); 262 | }); 263 | }, 264 | ), 265 | Row( 266 | mainAxisAlignment: MainAxisAlignment.center, 267 | children: map( 268 | imgList, 269 | (index, url) { 270 | return Container( 271 | width: 8.0, 272 | height: 8.0, 273 | margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 2.0), 274 | decoration: BoxDecoration( 275 | shape: BoxShape.circle, 276 | color: _current == index 277 | ? Color.fromRGBO(0, 0, 0, 0.9) 278 | : Color.fromRGBO(0, 0, 0, 0.4)), 279 | ); 280 | }, 281 | ), 282 | ), 283 | SizedBox( 284 | height: 210, 285 | child: Card( 286 | child: Column( 287 | children: [ 288 | ListTile( 289 | title: Text(this.descriptions, 290 | style: TextStyle(fontSize:30,fontWeight: FontWeight.w500)), 291 | subtitle: Text(this.value , 292 | style: TextStyle(fontSize:21)), 293 | leading: iconsIot[this.iconIndex], 294 | ), 295 | Divider(), 296 | visibilityTag ? Text("1"): Text("2") 297 | ], 298 | ), 299 | ), 300 | ), 301 | ]); 302 | } 303 | } 304 | 305 | class CarouselDemo extends StatelessWidget { 306 | 307 | CarouselDemo({this.app}); 308 | final FirebaseApp app; 309 | 310 | @override 311 | Widget build(BuildContext context) { 312 | return MaterialApp( 313 | title: 'Flutter Internet of Things Demo', 314 | home: Scaffold( 315 | appBar: AppBar(title: Text('Flutter Internet of Things Demo')), 316 | body: ListView( 317 | children: [ 318 | Padding( 319 | padding: EdgeInsets.symmetric(vertical: 15.0), 320 | child: Column(children: [ 321 | Text('Sensor data'), 322 | CarouselWithIndicator(app: app), 323 | ])), 324 | ], 325 | ), 326 | ), 327 | ); 328 | } 329 | } -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.2.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.0.4" 18 | carousel_slider: 19 | dependency: "direct main" 20 | description: 21 | name: carousel_slider 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.3.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.2" 32 | collection: 33 | dependency: transitive 34 | description: 35 | name: collection 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.14.11" 39 | cupertino_icons: 40 | dependency: "direct main" 41 | description: 42 | name: cupertino_icons 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "0.1.2" 46 | firebase_core: 47 | dependency: "direct main" 48 | description: 49 | name: firebase_core 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "0.4.0+6" 53 | firebase_database: 54 | dependency: "direct main" 55 | description: 56 | name: firebase_database 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "3.0.3" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | http: 71 | dependency: "direct main" 72 | description: 73 | name: http 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "0.12.0+2" 77 | http_parser: 78 | dependency: transitive 79 | description: 80 | name: http_parser 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "3.1.3" 84 | matcher: 85 | dependency: transitive 86 | description: 87 | name: matcher 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "0.12.5" 91 | meta: 92 | dependency: transitive 93 | description: 94 | name: meta 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.1.6" 98 | path: 99 | dependency: transitive 100 | description: 101 | name: path 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.6.2" 105 | pedantic: 106 | dependency: transitive 107 | description: 108 | name: pedantic 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.7.0" 112 | quiver: 113 | dependency: transitive 114 | description: 115 | name: quiver 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "2.0.3" 119 | sky_engine: 120 | dependency: transitive 121 | description: flutter 122 | source: sdk 123 | version: "0.0.99" 124 | source_span: 125 | dependency: transitive 126 | description: 127 | name: source_span 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.5.5" 131 | stack_trace: 132 | dependency: transitive 133 | description: 134 | name: stack_trace 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.9.3" 138 | stream_channel: 139 | dependency: transitive 140 | description: 141 | name: stream_channel 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "2.0.0" 145 | string_scanner: 146 | dependency: transitive 147 | description: 148 | name: string_scanner 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.0.4" 152 | term_glyph: 153 | dependency: transitive 154 | description: 155 | name: term_glyph 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.1.0" 159 | test_api: 160 | dependency: transitive 161 | description: 162 | name: test_api 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "0.2.5" 166 | typed_data: 167 | dependency: transitive 168 | description: 169 | name: typed_data 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.1.6" 173 | vector_math: 174 | dependency: transitive 175 | description: 176 | name: vector_math 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "2.0.8" 180 | sdks: 181 | dart: ">=2.2.2 <3.0.0" 182 | flutter: ">=1.5.0 <2.0.0" 183 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_iot 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | carousel_slider: ^1.3.0 23 | http: ^0.12.0 24 | firebase_database: ^3.0.3 25 | firebase_core: ^0.4.0 26 | 27 | # The following adds the Cupertino Icons font to your application. 28 | # Use with the CupertinoIcons class for iOS style icons. 29 | cupertino_icons: ^0.1.2 30 | 31 | dev_dependencies: 32 | flutter_test: 33 | sdk: flutter 34 | 35 | 36 | # For information on the generic Dart part of this file, see the 37 | # following page: https://www.dartlang.org/tools/pub/pubspec 38 | 39 | # The following section is specific to Flutter. 40 | flutter: 41 | 42 | # The following line ensures that the Material Icons font is 43 | # included with your application, so that you can use the icons in 44 | # the material Icons class. 45 | uses-material-design: true 46 | 47 | # To add assets to your application, add an assets section, like this: 48 | assets: 49 | - assets/door-closed.png 50 | - assets/door-open.png 51 | - assets/humidity.png 52 | - assets/temperature.png 53 | - assets/motion.png 54 | 55 | 56 | # An image asset can refer to one or more resolution-specific "variants", see 57 | # https://flutter.dev/assets-and-images/#resolution-aware. 58 | 59 | # For details regarding adding assets from package dependencies, see 60 | # https://flutter.dev/assets-and-images/#from-packages 61 | 62 | # To add custom fonts to your application, add a fonts section here, 63 | # in this "flutter" section. Each entry in this list should have a 64 | # "family" key with the font family name, and a "fonts" key with a 65 | # list giving the asset and other descriptors for the font. For 66 | # example: 67 | # fonts: 68 | # - family: Schyler 69 | # fonts: 70 | # - asset: fonts/Schyler-Regular.ttf 71 | # - asset: fonts/Schyler-Italic.ttf 72 | # style: italic 73 | # - family: Trajan Pro 74 | # fonts: 75 | # - asset: fonts/TrajanPro.ttf 76 | # - asset: fonts/TrajanPro_Bold.ttf 77 | # weight: 700 78 | # 79 | # For details regarding fonts from package dependencies, 80 | # see https://flutter.dev/custom-fonts/#from-packages 81 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_iot/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(CarouselDemo()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | flutter_iot 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------------------------------------