diff --git a/.gitignore b/.gitignore
index 46f36fa..77e5618 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
# ---> Java
# Compiled class file
*.class
@@ -59,3 +60,20 @@ google-services.json
# Android Profiling
*.hprof
+=======
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+>>>>>>> fe08e92 (Old version with non-working Camera photo download)
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..3022b64
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+Haussteuerung
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..b589d56
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 0000000..0c0c338
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..0897082
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/migrations.xml b/.idea/migrations.xml
new file mode 100644
index 0000000..f8051a6
--- /dev/null
+++ b/.idea/migrations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..8978d23
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/render.experimental.xml b/.idea/render.experimental.xml
new file mode 100644
index 0000000..8ec256a
--- /dev/null
+++ b/.idea/render.experimental.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..a60dc6f
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,47 @@
+plugins {
+ alias(libs.plugins.androidApplication)
+ id 'com.google.gms.google-services'
+}
+
+android {
+ namespace 'com.haussteuerung'
+ compileSdk 34
+
+ defaultConfig {
+ applicationId "com.haussteuerung"
+ minSdk 26
+ targetSdk 34
+ versionCode 1
+ versionName "25.531.1"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+
+ implementation libs.appcompat
+ implementation libs.material
+ implementation libs.activity
+ implementation libs.constraintlayout
+ testImplementation libs.junit
+ androidTestImplementation libs.ext.junit
+ androidTestImplementation libs.espresso.core
+ implementation libs.pahoMqttv3
+ implementation libs.pahoMqttService
+ implementation libs.firebase.messaging
+ implementation libs.google.services
+ implementation libs.touchImageView
+ implementation libs.gson
+}
\ No newline at end of file
diff --git a/app/google-services.json b/app/google-services.json
new file mode 100644
index 0000000..5819ae9
--- /dev/null
+++ b/app/google-services.json
@@ -0,0 +1,47 @@
+{
+ "project_info": {
+ "project_number": "90338321703",
+ "project_id": "haussteuerung-2c0bc",
+ "storage_bucket": "haussteuerung-2c0bc.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:90338321703:android:e1268a5a9e17bbaee57502",
+ "android_client_info": {
+ "package_name": "com.haussteuerung"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "90338321703-h3qke5pi2kvh2ddd7dm1jhig6sfp8tdk.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "com.haussteuerung",
+ "certificate_hash": "1ea709802c0d889e9860150e007ea0660e85a870"
+ }
+ },
+ {
+ "client_id": "90338321703-kmrum42be0923jpr611ggap4h123gd2q.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyAl0JQ26RQ4j8xqfLCEpYFkrRtEVpKPTc0"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "90338321703-kmrum42be0923jpr611ggap4h123gd2q.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/release/app-release.apk b/app/release/app-release.apk
new file mode 100644
index 0000000..3a52aca
Binary files /dev/null and b/app/release/app-release.apk differ
diff --git a/app/release/baselineProfiles/0/app-release.dm b/app/release/baselineProfiles/0/app-release.dm
new file mode 100644
index 0000000..eba836a
Binary files /dev/null and b/app/release/baselineProfiles/0/app-release.dm differ
diff --git a/app/release/baselineProfiles/1/app-release.dm b/app/release/baselineProfiles/1/app-release.dm
new file mode 100644
index 0000000..47e7d7a
Binary files /dev/null and b/app/release/baselineProfiles/1/app-release.dm differ
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
new file mode 100644
index 0000000..c92145f
--- /dev/null
+++ b/app/release/output-metadata.json
@@ -0,0 +1,37 @@
+{
+ "version": 3,
+ "artifactType": {
+ "type": "APK",
+ "kind": "Directory"
+ },
+ "applicationId": "com.haussteuerung",
+ "variantName": "release",
+ "elements": [
+ {
+ "type": "SINGLE",
+ "filters": [],
+ "attributes": [],
+ "versionCode": 1,
+ "versionName": "25.1002.1",
+ "outputFile": "app-release.apk"
+ }
+ ],
+ "elementType": "File",
+ "baselineProfiles": [
+ {
+ "minApi": 28,
+ "maxApi": 30,
+ "baselineProfiles": [
+ "baselineProfiles/1/app-release.dm"
+ ]
+ },
+ {
+ "minApi": 31,
+ "maxApi": 2147483647,
+ "baselineProfiles": [
+ "baselineProfiles/0/app-release.dm"
+ ]
+ }
+ ],
+ "minSdkVersionForDexing": 26
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/haussteuerung/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/haussteuerung/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..2987c4b
--- /dev/null
+++ b/app/src/androidTest/java/com/haussteuerung/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.haussteuerung;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ assertEquals("com.haussteuerung", appContext.getPackageName());
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..6255407
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/FileDownload.java b/app/src/main/java/com/haussteuerung/FileDownload.java
new file mode 100644
index 0000000..51cccb1
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/FileDownload.java
@@ -0,0 +1,125 @@
+package com.haussteuerung;
+
+import android.content.ActivityNotFoundException;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.content.FileProvider;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import com.google.firebase.encoders.json.BuildConfig;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+public class FileDownload extends AppCompatActivity {
+
+ static String f1 = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/Haussteuerung_Flo.apk";
+ static File apk = new File(f1);
+ static boolean downloadFinished = false;
+ TextView txt_status;
+ Button button_Install;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_file_download);
+
+ // Ändern der Statusbar-Farbe
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.drawable.gradient_titlebar));
+
+ button_Install = findViewById(R.id.button_Install);
+ TextView txt_changelog = findViewById(R.id.txt_changelog);
+ txt_status = findViewById(R.id.txt_status);
+ downloadFile();
+
+ button_Install.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ installAPK();
+ }
+ });
+ }
+
+ Uri uriFromFile(Context context, File file) {
+ return FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file);
+ }
+
+ void installAPK() {
+ if (apk.exists()) {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setDataAndType(uriFromFile(getApplicationContext(), apk), "application/vnd.android.package-archive");
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ try {
+ getApplicationContext().startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ e.printStackTrace();
+ Log.e("TAG", "Error in opening the file!");
+ }
+ } else {
+ Toast.makeText(getApplicationContext(), "installing", Toast.LENGTH_LONG).show();
+ }
+ }
+
+
+ public void downloadFile() {
+ if (apk.exists()) {
+ apk.delete();
+ }
+
+ String url = "http://www.klebl.info/download/Haussteuerung_Flo.apk";
+ Log.d("Foto", url);
+
+ Thread gfgThread = new Thread(() -> {
+ try {
+ InputStream in = null;
+ try {
+ in = new URL(url).openStream();
+ String text = "Verbindung zum Server erfolgreich. Download wird durchgeführt.";
+ txt_status.setText(text);
+ Log.d("APK", "Verbindung zum Server erfolgreich. Download wird durchgeführt.");
+ } catch (IOException e) {
+ String text = "Verbindungsfehler.";
+ txt_status.setText(text);
+ Log.d("APK", "Verbindungsfehler.");
+ }
+ try {
+ Files.copy(in, Paths.get(f1), StandardCopyOption.REPLACE_EXISTING);
+ downloadFinished = true;
+ button_Install.setBackgroundResource(R.drawable.alarm_false);
+ String text = "Download erfolgreich. Zum Installieren drücken!";
+ txt_status.setText(text);
+ Log.d("APK", "Download und Speichern erfolgreich.");
+ } catch (IOException e) {
+ String text = "Download fehlgeschlagen.";
+ txt_status.setText(text);
+ Log.d("APK", "Download fehlgeschlagen.");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ });
+ gfgThread.start();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/FragmentHeizkoerper.java b/app/src/main/java/com/haussteuerung/FragmentHeizkoerper.java
new file mode 100644
index 0000000..c7a2779
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/FragmentHeizkoerper.java
@@ -0,0 +1,596 @@
+package com.haussteuerung;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Bundle;
+
+import androidx.appcompat.widget.SwitchCompat;
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.Fragment;
+
+import android.os.Handler;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.NumberPicker;
+import android.widget.TextView;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+public class FragmentHeizkoerper extends Fragment {
+
+ private Button btn_HK_Grossraum, btn_HK_Doris, btn_HK_Doris_Bad, btn_HK_Arbeitszimmer, btn_HK_Vorraum,
+ btn_HK_WCEG, btn_HK_Bad, btn_HK_Florian, btn_HK_Stefan, btn_HK_Dachboden;
+ private TextView tv_temp_Grossraum, tv_temp_Doris, tv_temp_Doris_Bad, tv_temp_Arbeitszimmer, tv_temp_Vorraum,
+ tv_temp_WCEG, tv_temp_Bad, tv_temp_Florian, tv_temp_Stefan, tv_temp_Dachboden;
+ private SwitchCompat switch_HK_Grossraum, switch_HK_Doris, switch_HK_Doris_Bad, switch_HK_Arbeitszimmer, switch_HK_Vorraum,
+ switch_HK_WCEG, switch_HK_Bad, switch_HK_Florian, switch_HK_Stefan, switch_HK_Dachboden;
+ public static String modeHKGrossraum = "", modeHKDoris = "", modeHKDorisBad = "", modeHKArbeitszimmer = "",
+ modeHKVorraum = "", modeHKWCEG = "", modeHKBad = "", modeHKFlorian = "", modeHKStefan = "", modeHKDachboden = "";
+ public static String istTempHKGrossraum = "", istTempHKDoris = "", istTempHKDorisBad = "", istTempHKArbeitszimmer = "",
+ istTempHKVorraum = "", istTempHKWCEG = "", istTempHKBad = "", istTempHKFlorian = "", istTempHKStefan = "", istTempHKDachboden = "";
+ public static String sollTempHKGrossraum = "", sollTempHKDoris = "", sollTempHKDorisBad = "", sollTempHKArbeitszimmer = "",
+ sollTempHKVorraum = "", sollTempHKWCEG = "", sollTempHKBad = "", sollTempHKFlorian = "", sollTempHKStefan = "", sollTempHKDachboden = "";
+
+ final Handler myHandler = new Handler();
+ final Timer myTimer = new Timer();
+ TimerTask myTask;
+ Context context;
+ View view;
+
+ public FragmentHeizkoerper() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ view = inflater.inflate(R.layout.fragment_heizkoerper, container, false);
+ requireActivity().setTitle("Haussteuerung - Heizkörper");
+
+ handleButtons();
+ handleTextViews();
+ handleSwitches();
+
+ context = getContext();
+
+
+ return view;
+ }
+
+ // Runnable method
+ final Runnable myRunnable = new Runnable() {
+ public void run() {
+ Log.d("Heizkoerper","OK");
+
+ tv_temp_Grossraum.setText(istTempHKGrossraum);
+ setTextColor(tv_temp_Grossraum, istTempHKGrossraum);
+ tv_temp_Doris.setText(istTempHKDoris);
+ setTextColor(tv_temp_Doris, istTempHKDoris);
+ tv_temp_Doris_Bad.setText(istTempHKDorisBad);
+ setTextColor(tv_temp_Doris_Bad, istTempHKDorisBad);
+ tv_temp_Arbeitszimmer.setText(istTempHKArbeitszimmer);
+ setTextColor(tv_temp_Arbeitszimmer, istTempHKArbeitszimmer);
+ tv_temp_Vorraum.setText(istTempHKVorraum);
+ setTextColor(tv_temp_Vorraum, istTempHKVorraum);
+ tv_temp_WCEG.setText(istTempHKWCEG);
+ setTextColor(tv_temp_WCEG, istTempHKWCEG);
+ tv_temp_Bad.setText(istTempHKBad);
+ setTextColor(tv_temp_Bad, istTempHKBad);
+ tv_temp_Florian.setText(istTempHKFlorian);
+ setTextColor(tv_temp_Florian, istTempHKFlorian);
+ tv_temp_Stefan.setText(istTempHKStefan);
+ setTextColor(tv_temp_Stefan, istTempHKStefan);
+ tv_temp_Dachboden.setText(istTempHKDachboden);
+ setTextColor(tv_temp_Dachboden, istTempHKDachboden);
+ }
+ };
+
+ private void showNumberPickerDialog(Button button, String roomSollTemp, String room, SwitchCompat switchCompat) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
+ final View view = this.getLayoutInflater().inflate(R.layout.layout_numberpicker, null);
+ builder.setView(view);
+ //builder.setTitle();
+ final NumberPicker picker = view.findViewById(R.id.picker);
+ String[] values = {"off","12.0","12.5","13.0","13.5","14.0","14.5","15.0","15.5","16.0","16.5","17.0","17.5","18.0",
+ "18.5","19.0","19.5","20.0","20.5","21.0","21.5","22.0","22.5","23.0","23.5","24.0","24.5","25.0",
+ "25.5","26.0","26.5","27.0","27.5","28.0","28.5","29.0","29.5","30.0","on"};
+ int ml = values.length;
+ picker.setWrapSelectorWheel(false);
+ picker.setMinValue(0);
+ picker.setMaxValue(ml - 1);
+ for(int y=0; y= 25) {
+ tv.setTextColor(ContextCompat.getColor(context, R.color.twoFive));
+ }
+ if (tempDouble >= 24 && tempDouble < 25) {
+ tv.setTextColor(ContextCompat.getColor(context, R.color.twoFour));
+ }
+ if (tempDouble >= 23 && tempDouble < 24) {
+ tv.setTextColor(ContextCompat.getColor(context, R.color.twoThree));
+ }
+ if (tempDouble >= 22 && tempDouble < 23) {
+ tv.setTextColor(ContextCompat.getColor(context, R.color.twoTwo));
+ }
+ if (tempDouble >= 21 && tempDouble < 22) {
+ tv.setTextColor(ContextCompat.getColor(context, R.color.twoOne));
+ }
+ if (tempDouble >= 20 && tempDouble < 21) {
+ tv.setTextColor(ContextCompat.getColor(context, R.color.twoZero));
+ }
+ if (tempDouble >= 19 && tempDouble < 20) {
+ tv.setTextColor(ContextCompat.getColor(context, R.color.oneNine));
+ }
+ if (tempDouble < 19) {
+ tv.setTextColor(ContextCompat.getColor(context, R.color.oneEight));
+ }
+ } else {
+ Log.d("Temp", "String Temp in FragmentHeizkörper is empty.");
+ }
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ myTask = new TimerTask() {
+ public void run() {
+ myHandler.post(myRunnable); // updateUI method
+ }
+ };
+ myTimer.schedule(myTask,0,1000); // TimerTask, delay, period
+ Log.d("State", "on Resume");
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ myTask.cancel();
+ Log.d("State", "on Stop");
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ Log.d("State", "on Pause");
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ // myTimer.cancel();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/FragmentHeizung.java b/app/src/main/java/com/haussteuerung/FragmentHeizung.java
new file mode 100644
index 0000000..618b748
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/FragmentHeizung.java
@@ -0,0 +1,334 @@
+package com.haussteuerung;
+
+import android.app.AlertDialog;
+import android.app.TimePickerDialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+
+import androidx.appcompat.widget.SwitchCompat;
+import androidx.fragment.app.Fragment;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.NumberPicker;
+import android.widget.TimePicker;
+
+import java.time.LocalTime;
+import java.util.Locale;
+
+
+public class FragmentHeizung extends Fragment {
+
+ private Button btn_hzZeit1, btn_hzZeit2, btn_hzZeit3, btn_hzZeit4, btn_hzZeit5, btn_hzZeit6, btn_hzVL1, btn_hzVL2, btn_hzVL3;
+ private CheckBox check_hzZeit1, check_hzZeit2, check_hzZeit3;
+ SwitchCompat switch_silentModeHz1, switch_silentModeHz2, switch_silentModeHz3;
+ public static String hzZeit1Mqtt = "00:00", hzZeit2Mqtt = "00:00", hzZeit3Mqtt = "00:00", hzZeit4Mqtt = "00:00", hzZeit5Mqtt = "00:00", hzZeit6Mqtt = "00:00";
+ public static boolean isCheckedHZ1 = false, isCheckedHZ2 = false, isCheckedHZ3 = false;
+ public static boolean switchHZ1 = false, switchHZ2 = false, switchHZ3 = false;
+ public static int tempHz1 = 48, tempHz2 = 45, tempHz3 = 50;
+ View view;
+
+ public FragmentHeizung() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ view = inflater.inflate(R.layout.fragment_heizung, container, false);
+ requireActivity().setTitle("Haussteuerung - Heizung");
+ // handleSwitch();
+ // handleButtons();
+ // handleCheckBoxes();
+ // sendValues();
+
+ return view;
+ }
+
+ public void sendValues() {
+ Button btn_HzSend = view.findViewById(R.id.btn_HzSend);
+ btn_HzSend.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String msgHzZeit1 = "{" +
+ "\"DeviceID\":\"" + MainActivity.ID + "\"," +
+ "\"CheckHZ1\":" + "\"" + check_hzZeit1.isChecked() + "\"," +
+ "\"SilentModeHZ1\":" + "\"" + switch_silentModeHz1.isChecked() + "\"," +
+ "\"ZeitHZ1\": " + "\"" + btn_hzZeit1.getText().toString() + "\"," +
+ "\"ZeitHZ2\": " + "\"" + btn_hzZeit2.getText().toString() + "\"," +
+ "\"TempHZ1\":" + btn_hzVL1.getText().toString() + "," +
+ "\"CheckHZ2\":" + "\"" + check_hzZeit2.isChecked() + "\"," +
+ "\"SilentModeHZ2\":" + "\"" + switch_silentModeHz2.isChecked() + "\"," +
+ "\"ZeitHZ3\": " + "\"" + btn_hzZeit3.getText().toString() + "\"," +
+ "\"ZeitHZ4\": " + "\"" + btn_hzZeit4.getText().toString() + "\"," +
+ "\"TempHZ2\":" + btn_hzVL2.getText().toString() + "," +
+ "\"CheckHZ3\":" + "\"" + check_hzZeit3.isChecked() + "\"," +
+ "\"SilentModeHZ3\":" + "\"" + switch_silentModeHz3.isChecked() + "\"," +
+ "\"ZeitHZ5\": " + "\"" + btn_hzZeit5.getText().toString() + "\"," +
+ "\"ZeitHZ6\": " + "\"" + btn_hzZeit6.getText().toString() + "\"," +
+ "\"TempHZ3\": " + btn_hzVL3.getText() +
+ "}";
+
+ MqttClient.publish("stat/Haussteuerung/LWP/Heizung", msgHzZeit1, 2, true);
+ MqttClient.publish("cmnd/Haussteuerung/LWP/Heizung", "{\"DeviceID\":\"" + MainActivity.ID + "\"}", 2, false);
+ requireActivity().onBackPressed();
+ }
+ });
+ }
+
+ public void handleButtons() {
+ btn_hzZeit1 = view.findViewById(R.id.btn_hzZeit1);
+ btn_hzZeit1.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timePickerDialog(btn_hzZeit1);
+ }
+ });
+ btn_hzZeit1.setText(hzZeit1Mqtt.substring(0,5));
+
+ btn_hzZeit2 = view.findViewById(R.id.btn_hzZeit2);
+ btn_hzZeit2.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timePickerDialog(btn_hzZeit2);
+ }
+ });
+ btn_hzZeit2.setText(hzZeit2Mqtt.substring(0,5));
+
+ btn_hzZeit3 = view.findViewById(R.id.btn_hzZeit3);
+ btn_hzZeit3.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timePickerDialog(btn_hzZeit3);
+ }
+ });
+ btn_hzZeit3.setText(hzZeit3Mqtt.substring(0,5));
+
+ btn_hzZeit4 = view.findViewById(R.id.btn_hzZeit4);
+ btn_hzZeit4.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timePickerDialog(btn_hzZeit4);
+ }
+ });
+ btn_hzZeit4.setText(hzZeit4Mqtt.substring(0,5));
+
+ btn_hzZeit5 = view.findViewById(R.id.btn_hzZeit5);
+ btn_hzZeit5.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timePickerDialog(btn_hzZeit5);
+ }
+ });
+ btn_hzZeit5.setText(hzZeit5Mqtt.substring(0,5));
+
+ btn_hzZeit6 = view.findViewById(R.id.btn_hzZeit6);
+ btn_hzZeit6.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timePickerDialog(btn_hzZeit6);
+ }
+ });
+ btn_hzZeit6.setText(hzZeit6Mqtt.substring(0,5));
+
+
+ btn_hzVL1 = view.findViewById(R.id.btn_hzVL1);
+ btn_hzVL2 = view.findViewById(R.id.btn_hzVL2);
+ btn_hzVL3 = view.findViewById(R.id.btn_hzVL3);
+ btn_hzVL1.setText(String.valueOf(tempHz1));
+ btn_hzVL2.setText(String.valueOf(tempHz2));
+ btn_hzVL3.setText(String.valueOf(tempHz3));
+
+ btn_hzVL1.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showNumberPickerDialog(btn_hzVL1);
+ }
+ });
+
+ btn_hzVL2.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showNumberPickerDialog(btn_hzVL2);
+ }
+ });
+
+ btn_hzVL3.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showNumberPickerDialog(btn_hzVL3);
+ }
+ });
+ }
+
+ public void handleCheckBoxes() {
+ check_hzZeit1 = view.findViewById(R.id.check_hzZeit1);
+ check_hzZeit2 = view.findViewById(R.id.check_hzZeit2);
+ check_hzZeit3 = view.findViewById(R.id.check_hzZeit3);
+ check_hzZeit1.setChecked(isCheckedHZ1);
+ check_hzZeit2.setChecked(isCheckedHZ2);
+ check_hzZeit3.setChecked(isCheckedHZ3);
+
+ // Set visibilty of buttons
+ if (check_hzZeit1.isChecked()) {
+ switch_silentModeHz1.setEnabled(true);
+ btn_hzZeit1.setEnabled(true);
+ btn_hzZeit2.setEnabled(true);
+ btn_hzVL1.setEnabled(true);
+ } else {
+ switch_silentModeHz1.setEnabled(false);
+ btn_hzZeit1.setEnabled(false);
+ btn_hzZeit2.setEnabled(false);
+ btn_hzVL1.setEnabled(false);
+ }
+ check_hzZeit1.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (check_hzZeit1.isChecked()) {
+ switch_silentModeHz1.setEnabled(true);
+ btn_hzZeit1.setEnabled(true);
+ btn_hzZeit2.setEnabled(true);
+ btn_hzVL1.setEnabled(true);
+ } else {
+ switch_silentModeHz1.setEnabled(false);
+ btn_hzZeit1.setEnabled(false);
+ btn_hzZeit2.setEnabled(false);
+ btn_hzVL1.setEnabled(false);
+ }
+ }
+ });
+
+ if (check_hzZeit2.isChecked()) {
+ switch_silentModeHz2.setEnabled(true);
+ btn_hzZeit3.setEnabled(true);
+ btn_hzZeit4.setEnabled(true);
+ btn_hzVL2.setEnabled(true);
+ } else {
+ switch_silentModeHz2.setEnabled(false);
+ btn_hzZeit3.setEnabled(false);
+ btn_hzZeit4.setEnabled(false);
+ btn_hzVL2.setEnabled(false);
+ }
+ check_hzZeit2.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (check_hzZeit2.isChecked()) {
+ switch_silentModeHz2.setEnabled(true);
+ btn_hzZeit3.setEnabled(true);
+ btn_hzZeit4.setEnabled(true);
+ btn_hzVL2.setEnabled(true);
+ } else {
+ switch_silentModeHz2.setEnabled(false);
+ btn_hzZeit3.setEnabled(false);
+ btn_hzZeit4.setEnabled(false);
+ btn_hzVL2.setEnabled(false);
+ }
+ }
+ });
+
+ if (check_hzZeit3.isChecked()) {
+ switch_silentModeHz3.setEnabled(true);
+ btn_hzZeit5.setEnabled(true);
+ btn_hzZeit6.setEnabled(true);
+ btn_hzVL3.setEnabled(true);
+ } else {
+ switch_silentModeHz3.setEnabled(false);
+ btn_hzZeit5.setEnabled(false);
+ btn_hzZeit6.setEnabled(false);
+ btn_hzVL3.setEnabled(false);
+ }
+ check_hzZeit3.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (check_hzZeit3.isChecked()) {
+ switch_silentModeHz3.setEnabled(true);
+ btn_hzZeit5.setEnabled(true);
+ btn_hzZeit6.setEnabled(true);
+ btn_hzVL3.setEnabled(true);
+ } else {
+ switch_silentModeHz3.setEnabled(false);
+ btn_hzZeit5.setEnabled(false);
+ btn_hzZeit6.setEnabled(false);
+ btn_hzVL3.setEnabled(false);
+ }
+ }
+ });
+ }
+
+ public void handleSwitch() {
+ switch_silentModeHz1 = view.findViewById(R.id.switch_silentModeHz1);
+ switch_silentModeHz2 = view.findViewById(R.id.switch_silentModeHz2);
+ switch_silentModeHz3 = view.findViewById(R.id.switch_silentModeHz3);
+
+ switch_silentModeHz1.setChecked(switchHZ1);
+ switch_silentModeHz2.setChecked(switchHZ2);
+ switch_silentModeHz3.setChecked(switchHZ3);
+ }
+
+ private void showNumberPickerDialog(Button button) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
+ final View view = this.getLayoutInflater().inflate(R.layout.layout_numberpicker, null);
+ builder.setView(view);
+ //builder.setTitle();
+ final NumberPicker picker = view.findViewById(R.id.picker);
+ String[] values = {"30","31","32","33","34","35","36","37","38","39","40","41","42","43",
+ "44","45","46","47","48","49","50"};
+ int ml = values.length;
+ picker.setWrapSelectorWheel(false);
+ picker.setMinValue(0);
+ picker.setMaxValue(ml - 1);
+ for(int y=0; y= Build.VERSION_CODES.R) {
+ Log.d("Permission", "" + SDK_INT);
+ if (!Environment.isExternalStorageManager()) {
+ ActivityCompat.requestPermissions(this,
+ new String[]{android.Manifest.permission.READ_EXTERNAL_STORAGE,
+ android.Manifest.permission.MANAGE_EXTERNAL_STORAGE}, 1);//permission request code is just an int
+ File file = new File(Environment.getExternalStorageDirectory().getPath() + "/Pictures/Haussteuerung/");
+ if (!file.exists()) {
+ file.mkdir();
+ }
+ }
+ } else {
+ if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
+ }
+ }
+
+ FirebaseMessaging.getInstance().subscribeToTopic("general");
+ FirebaseMessaging.getInstance().subscribeToTopic(ID);
+
+ // Connecten des Mqtt-Clients
+ try {
+ MqttClient.connect();
+ } catch (Exception e) {
+ Log.d("MQTT", "Verbindung fehlgeschlagen");
+ }
+ // Log.d("MQTT", String.valueOf(MqttClient.connSuccess));
+ // if (!MqttClient.connSuccess) {
+ // MqttClient.connect();
+ // }
+
+ // Instanzieren der Buttons und TextViews
+ ImageView imageViewHaus = findViewById(R.id.imageViewHaus);
+ Button buttonHaus = findViewById(R.id.buttonHaus);
+ Button buttonGlocke = findViewById(R.id.buttonGlocke);
+ Button buttonLicht = findViewById(R.id.buttonLicht);
+ Button buttonLog = findViewById(R.id.buttonLog);
+ Button buttonLWP = findViewById(R.id.buttonLWP);
+ Button buttonDoris = findViewById(R.id.buttonDoris);
+ Button buttonDorisLicht = findViewById(R.id.buttonDorisLicht);
+ buttonAlarm = findViewById(R.id.buttonAlarm);
+ tv_WM1 = findViewById(R.id.textview_WM1);
+ tv_WM2 = findViewById(R.id.textview_WM2);
+ tv_mqtt = findViewById(R.id.textView_Mqtt);
+ buttonHaus.setOnClickListener(this);
+ buttonGlocke.setOnClickListener(this);
+ buttonLicht.setOnClickListener(this);
+ buttonLog.setOnClickListener(this);
+ buttonLWP.setOnClickListener(this);
+ buttonDoris.setOnClickListener(this);
+ buttonDorisLicht.setOnClickListener(this);
+ imageViewHaus.setOnClickListener(this);
+
+ imageViewHaus.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ alertDialogHaus();
+ }
+ });
+
+ imageViewHaus.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View view) {
+ alertDialogVersion();
+ return true;
+ }
+ });
+
+ buttonAlarm.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Log.d("Alarm", String.valueOf(alarmStatus));
+ if (alarmStatus) {
+ // Alarm ein, also ausschalten
+ MqttClient.publish("cmnd/Haussteuerung/Alarm", "{\"DeviceID\":\"" + ID + "\",\"Name\":\"Alarm\",\"Zustand\":\"true\"}");
+ } else {
+ // Alarm aus, also einschalten
+ alertDialogAlarm();
+ }
+ }
+ });
+
+ Intent i = getIntent();
+ if (i.getExtras() != null) {
+ if (i.getExtras() != null && i.hasExtra("Time")) {
+ Log.d("GlockeZeit", i.getStringExtra("Time"));
+ }
+ if ((i.getExtras() != null) && (i.hasExtra("Time"))) {
+ Intent iGlocke = new Intent(MainActivity.this, activityGlocke.class);
+ iGlocke.putExtra("TimeFB", i.getStringExtra("Time"));
+ Log.d("GlockeZeit", i.getStringExtra("Time"));
+ startActivity(iGlocke);
+ }
+ if ((i.getExtras() != null) && (i.hasExtra("Sky"))) {
+ Intent iSky = new Intent(MainActivity.this, activitySky.class);
+ Log.d("Sky", i.getStringExtra("Sky"));
+ startActivity(iSky);
+ }
+ if ((i.getExtras() != null) && (i.hasExtra("Other"))) {
+ Log.d("Other", i.getStringExtra("Other"));
+ alertDialogNotification(i.getStringExtra("Other"));
+ }
+ }
+
+ Log.d("MainActivityPause", "false");
+ }
+
+ private void TimerMethod() {
+ this.runOnUiThread(Timer_Tick);
+ }
+
+ private final Runnable Timer_Tick = new Runnable() {
+ public void run() {
+ if (MqttClient.client.isConnected()) {
+ tv_mqtt.setTextColor(Color.parseColor("#64DD17"));
+ } else {
+ tv_mqtt.setTextColor(Color.RED);
+ }
+
+ if (alarmStatus) {
+ buttonAlarm.setText(R.string.alarm_ein);
+ buttonAlarm.setBackgroundResource(R.drawable.alarm_true);
+ } else {
+ buttonAlarm.setText(R.string.alarm_aus);
+ buttonAlarm.setBackgroundResource(R.drawable.alarm_false);
+ }
+
+ if (wm1Status) {
+ tv_WM1.setText(R.string.wm1_laeuft);
+ } else {
+ tv_WM1.setText(R.string.wm1_aus);
+ }
+
+ if (wm2Status) {
+ tv_WM2.setText(R.string.wm2_laeuft);
+ } else {
+ tv_WM2.setText(R.string.wm2_aus);
+ }
+
+ Log.d("TimerMainActivity", "Running");
+ }
+ };
+
+ @SuppressLint("NonConstantResourceId")
+ @Override
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.buttonLWP:
+ Intent iLWP = new Intent(MainActivity.this, activityLWP.class);
+ startActivity(iLWP);
+ break;
+ case R.id.buttonDoris:
+ Intent iDoris = new Intent(MainActivity.this, activityDoris.class);
+ startActivity(iDoris);
+ break;
+ case R.id.buttonDorisLicht:
+ Intent iDorisLicht = new Intent(MainActivity.this, activityDorisLicht.class);
+ startActivity(iDorisLicht);
+ break;
+ case R.id.buttonHaus:
+ Intent intent = new Intent(MainActivity.this, activityHaus.class);
+ startActivity(intent);
+ break;
+ case R.id.buttonGlocke:
+ Intent iGlocke = new Intent(MainActivity.this, activityGlocke.class);
+ startActivity(iGlocke);
+ break;
+ case R.id.buttonLicht:
+ Intent iLicht = new Intent(MainActivity.this, activityLicht.class);
+ startActivity(iLicht);
+ break;
+ case R.id.buttonLog:
+ Intent iLog = new Intent(MainActivity.this, activityLog.class);
+ startActivity(iLog);
+ break;
+ }
+ }
+
+ // Methode zum Öffnen des AlertDialogs beim Klick aufs Haus-Foto
+ public void alertDialogHaus() {
+ // Titlebar ändern
+ TextView textView = new TextView(getApplicationContext());
+ textView.setText(R.string.tor_steuerung);
+ textView.setPadding(20, 30, 20, 30);
+ textView.setTextSize(20F);
+ textView.setBackgroundResource(R.drawable.gradient_titlebar);
+ textView.setTextColor(Color.WHITE);
+
+ // AlertDialog instanzieren
+ AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
+ final View customLayout = getLayoutInflater().inflate(R.layout.layout_haus, null);
+ alertDialog.setView(customLayout);
+ alertDialog.setCustomTitle(textView);
+
+ AlertDialog alert = alertDialog.create();
+ alert.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ Button buttonGarage, buttonSchiebetor;
+ buttonGarage = customLayout.findViewById(R.id.buttonAlarmJa);
+ buttonSchiebetor = customLayout.findViewById(R.id.buttonAlarmNein);
+
+ buttonGarage.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ msg = gson.toJson(new Licht(MainActivity.ID, "Garagentor", "Lamp12"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ alert.cancel();
+ }
+ });
+
+ buttonSchiebetor.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ msg = gson.toJson(new Licht(MainActivity.ID, "Schiebetor", "Lamp31"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);Toast.makeText(mContext, "Schiebetor außer Betrieb", Toast.LENGTH_LONG).show();
+ alert.cancel();
+ }
+ });
+ alert.show();
+ }
+
+ public void alertDialogAlarm() {
+ // Titlebar ändern
+ TextView textView = new TextView(getApplicationContext());
+ textView.setText(R.string.alarm_steuerung);
+ textView.setPadding(20, 30, 20, 30);
+ textView.setTextSize(20F);
+ textView.setBackgroundResource(R.drawable.gradient_titlebar);
+ textView.setTextColor(Color.WHITE);
+
+ // AlertDialog instanzieren
+ AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
+ final View customLayout = getLayoutInflater().inflate(R.layout.layout_alarm, null);
+ alertDialog.setView(customLayout);
+ alertDialog.setCustomTitle(textView);
+
+ AlertDialog alert = alertDialog.create();
+ alert.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ Button buttonAlarmJa, buttonAlarmNein;
+ buttonAlarmJa = customLayout.findViewById(R.id.buttonAlarmJa);
+ buttonAlarmNein = customLayout.findViewById(R.id.buttonAlarmNein);
+
+ buttonAlarmJa.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (MqttClient.tv_Zustand1.equals("zu") &&
+ MqttClient.tv_Zustand2.equals("zu") &&
+ MqttClient.tv_Zustand3.equals("zu") &&
+ MqttClient.tv_Zustand4.equals("zu") &&
+ MqttClient.tv_Zustand5.equals("zu") &&
+ MqttClient.tv_Zustand6.equals("zu") &&
+ MqttClient.tv_Zustand7.equals("zu") &&
+ MqttClient.tv_Zustand9.equals("zu") &&
+ MqttClient.tv_Zustand10.equals("zu") &&
+ MqttClient.tv_Zustand11.equals("zu") &&
+ MqttClient.tv_Zustand12.equals("zu") &&
+ MqttClient.tv_Zustand13.equals("zu") &&
+ MqttClient.tv_Zustand14.equals("zu") //&&
+ //MqttClient.tv_Zustand15.equals("zu") &&
+ //MqttClient.tv_Zustand16.equals("zu") &&
+ //MqttClient.tv_Zustand17.equals("zu") &&
+ //MqttClient.tv_Zustand18.equals("zu")
+ ) {
+ MqttClient.publish("cmnd/Haussteuerung/Alarm", "{\"DeviceID\":\"" + ID + "\",\"Name\":\"Alarm\",\"Zustand\":\"false\"}");
+ alert.cancel();
+ } else {
+ Toast.makeText(mContext, "Bitte offene Fenster/Türen schließen!", Toast.LENGTH_SHORT).show();
+ Intent intent = new Intent(MainActivity.this, activityHaus.class);
+ startActivity(intent);
+ }
+ }
+ });
+
+ buttonAlarmNein.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ alert.cancel();
+ }
+ });
+ alert.show();
+ }
+
+ public void alertDialogVersion() {
+ // Titlebar ändern
+ TextView textView = new TextView(getApplicationContext());
+ textView.setText(R.string.version_ad);
+ textView.setPadding(20, 30, 20, 30);
+ textView.setTextSize(20F);
+ textView.setBackgroundResource(R.drawable.gradient_titlebar);
+ textView.setTextColor(Color.WHITE);
+
+ // AlertDialog instanzieren
+ AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
+ final View customLayout = getLayoutInflater().inflate(R.layout.layout_version, null);
+ alertDialog.setView(customLayout);
+ alertDialog.setCustomTitle(textView);
+
+ AlertDialog alert = alertDialog.create();
+ alert.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+
+ alert.show();
+ }
+
+ public void alertDialogNotification(String content) {
+ // Titlebar ändern
+ TextView textView = new TextView(getApplicationContext());
+ String title = "Benachrichtigung";
+ textView.setText(title);
+ textView.setPadding(20, 30, 20, 30);
+ textView.setTextSize(20F);
+ textView.setBackgroundResource(R.drawable.gradient_titlebar);
+ textView.setTextColor(Color.WHITE);
+
+ // AlertDialog instanzieren
+ AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
+ final View customLayout = getLayoutInflater().inflate(R.layout.layout_adnotification, null);
+ alertDialog.setView(customLayout);
+ alertDialog.setCustomTitle(textView);
+
+ AlertDialog alert = alertDialog.create();
+ alert.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+
+ TextView textView_adConent, textView_adTimer;
+ textView_adConent = customLayout.findViewById(R.id.tv_adcontent);
+ textView_adTimer = customLayout.findViewById(R.id.tv_adtimer);
+
+ ProgressBar pg_adProgressBar;
+ pg_adProgressBar = customLayout.findViewById(R.id.progressBar);
+
+ textView_adConent.setText(content);
+
+ new CountDownTimer(10000, 1000) {
+ public void onTick(long millisUntilFinished) {
+ long timeRemain = ((millisUntilFinished / 1000));
+ pg_adProgressBar.setProgress((int) timeRemain);
+ textView_adTimer.setText(String.valueOf(timeRemain));
+ }
+
+ public void onFinish() {
+ alert.cancel();
+ }
+ }.start();
+
+ alert.show();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pausedMainActivity = true;
+ Log.d("MainActivityPause", "onPause true");
+ // Log.d("1MQTT onPause", String.valueOf(MqttClient.connSuccess));
+ myTimer.cancel();
+ Log.d("TimerMainActivity", "Canceled");
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ pausedMainActivity = true;
+ Log.d("MainActivityPause", "onStop true");
+ // Log.d("1MQTT onStop", String.valueOf(MqttClient.connSuccess));
+ // myTimer.cancel();
+ // Log.d("TimerMainActivity", "Canceled");
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ Log.d("MainActivityPause", "onStart true");
+ }
+
+ @Override
+ protected void onRestart() {
+ super.onRestart();
+ Log.d("MainActivityPause", "onRestart true");
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ Log.d("MainActivityPause", "onResume true");
+ Log.d("1MQTT onResume", String.valueOf(MqttClient.client.isConnected()));
+
+ pausedMainActivity = false;
+
+ buttonAlarm.setBackgroundResource(R.drawable.gradient_pressed);
+
+ myTimer = new Timer();
+ myTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ TimerMethod();
+ }
+
+ }, 0, 1000);
+ Log.d("TimerMainActivity", "Started");
+
+ if (!MqttClient.client.isConnected()) {
+ Log.d("1MQTT onResume", "Client connected: " + MqttClient.client.isConnected());
+ try {
+ MqttClient.client.reconnect();
+ Log.d("1MQTT onResume", "Try to reconnect client");
+ } catch (MqttException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ pausedMainActivity = true;
+ // myTimer.cancel();
+ Log.d("MainActivityPause", "onDestroy true");
+ MqttClient.disconnect();
+ // Log.d("1MQTT onDestroy", String.valueOf(MqttClient.connSuccess));
+ finishAffinity();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/MqttClient.java b/app/src/main/java/com/haussteuerung/MqttClient.java
new file mode 100644
index 0000000..22e03a8
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/MqttClient.java
@@ -0,0 +1,506 @@
+package com.haussteuerung;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import android.util.Log;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
+import org.eclipse.paho.android.service.MqttAndroidClient;
+import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
+import org.eclipse.paho.client.mqttv3.MqttCallback;
+import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
+import org.eclipse.paho.client.mqttv3.MqttException;
+import org.eclipse.paho.client.mqttv3.MqttMessage;
+import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import javax.net.ssl.SSLSocketFactory;
+
+public class MqttClient {
+
+ static org.eclipse.paho.client.mqttv3.MqttClient client = null;
+ static boolean connSuccess = false;
+ static String logContent = "";
+ static String tv_Zustand1 = "", tv_Zustand2 = "", tv_Zustand3 = "", tv_Zustand4 = "", tv_Zustand5 = "", tv_Zustand6 = "";
+ static String tv_Zustand7 = "", tv_Zustand8 = "", tv_Zustand9 = "", tv_Zustand10 = "", tv_Zustand11 = "", tv_Zustand12 = "";
+ static String tv_Zustand13 = "", tv_Zustand14 = "", tv_Zustand15 = "", tv_Zustand16 = "", tv_Zustand17 = "", tv_Zustand18 = "";
+
+ public static void connect() {
+ try {
+ client = new org.eclipse.paho.client.mqttv3.MqttClient(
+ "wss://mqtt.klebl.info:443",
+ MainActivity.ID, // ClientId
+ new MemoryPersistence());
+ client.setCallback(new MqttCallback() {
+ @Override
+ public void connectionLost(Throwable cause) {
+ Log.d("MQTT connloss", "client lost connection " + cause);
+ Log.d("MQTT connloss", cause.getMessage());
+ Log.d("MQTT connless", String.valueOf(client.getDebug()));
+ Log.d("MQTT connloss", String.valueOf(MqttClient.client.isConnected()));
+ // MainActivity.tv_mqtt.setTextColor(Color.RED);
+ // if (!MqttClient.client.isConnected()) {
+ // try {
+ // client.reconnect();
+ // client.subscribe("stat/Haussteuerung/#");
+ // client.subscribe("fhem/temp/#");
+ // client.subscribe("fhem/Heizung/#");
+ // } catch (MqttException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ // Log.d("MQTT connloss2", String.valueOf(MqttClient.client.isConnected()));
+ // disconnect();
+ // Log.d("MQTT connloss", "client disconnected after connection lost");
+
+ // connect();
+ }
+
+ @Override
+ public void messageArrived(String topic, MqttMessage message) {
+ Log.d("MQTTLOG", topic + ": " + message.toString());
+ if (topic.equals("stat/Haussteuerung/Alarm")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ if (jsonObject.get("Zustand").getAsString().equals("true")) {
+ // MainActivity.buttonAlarm.setText(R.string.alarm_ein);
+ // MainActivity.buttonAlarm.setBackgroundResource(R.drawable.alarm_true);
+ MainActivity.alarmStatus = true;
+ } else if (jsonObject.get("Zustand").getAsString().equals("false")) {
+ // MainActivity.buttonAlarm.setText(R.string.alarm_aus);
+ // MainActivity.buttonAlarm.setBackgroundResource(R.drawable.alarm_false);
+ MainActivity.alarmStatus = false;
+ }
+ }
+
+ if (topic.equals("stat/Haussteuerung/Waschmaschine/WM1")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ if (jsonObject.get("Zustand").getAsString().equals("ein")) {
+ // MainActivity.tv_WM1.setText(R.string.wm1_laeuft);
+ MainActivity.wm1Status = true;
+ } else if (jsonObject.get("Zustand").getAsString().equals("aus")) {
+ // MainActivity.tv_WM1.setText(R.string.wm1_aus);
+ MainActivity.wm1Status = false;
+ }
+ }
+
+ if (topic.equals("stat/Haussteuerung/Waschmaschine/WM2")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ if (jsonObject.get("Zustand").getAsString().equals("ein")) {
+ // MainActivity.tv_WM2.setText(R.string.wm2_laeuft);
+ MainActivity.wm2Status = true;
+ } else if (jsonObject.get("Zustand").getAsString().equals("aus")) {
+ // MainActivity.tv_WM2.setText(R.string.wm2_aus);
+ MainActivity.wm2Status = false;
+ }
+ }
+
+ if (topic.equals("stat/Haussteuerung/Log/List_Log")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ logContent = jsonObject.get("Zustand").getAsString().replace(";", "\n");
+ }
+
+ if (topic.equals("stat/Haussteuerung/Sky")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ activitySky.zeitSkyMqtt = jsonObject.get("Datum").getAsString();
+ activitySky.isChecked = jsonObject.get("CheckboxSky").getAsBoolean();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Waschmaschine/Tom")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ activityLicht.nameTom = jsonObject.get("Name").getAsString();
+ activityLicht.checkedTom = jsonObject.get("Checkbox").getAsBoolean();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Waschmaschine/Flo")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ activityLicht.nameFlo = jsonObject.get("Name").getAsString();
+ activityLicht.checkedFlo = jsonObject.get("Checkbox").getAsBoolean();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Waschmaschine/Stefan")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ activityLicht.nameStefan = jsonObject.get("Name").getAsString();
+ activityLicht.checkedStefan = jsonObject.get("Checkbox").getAsBoolean();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Glocke")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ activityLicht.nameGlocke = jsonObject.get("Name").getAsString();
+ activityLicht.checkedGlocke = jsonObject.get("Checkbox").getAsBoolean();
+ }
+
+ // WEIHNACHTSBELEUCHTUNG
+ if (topic.equals("tele/sonoff153/STATE")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ activityChristmas.power = jsonObject.get("POWER").getAsString();
+ activityChristmas.hsbColorArray = new ArrayList<>(Arrays.asList(jsonObject.get("HSBColor").getAsString().split(",")));
+ }
+ // WEIHNACHTSBELEUCHTUNG
+
+ handleLWP(topic, message);
+
+ fensterZustaende(topic, message);
+ }
+
+ @Override
+ public void deliveryComplete(IMqttDeliveryToken token) {
+ Log.d("MQTTLOG", "delivery complete " + token);
+ }
+ });
+ } catch (MqttException e) {
+ e.printStackTrace();
+ }
+ MqttConnectOptions mqttConnectOptions = new MqttConnectOptions();
+ mqttConnectOptions.setUserName("steve");
+ mqttConnectOptions.setPassword("Florian1".toCharArray());
+ mqttConnectOptions.setAutomaticReconnect(true);
+ mqttConnectOptions.setCleanSession(false);
+ mqttConnectOptions.setKeepAliveInterval(15);
+ mqttConnectOptions.setConnectionTimeout(30);
+ mqttConnectOptions.setSocketFactory(SSLSocketFactory.getDefault()); // using the default socket factory
+ try {
+ client.connect(mqttConnectOptions);
+ // connSuccess = true;
+ subscribe("stat/Haussteuerung/#");
+ subscribe("fhem/temp/#");
+ subscribe("fhem/Heizung/#");
+ subscribe("tele/sonoff153/#");
+ subscribe("growatt/#");
+ Log.d("MQTTLOG", "client connected");
+ // MainActivity.tv_mqtt.setTextColor(Color.parseColor("#64DD17"));
+ } catch (MqttException e) {
+ e.printStackTrace();
+ // connSuccess = false;
+
+ Log.d("MQTTLOG", "connection failed " + e.getMessage());
+ // MainActivity.tv_mqtt.setTextColor(Color.RED);
+ }
+ }
+
+ public static void subscribe(String topic) {
+ try {
+ // if (!client.isConnected()) {
+ // client.reconnect();
+ // }
+ client.subscribe(topic);
+ } catch (MqttException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void publish(String topic, String message) {
+ try {
+ // if (!client.isConnected()) {
+ // client.reconnect();
+ // }
+ client.publish(topic, message.getBytes(UTF_8),2, false);
+ Log.d("MQTTLOG", "Message" + message + "published.");
+ } catch (MqttException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void publish(String topic, String message, int qos, boolean retained) {
+ try {
+ // if (!client.isConnected()) {
+ // client.reconnect();
+ // }
+ client.publish(topic, message.getBytes(UTF_8), qos, retained);
+ Log.d("MQTTLOG", "Message" + message + "published.");
+ } catch (MqttException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void disconnect() {
+ try {
+ client.disconnect();
+ } catch (MqttException e) {
+ e.printStackTrace();
+ }
+ // MainActivity.tv_mqtt.setTextColor(Color.RED);
+ }
+
+ private static void handleLWP(String topic, MqttMessage message) {
+ if (topic.equals("stat/Haussteuerung/LWP/Warmwasser")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ FragmentWW.isCheckedWW1 = jsonObject.get("CheckWW1").getAsBoolean();
+ FragmentWW.isCheckedWW2 = jsonObject.get("CheckWW2").getAsBoolean();
+ FragmentWW.isCheckedWW3 = jsonObject.get("CheckWW3").getAsBoolean();
+
+ FragmentWW.switchWW1 = jsonObject.get("SilentModeWW1").getAsBoolean();
+ FragmentWW.switchWW2 = jsonObject.get("SilentModeWW2").getAsBoolean();
+ FragmentWW.switchWW3 = jsonObject.get("SilentModeWW3").getAsBoolean();
+
+ FragmentWW.wwZeit1Mqtt = jsonObject.get("ZeitWW1").getAsString();
+ FragmentWW.wwZeit2Mqtt = jsonObject.get("ZeitWW2").getAsString();
+ FragmentWW.wwZeit3Mqtt = jsonObject.get("ZeitWW3").getAsString();
+ FragmentWW.wwZeit4Mqtt = jsonObject.get("ZeitWW4").getAsString();
+ FragmentWW.wwZeit5Mqtt = jsonObject.get("ZeitWW5").getAsString();
+ FragmentWW.wwZeit6Mqtt = jsonObject.get("ZeitWW6").getAsString();
+
+ FragmentWW.tempWw1 = jsonObject.get("TempWW1").getAsInt();
+ FragmentWW.tempWw2 = jsonObject.get("TempWW2").getAsInt();
+ }
+
+ if (topic.equals("stat/Haussteuerung/LWP/Heizung")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ FragmentHeizung.isCheckedHZ1 = jsonObject.get("CheckHZ1").getAsBoolean();
+ FragmentHeizung.isCheckedHZ2 = jsonObject.get("CheckHZ2").getAsBoolean();
+ FragmentHeizung.isCheckedHZ3 = jsonObject.get("CheckHZ3").getAsBoolean();
+
+ FragmentHeizung.hzZeit1Mqtt = jsonObject.get("ZeitHZ1").getAsString();
+ FragmentHeizung.hzZeit2Mqtt = jsonObject.get("ZeitHZ2").getAsString();
+ FragmentHeizung.hzZeit3Mqtt = jsonObject.get("ZeitHZ3").getAsString();
+ FragmentHeizung.hzZeit4Mqtt = jsonObject.get("ZeitHZ4").getAsString();
+ FragmentHeizung.hzZeit5Mqtt = jsonObject.get("ZeitHZ5").getAsString();
+ FragmentHeizung.hzZeit6Mqtt = jsonObject.get("ZeitHZ6").getAsString();
+
+ FragmentHeizung.switchHZ1 = jsonObject.get("SilentModeHZ1").getAsBoolean();
+ FragmentHeizung.switchHZ2 = jsonObject.get("SilentModeHZ2").getAsBoolean();
+ FragmentHeizung.switchHZ3 = jsonObject.get("SilentModeHZ3").getAsBoolean();
+
+ FragmentHeizung.tempHz1 = jsonObject.get("TempHZ1").getAsInt();
+ FragmentHeizung.tempHz2 = jsonObject.get("TempHZ2").getAsInt();
+ FragmentHeizung.tempHz3 = jsonObject.get("TempHZ3").getAsInt();
+ }
+
+
+ if (topic.equals("fhem/temp/Temp_Boiler_oben")) {
+ FragmentWW.tempBoilerOben = message.toString();
+ }
+
+ if (topic.equals("fhem/temp/Temp_Boiler_unten")) {
+ FragmentWW.tempBoilerUnten = message.toString();
+ }
+
+ // Grossraum
+ if (topic.equals("fhem/Heizung/MAX_Grossraum/Mode")) {
+ FragmentHeizkoerper.modeHKGrossraum = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Grossraum/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKGrossraum = message.toString();
+ }
+
+ if (topic.equals("fhem/temp/Temp_Grossraum")) {
+ FragmentHeizkoerper.istTempHKGrossraum = message.toString();
+ }
+
+ // Doris
+ if (topic.equals("fhem/Heizung/MAX_Doris_klein/Mode")) {
+ FragmentHeizkoerper.modeHKDoris = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Doris_klein/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKDoris = message.toString();
+ }
+
+ if (topic.equals("fhem/temp/Temp_Doris")) {
+ FragmentHeizkoerper.istTempHKDoris = message.toString();
+ }
+
+ // Doris Bad
+ if (topic.equals("fhem/Heizung/MAX_Doris_Bad/Mode")) {
+ FragmentHeizkoerper.modeHKDorisBad = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Doris_Bad/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKDorisBad = message.toString();
+ }
+
+ if (topic.equals("fhem/temp/Temp_DorisBad")) {
+ FragmentHeizkoerper.istTempHKDorisBad = message.toString();
+ }
+
+ // Arbeitszimmer
+ if (topic.equals("fhem/Heizung/MAX_Arbeitszimmer/Mode")) {
+ FragmentHeizkoerper.modeHKArbeitszimmer = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Arbeitszimmer/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKArbeitszimmer = message.toString();
+ }
+
+ if (topic.equals("fhem/temp/Temp_Arbeitszimmer")) {
+ FragmentHeizkoerper.istTempHKArbeitszimmer = message.toString();
+ }
+
+ // Vorraum
+ if (topic.equals("fhem/Heizung/MAX_Vorraum/Mode")) {
+ FragmentHeizkoerper.modeHKVorraum = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Vorraum/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKVorraum = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Vorraum/Temperatur")) {
+ FragmentHeizkoerper.istTempHKVorraum = message.toString();
+ }
+
+ // WC EG
+ if (topic.equals("fhem/Heizung/MAX_WC/Mode")) {
+ FragmentHeizkoerper.modeHKWCEG = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_WC/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKWCEG = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_WC/Temperatur")) {
+ FragmentHeizkoerper.istTempHKWCEG = message.toString();
+ }
+
+ // Bad
+ if (topic.equals("fhem/Heizung/MAX_Bad/Mode")) {
+ FragmentHeizkoerper.modeHKBad = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Bad/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKBad = message.toString();
+ }
+
+ if (topic.equals("fhem/temp/Temp_Bad")) {
+ FragmentHeizkoerper.istTempHKBad = message.toString();
+ }
+
+ // Florian
+ if (topic.equals("fhem/Heizung/MAX_Florian/Mode")) {
+ FragmentHeizkoerper.modeHKFlorian = message.toString();
+
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Florian/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKFlorian = message.toString();
+ }
+
+ if (topic.equals("fhem/temp/Temp_Flo")) {
+ FragmentHeizkoerper.istTempHKFlorian = message.toString();
+ }
+
+ // Stefan
+ if (topic.equals("fhem/Heizung/MAX_Stefan/Mode")) {
+ FragmentHeizkoerper.modeHKStefan = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Stefan/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKStefan = message.toString();
+ Log.d("SollTempStefan", message.toString());
+ }
+
+ if (topic.equals("fhem/temp/Temp_Stefan")) {
+ FragmentHeizkoerper.istTempHKStefan = message.toString();
+ Log.d("IstTempStefan", message.toString());
+ }
+
+ // Dachboden
+ if (topic.equals("fhem/Heizung/MAX_Dachboden/Mode")) {
+ FragmentHeizkoerper.modeHKDachboden = message.toString();
+ }
+
+ if (topic.equals("fhem/Heizung/MAX_Dachboden/Solltemperatur")) {
+ FragmentHeizkoerper.sollTempHKDachboden = message.toString();
+ }
+
+ if (topic.equals("fhem/temp/Temp_Dachboden")) {
+ FragmentHeizkoerper.istTempHKDachboden = message.toString();
+ }
+ }
+
+ public static void fensterZustaende(String topic, MqttMessage message) {
+ if (topic.equals("stat/Haussteuerung/Fenster/Eingangstuer")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand1 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Garagetuer")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand2 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Kellertuer")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand3 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/TerrassenTuer_Doris")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand4 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/FensterLinks_Doris")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand5 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/FensterRechts_Doris")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand6 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/FensterBad_Doris")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand7 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Tom")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand8 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Wohnzimmer")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand9 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Esszimmer")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand10 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/EssplatzKueche")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand11 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Kueche")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand12 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Garderobe")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand13 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/WC")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand14 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Dachflaechenfenster")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand15 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Flo")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand16 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Stefan")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand17 = jsonObject.get("Zustand").getAsString();
+ }
+
+ if (topic.equals("stat/Haussteuerung/Fenster/Bad")) {
+ JsonObject jsonObject = JsonParser.parseString(message.toString()).getAsJsonObject();
+ tv_Zustand18 = jsonObject.get("Zustand").getAsString();
+ }
+ }
+}
diff --git a/app/src/main/java/com/haussteuerung/MyFirebaseMessagingService.java b/app/src/main/java/com/haussteuerung/MyFirebaseMessagingService.java
new file mode 100644
index 0000000..fdefea2
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/MyFirebaseMessagingService.java
@@ -0,0 +1,234 @@
+package com.haussteuerung;
+
+import android.annotation.SuppressLint;
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.BitmapFactory;
+import android.media.MediaScannerConnection;
+import android.os.Build;
+import android.os.Environment;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+import android.widget.Toast;
+
+import androidx.core.app.NotificationCompat;
+
+import com.google.firebase.messaging.FirebaseMessagingService;
+import com.google.firebase.messaging.RemoteMessage;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Random;
+
+@SuppressLint("MissingFirebaseInstanceTokenRefresh")
+public class MyFirebaseMessagingService extends FirebaseMessagingService {
+ @Override
+ public void onMessageReceived(RemoteMessage remoteMessage) {
+ super.onMessageReceived(remoteMessage);
+ Log.d("Firebase", remoteMessage.getFrom() + ", " + remoteMessage.getData().get("content"));
+
+ // Wenn eine Activity geöffnet ist oder die FB-Nachricht nicht "Es hat gel" enthält, eine Toastbox zeigen, ansonsten eine Notification senden
+ if (((!MainActivity.pausedMainActivity)
+ || (!activityDoris.pausedDoris)
+ || (!activityDorisLicht.pausedDorisLicht)
+ || (!activityGlocke.pausedGlocke)
+ || (!activityHaus.pausedHaus)
+ || (!activityLicht.pausedLicht)
+ || (!activityLog.pausedLog)
+ || (!activitySky.pausedSky)
+ || (!activityLWP.pausedLWP))
+ && (!Objects.requireNonNull(remoteMessage.getData().get("content")).contains("Es hat gel"))) {
+ Handler handler = new Handler(Looper.getMainLooper());
+ handler.post(() -> Toast.makeText(getApplicationContext(), remoteMessage.getData().get("content"), Toast.LENGTH_LONG).show());
+ } else {
+ if (Objects.requireNonNull(remoteMessage.getData().get("content")).contains("Es hat gel")) {
+ downloadFile(remoteMessage);
+
+ try {
+ Thread.sleep(700);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ sendNotification(remoteMessage);
+ Log.d("Notification", "Glocke");
+ } else {
+ sendNotification(remoteMessage);
+ Log.d("Notification", "Everything else");
+ }
+ }
+ }
+
+
+ public void downloadFile(RemoteMessage remoteMessage) {
+ File fileCam = new File(Environment.getExternalStorageDirectory().getPath() + "/Pictures/Haussteuerung/");
+ if (!fileCam.exists()) {
+ fileCam.mkdir();
+ }
+
+ if (Objects.requireNonNull(remoteMessage.getData().get("content")).contains("Es hat gel")) {
+ Log.d("Foto", remoteMessage.getData().get("content"));
+ String url = "https://www.klebl.info/cam/" + Objects.requireNonNull(remoteMessage.getData().get("content")).substring(28, 43) + ".jpg";
+ Log.d("Foto", url);
+
+ String f1 = Environment.getExternalStorageDirectory().getPath() + "/Pictures/Haussteuerung/" + Objects.requireNonNull(remoteMessage.getData().get("content")).substring(28, 43) + ".jpg";
+ String f2 = Environment.getExternalStorageDirectory().getPath() + "/Pictures/Haussteuerung/cam.jpg";
+ Handler handler = new Handler(Looper.getMainLooper());
+ handler.post(() -> {
+ Thread gfgThread = new Thread(() -> {
+ try {
+ InputStream in = null;
+ try {
+ in = new URL(url).openStream();
+ Log.d("Foto", "Verbindung zum Server erfolgreich. Download wird durchgeführt.");
+ } catch (IOException e) {
+ // Wenn kein Foto gemacht wurde, hat das Foto 0kb, daher 404 error.
+ Log.d("Foto", "Verbindungsfehler. Foto am Server prüfen.");
+ }
+ try {
+ Files.copy(in, Paths.get(f1), StandardCopyOption.REPLACE_EXISTING);
+ Log.d("Foto", "Foto 1 Download");
+ Thread.sleep(200);
+ Files.copy(Paths.get(f1), Paths.get(f2), StandardCopyOption.REPLACE_EXISTING);
+ Log.d("Foto", "Foto 2 Download");
+ Log.d("Foto", "Download und Speichern erfolgreich.");
+ } catch (IOException e) {
+ Log.d("Foto", "Download fehlgeschlagen.");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ });
+ gfgThread.start();
+
+ // MediaScanner starten um das Foto in die Gallery zu bringen
+ MediaScannerConnection.scanFile(getApplicationContext(), new String[]{f1},
+ new String[]{"image/jpg"}, null);
+ MediaScannerConnection.scanFile(getApplicationContext(), new String[]{f2},
+ new String[]{"image/jpg"}, null);
+ });
+ }
+ }
+
+ public void sendNotification(RemoteMessage remoteMessage) {
+ String content;
+ PendingIntent pendingIntent = null;
+
+ Map data = remoteMessage.getData();
+ String title = data.get("title");
+ if (Objects.requireNonNull(remoteMessage.getData().get("content")).contains("Es hat gel")) {
+ content = "Es hat um "
+ + Objects.requireNonNull(remoteMessage.getData().get("content")).substring(37, 39) + ":"
+ + Objects.requireNonNull(remoteMessage.getData().get("content")).substring(39, 41) + ":"
+ + Objects.requireNonNull(remoteMessage.getData().get("content")).substring(41, 43) + " geläutet, Tür öffnen!";
+ } else {
+ content = data.get("content");
+ }
+
+ NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ String NOTIFICATION_CHANNEL_ID;
+
+ // Entscheiden, welche Activity mit welchen Extras gestartet werden soll
+ if (Objects.requireNonNull(remoteMessage.getData().get("content")).contains("Es hat gel")) {
+ NOTIFICATION_CHANNEL_ID = "Glocke";
+
+ Intent intent1 = new Intent(this, MainActivity.class);
+ intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ Log.d("GlockeFirebase", Objects.requireNonNull(remoteMessage.getData().get("content")).substring(28, 43));
+ // intent1.putExtra("Glocke", "Glocke");
+ intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ intent1.putExtra("Glocke", "Glocke");
+ intent1.putExtra("Time", Objects.requireNonNull(remoteMessage.getData().get("content")).substring(28, 43));
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ intent1.setIdentifier(Objects.requireNonNull(remoteMessage.getData().get("content")).substring(28, 43));
+ }
+ pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0 /* Request code */, intent1, PendingIntent.FLAG_IMMUTABLE);
+
+ } else if (Objects.requireNonNull(remoteMessage.getData().get("content")).contains("Sky")) {
+ NOTIFICATION_CHANNEL_ID = "Sky";
+
+ Intent intent2 = new Intent(this, MainActivity.class);
+ intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ intent2.putExtra("Sky", "Sky");
+ pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent2, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
+
+ } else if (Objects.requireNonNull(remoteMessage.getData().get("content")).contains("Update")) {
+ NOTIFICATION_CHANNEL_ID = "Update";
+
+ Intent intent3 = new Intent(this, FileDownload.class);
+ intent3.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent3, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
+
+ } else if (Objects.requireNonNull(remoteMessage.getData().get("content")).contains("Waschmaschine")) {
+ NOTIFICATION_CHANNEL_ID = "Waschmaschine";
+ } else {
+ NOTIFICATION_CHANNEL_ID = "Sonstiges";
+
+ Intent intent4 = new Intent(this, MainActivity.class);
+ intent4.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent4.putExtra("Other", remoteMessage.getData().get("content"));
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ intent4.setIdentifier(remoteMessage.getData().get("content"));
+ }
+ Log.d("OtherFirebase", Objects.requireNonNull(remoteMessage.getData().get("content")));
+ pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0 /* Request code */, intent4, PendingIntent.FLAG_IMMUTABLE);
+ }
+
+ String description = "Haussteuerung - " + NOTIFICATION_CHANNEL_ID;
+
+ NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, description, NotificationManager.IMPORTANCE_HIGH);
+ channel.setDescription(description);
+ channel.setShowBadge(true);
+ channel.canShowBadge();
+ channel.enableLights(true);
+ channel.setLightColor(getResources().getColor(R.color.gradient_blue));
+ channel.enableVibration(true);
+ channel.setVibrationPattern(new long[]{100, 200, 300, 400, 500});
+
+ notificationManager.createNotificationChannel(channel);
+
+ Random notification_id = new Random();
+
+ NotificationCompat.Builder notificationBuilder = null;
+ if (Objects.requireNonNull(remoteMessage.getData().get("content")).contains("Es hat gel")) {
+ notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
+ .setDefaults(Notification.DEFAULT_ALL)
+ .setContentIntent(pendingIntent)
+ .setContentTitle(title)
+ .setContentText(content)
+ .setAutoCancel(true)
+ .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.haus_icon))
+ .setLights(getResources().getColor(R.color.gradient_blue), 1000, 300)
+ .setStyle(new NotificationCompat.BigPictureStyle()
+ .bigPicture(BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getPath() + "/Pictures/Haussteuerung/" + Objects.requireNonNull(remoteMessage.getData().get("content")).substring(28, 43) + ".jpg")))
+ .setSmallIcon(R.drawable.haus_icon);
+ } else {
+ notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
+ .setDefaults(Notification.DEFAULT_ALL)
+ .setContentIntent(pendingIntent)
+ .setContentTitle(title)
+ .setContentText(content)
+ .setAutoCancel(true)
+ .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.haus_icon))
+ .setLights(getResources().getColor(R.color.gradient_blue), 1000, 300)
+ .setSmallIcon(R.drawable.haus_icon);
+ }
+
+ Log.d("num", String.valueOf(notification_id.nextInt(1000)));
+
+ assert notificationManager != null;
+ notificationManager.notify(notification_id.nextInt(1000), notificationBuilder.build());
+ }
+}
diff --git a/app/src/main/java/com/haussteuerung/activityChristmas.java b/app/src/main/java/com/haussteuerung/activityChristmas.java
new file mode 100644
index 0000000..6fa5ad2
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/activityChristmas.java
@@ -0,0 +1,283 @@
+package com.haussteuerung;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.NumberPicker;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import java.util.ArrayList;
+
+public class activityChristmas extends AppCompatActivity {
+
+ static String power = "OFF";
+ private String hsbColorMqtt = "";
+ static ArrayList hsbColorArray;
+ private Button buttonPower;
+ private Button buttonColor1, buttonColor2,
+ buttonColor3, buttonColor4,
+ buttonColor5,buttonColor6,
+ buttonColor7, buttonColor8;
+ private NumberPicker picker;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Ändern der Statusbar-Farbe
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.drawable.gradient_titlebar));
+
+ setContentView(R.layout.activity_christmas);
+ setTitle("Haussteuerung - Christmas");
+
+ Log.d("HSBColor0", hsbColorArray.get(0));
+ Log.d("HSBColor1", hsbColorArray.get(1));
+ Log.d("HSBColor2", hsbColorArray.get(2));
+
+ buttonPower = findViewById(R.id.buttonPower);
+ buttonColor1 = findViewById(R.id.buttonColor1);
+ buttonColor2 = findViewById(R.id.buttonColor2);
+ buttonColor3 = findViewById(R.id.buttonColor3);
+ buttonColor4 = findViewById(R.id.buttonColor4);
+ buttonColor5 = findViewById(R.id.buttonColor5);
+ buttonColor6 = findViewById(R.id.buttonColor6);
+ buttonColor7 = findViewById(R.id.buttonColor7);
+ buttonColor8 = findViewById(R.id.buttonColor8);
+ picker = findViewById(R.id.picker);
+
+ handleButton();
+ handleNumberPicker();
+ }
+
+ private void handleButton() {
+ if (power.equals("ON")) {
+ buttonPower.setText(R.string.on);
+ } else if (power.equals("OFF")) {
+ buttonPower.setText(R.string.off);
+ }
+
+ buttonColor1.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ setHSBColor("10");
+ Log.d("HSBColorRed", hsbColorMqtt);
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ });
+
+ buttonColor2.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ setHSBColor("50");
+ Log.d("HSBColorYellow", hsbColorMqtt);
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ });
+
+ buttonColor3.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ setHSBColor("100");
+ Log.d("HSBColorGreen", hsbColorMqtt);
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ });
+
+ buttonColor4.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ setHSBColor("150");
+ Log.d("HSBColorLightBlue", hsbColorMqtt);
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ });
+
+ buttonColor5.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ setHSBColor("200");
+ Log.d("HSBColorBlue", hsbColorMqtt);
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ });
+
+ buttonColor6.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ setHSBColor("250");
+ Log.d("HSBColorPurple", hsbColorMqtt);
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ });
+
+ buttonColor7.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ setHSBColor("300");
+ Log.d("HSBColorWhite", hsbColorMqtt);
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ });
+
+ buttonColor8.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ setHSBColor("350");
+ Log.d("HSBColorChanging", hsbColorMqtt);
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ });
+
+ buttonPower.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ String hsbColorMqtt = hsbColorArray.get(0) + "," + hsbColorArray.get(1) + "," + hsbColorArray.get(2);
+ if (buttonPower.getText().equals("ON")) {
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"OFF\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/POWER", "0");
+ buttonPower.setText(R.string.off);
+ } else if (buttonPower.getText().equals("OFF")) {
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"ON\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/POWER", "1");
+ buttonPower.setText(R.string.on);
+ }
+ }
+ });
+ }
+
+ private void handleNumberPicker() {
+ String[] values = {"Bright (Steady On)","Gradually (Slow Fade)","Star (Sequential)","Flower (In Waves)",
+ "Marquee (Chasing / Flash)","Fireworks (Twinkle / Flash)","Meteor","Stream"};
+ picker.setWrapSelectorWheel(false);
+ picker.setMinValue(0);
+ picker.setMaxValue(values.length - 1);
+
+ if (Integer.parseInt(hsbColorArray.get(2)) >= 0 && Integer.parseInt(hsbColorArray.get(2)) <= 12) {
+ picker.setValue(0);
+ }
+ if (Integer.parseInt(hsbColorArray.get(2)) >= 13 && Integer.parseInt(hsbColorArray.get(2)) <= 24) {
+ picker.setValue(1);
+ }
+ if (Integer.parseInt(hsbColorArray.get(2)) >= 25 && Integer.parseInt(hsbColorArray.get(2)) <= 37) {
+ picker.setValue(2);
+ }
+ if (Integer.parseInt(hsbColorArray.get(2)) >= 38 && Integer.parseInt(hsbColorArray.get(2)) <= 49) {
+ picker.setValue(3);
+ }
+ if (Integer.parseInt(hsbColorArray.get(2)) >= 50 && Integer.parseInt(hsbColorArray.get(2)) <= 62) {
+ picker.setValue(4);
+ }
+ if (Integer.parseInt(hsbColorArray.get(2)) >= 63 && Integer.parseInt(hsbColorArray.get(2)) <= 74) {
+ picker.setValue(5);
+ }
+ if (Integer.parseInt(hsbColorArray.get(2)) >= 75 && Integer.parseInt(hsbColorArray.get(2)) <= 87) {
+ picker.setValue(6);
+ }
+ if (Integer.parseInt(hsbColorArray.get(2)) >= 88 && Integer.parseInt(hsbColorArray.get(2)) <= 100) {
+ picker.setValue(7);
+ }
+
+ picker.setDisplayedValues(values);
+
+ picker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
+ @Override
+ public void onValueChange(NumberPicker numberPicker, int i, int i1) {
+ if (numberPicker.getValue() == 0) {
+ String hsbColorMqtt = hsbColorArray.get(0) + ",100,10";
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ if (numberPicker.getValue() == 1) {
+ String hsbColorMqtt = hsbColorArray.get(0) + ",100,20";
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ if (numberPicker.getValue() == 2) {
+ String hsbColorMqtt = hsbColorArray.get(0) + ",100,30";
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ if (numberPicker.getValue() == 3) {
+ String hsbColorMqtt = hsbColorArray.get(0) + ",100,40";
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ if (numberPicker.getValue() == 4) {
+ String hsbColorMqtt = hsbColorArray.get(0) + ",100,50";
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ if (numberPicker.getValue() == 5) {
+ String hsbColorMqtt = hsbColorArray.get(0) + ",100,70";
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ if (numberPicker.getValue() == 6) {
+ String hsbColorMqtt = hsbColorArray.get(0) + ",100,80";
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ if (numberPicker.getValue() == 7) {
+ String hsbColorMqtt = hsbColorArray.get(0) + ",100,90";
+ MqttClient.publish("tele/sonoff153/STATE", "{\"POWER\":\"" + buttonPower.getText() +"\",\"HSBColor\":\""+ hsbColorMqtt + "\"}", 2, true);
+ MqttClient.publish("cmnd/sonoff153/HSBColor", hsbColorMqtt);
+ }
+ Log.d("NumberPicker", String.valueOf(numberPicker.getValue()));
+ }
+ });
+ }
+
+ private void setHSBColor(String color) {
+ if (picker.getValue() == 0) {
+ hsbColorMqtt = color + ",100,10";
+ }
+ if (picker.getValue() == 1) {
+ hsbColorMqtt = color + ",100,20";
+ }
+ if (picker.getValue() == 2) {
+ hsbColorMqtt = color + ",100,30";
+ }
+ if (picker.getValue() == 3) {
+ hsbColorMqtt = color + ",100,40";
+ }
+ if (picker.getValue() == 4) {
+ hsbColorMqtt = color + ",100,50";
+ }
+ if (picker.getValue() == 5) {
+ hsbColorMqtt = color + ",100,70";
+ }
+ if (picker.getValue() == 6) {
+ hsbColorMqtt = color + ",100,80";
+ }
+ if (picker.getValue() == 7) {
+ hsbColorMqtt = color + ",100,90";
+ }
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/activityDoris.java b/app/src/main/java/com/haussteuerung/activityDoris.java
new file mode 100644
index 0000000..fe49e7b
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/activityDoris.java
@@ -0,0 +1,204 @@
+package com.haussteuerung;
+
+import android.app.TimePickerDialog;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.TextView;
+import android.widget.TimePicker;
+import android.widget.Toast;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import com.google.gson.Gson;
+import com.google.gson.annotations.SerializedName;
+
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
+
+public class activityDoris extends AppCompatActivity {
+ Button buttonSend, zeitBlutdruck, zeitFiebertemp;
+ int hourBlutdruck = 0, minuteBlutdruck = 0, hourFiebertemp = 0, minuteFiebertemp = 0;
+ static String werteBlutdruck = "";
+ static String wertFiebertemp = "";
+ TextView textSYS, textDIA, textFiebertemp;
+ LocalDateTime datetime = LocalDateTime.now();
+ DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ String formattedDate = datetime.format(dateTimeFormat);
+ public static boolean pausedDoris = true;
+ Gson gson = new Gson();
+ String msg;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.color.black));
+
+ pausedDoris = false;
+
+ setContentView(R.layout.activity_doris);
+ setTitle("Haussteuerung - Doris");
+
+ buttonSend = findViewById(R.id.buttonSend);
+
+ // Blutdruck ---------------------------------------
+ zeitBlutdruck = findViewById(R.id.zeitBlutdruck);
+ CheckBox checkBlutdruck = findViewById(R.id.checkBlutdruck);
+ textSYS = findViewById(R.id.textSYS);
+ textDIA = findViewById(R.id.textDIA);
+ TextView tv_SYS = findViewById(R.id.tvSYS);
+ TextView tv_DIA = findViewById(R.id.tvDIA);
+ hourBlutdruck = datetime.getHour();
+ minuteBlutdruck = datetime.getMinute();
+ zeitBlutdruck.setText(String.format(Locale.getDefault(), "%02d:%02d", datetime.getHour(), datetime.getMinute()));
+
+ zeitBlutdruck.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timePickerDialog(zeitBlutdruck);
+ }
+ });
+
+ checkBlutdruck.setOnClickListener(view -> {
+ if (checkBlutdruck.isChecked()) {
+ zeitBlutdruck.setEnabled(true);
+ tv_SYS.setEnabled(true);
+ tv_DIA.setEnabled(true);
+ textSYS.setEnabled(true);
+ textDIA.setEnabled(true);
+ } else {
+ zeitBlutdruck.setEnabled(false);
+ tv_SYS.setEnabled(false);
+ tv_DIA.setEnabled(false);
+ textSYS.setEnabled(false);
+ textDIA.setEnabled(false);
+ }
+ });
+
+
+ // Fiebertemperatur --------------------------------
+ zeitFiebertemp = findViewById(R.id.zeitFiebertemp);
+ CheckBox checkFiebertemp = findViewById(R.id.checkFiebertemp);
+ TextView tvFiebertemp = findViewById(R.id.tvFiebertemp);
+ textFiebertemp = findViewById(R.id.textFiebertemp);
+ hourFiebertemp = datetime.getHour();
+ minuteFiebertemp = datetime.getMinute();
+ zeitFiebertemp.setText(String.format(Locale.getDefault(), "%02d:%02d", datetime.getHour(), datetime.getMinute()));
+
+ zeitFiebertemp.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timePickerDialog(zeitFiebertemp);
+ }
+ });
+
+ checkFiebertemp.setOnClickListener(view -> {
+ if (checkFiebertemp.isChecked()) {
+ zeitFiebertemp.setEnabled(true);
+ tvFiebertemp.setEnabled(true);
+ textFiebertemp.setEnabled(true);
+ } else {
+ zeitFiebertemp.setEnabled(false);
+ tvFiebertemp.setEnabled(false);
+ textFiebertemp.setEnabled(false);
+ }
+ });
+
+ // Send-Button -------------------------------------
+
+ buttonSend.setOnClickListener(view -> {
+ boolean setBlutdruck = false;
+ if (checkBlutdruck.isChecked() && (textSYS.getText().length() == 0 || textDIA.getText().length() == 0)) {
+ Toast.makeText(activityDoris.this, "Bitte alle Blutdruck-Werte ausfüllen!", Toast.LENGTH_LONG).show();
+ } else if (checkBlutdruck.isChecked() && (textSYS.getText().length() > 0 || textDIA.getText().length() > 0)) {
+ String hour = Integer.toString(hourBlutdruck);
+ String minute = Integer.toString(minuteBlutdruck);
+ String sys = textSYS.getText().toString();
+ String dia = textDIA.getText().toString();
+ werteBlutdruck = "{\"DeviceID\":\"" + MainActivity.ID + "\", \"Datum\":" + "\"" + formattedDate + " " + hour + ":" + minute + ":00" + "\"," + "\"SYS\":" + "\"" + sys + "\"," + "\"DIA\":" + "\"" + dia + "\"}";
+ Log.d("Doris", werteBlutdruck);
+ MqttClient.publish("cmnd/Haussteuerung/Doris/Blutdruck", werteBlutdruck);
+ setBlutdruck = true;
+ }
+
+ boolean setFiebertemp = false;
+ if (checkFiebertemp.isChecked() && (textFiebertemp.getText().length() == 0)) {
+ Toast.makeText(activityDoris.this, "Bitte einen Temperaturwert eingeben!", Toast.LENGTH_LONG).show();
+ } else if (checkFiebertemp.isChecked() && (textFiebertemp.getText().length() > 0)) {
+ String formattedDate = datetime.format(dateTimeFormat);
+ String hour = Integer.toString(hourFiebertemp);
+ String minute = Integer.toString(minuteFiebertemp);
+ String fiebertemp = textFiebertemp.getText().toString();
+ msg = gson.toJson(new Temperatur(MainActivity.ID, formattedDate + " " + hour + ":" + minute + ":00", fiebertemp));
+ MqttClient.publish("cmnd/Haussteuerung/Doris/Temperatur", msg);
+ // wertFiebertemp = "{\"DeviceID\":\"" + MainActivity.ID + "\", \"Datum\":" + "\"" + formattedDate + " " + hour + ":" + minute + ":00" + "\"," + "\"Temperatur\": " + "\"" + fiebertemp + "\"}";
+ Log.d("Doris", msg);
+ // MqttClient.publish("cmnd/Haussteuerung/Doris/Temperatur", wertFiebertemp);
+ setFiebertemp = true;
+ }
+ if (setBlutdruck || setFiebertemp) {
+ finish();
+ }
+ });
+ }
+
+ public void timePickerDialog(Button button) {
+ LocalTime localTime = LocalTime.parse(button.getText());
+ int hour = localTime.getHour();
+ int minute = localTime.getMinute();
+ TimePickerDialog.OnTimeSetListener onTimeSetListener = new TimePickerDialog.OnTimeSetListener() {
+ @Override
+ public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) {
+ button.setText(String.format(Locale.getDefault(), "%02d:%02d", selectedHour, selectedMinute));
+ }
+ };
+ TimePickerDialog timePickerDialog = new TimePickerDialog(this, onTimeSetListener, hour, minute, true);
+ timePickerDialog.show();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pausedDoris = true;
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ pausedDoris = false;
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ pausedDoris = true;
+ }
+}
+
+class Temperatur {
+ @SerializedName("DeviceID")
+ private final String deviceId;
+ @SerializedName("Datum")
+ private final String datum;
+ @SerializedName("Temperatur")
+ private final String temperatur;
+
+
+ public Temperatur(String deviceId, String datum, String temperatur) {
+ this.deviceId = deviceId;
+ this.datum = datum;
+ this.temperatur = temperatur;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/activityDorisLicht.java b/app/src/main/java/com/haussteuerung/activityDorisLicht.java
new file mode 100644
index 0000000..6bd3987
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/activityDorisLicht.java
@@ -0,0 +1,253 @@
+package com.haussteuerung;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import com.google.gson.Gson;
+import com.google.gson.annotations.SerializedName;
+
+public class activityDorisLicht extends AppCompatActivity implements View.OnClickListener {
+
+ // Position 0 = unten
+ // Position 100 = oben
+ public static boolean pausedDorisLicht = true;
+ Gson gson = new Gson();
+ String msg;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.color.black));
+
+ pausedDorisLicht = false;
+
+ setContentView(R.layout.activity_doris_licht);
+ setTitle("Haussteuerung - Doris Licht");
+
+ Button buttonDeckenlampe = findViewById(R.id.buttonDeckenlampe);
+ Button buttonDorisStehlampe = findViewById(R.id.buttonStehlampe);
+ Button buttonBadDeckenlampe = findViewById(R.id.buttonDeckenlampeBad);
+ Button buttonBadWandlampe = findViewById(R.id.buttonWandlampeBad);
+
+ Button buttonRollo1 = findViewById(R.id.buttonRollo1);
+ Button buttonRollo2 = findViewById(R.id.buttonRollo2);
+ Button buttonRollo3 = findViewById(R.id.buttonRollo3);
+ Button buttonRollo4 = findViewById(R.id.buttonRollo4);
+ Button buttonRollo5 = findViewById(R.id.buttonRollo5);
+ Button buttonRollo6 = findViewById(R.id.buttonRollo6);
+ Button buttonRollo7 = findViewById(R.id.buttonRollo7);
+ Button buttonRollo8 = findViewById(R.id.buttonRollo8);
+ Button buttonRollo9 = findViewById(R.id.buttonRollo9);
+ Button buttonRollo10 = findViewById(R.id.buttonRollo10);
+ Button buttonRollo11 = findViewById(R.id.buttonRollo11);
+ Button buttonRollo12 = findViewById(R.id.buttonRollo12);
+ Button buttonRollo13 = findViewById(R.id.buttonRollo13);
+ Button buttonRollo14 = findViewById(R.id.buttonRollo14);
+ Button buttonRollo15 = findViewById(R.id.buttonRollo15);
+
+ buttonDeckenlampe.setOnClickListener(this);
+ buttonDorisStehlampe.setOnClickListener(this);
+ buttonBadDeckenlampe.setOnClickListener(this);
+ buttonBadWandlampe.setOnClickListener(this);
+ buttonRollo1.setOnClickListener(this);
+ buttonRollo2.setOnClickListener(this);
+ buttonRollo3.setOnClickListener(this);
+ buttonRollo4.setOnClickListener(this);
+ buttonRollo5.setOnClickListener(this);
+ buttonRollo6.setOnClickListener(this);
+ buttonRollo7.setOnClickListener(this);
+ buttonRollo8.setOnClickListener(this);
+ buttonRollo9.setOnClickListener(this);
+ buttonRollo10.setOnClickListener(this);
+ buttonRollo11.setOnClickListener(this);
+ buttonRollo12.setOnClickListener(this);
+ buttonRollo13.setOnClickListener(this);
+ buttonRollo14.setOnClickListener(this);
+ buttonRollo15.setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.buttonDeckenlampe:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Doris Deckenlampe", "Lamp21"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ // String msg1 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Doris Deckenlampe" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"power" + "\",\"Message\":\"2\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Licht", msg1);
+ break;
+
+ case R.id.buttonStehlampe:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Doris Stehlampe", "Lamp22"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ // String msg2 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Doris Stehlampe" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"power" + "\",\"Message\":\"2\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Licht", msg2);
+ break;
+
+ case R.id.buttonDeckenlampeBad:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Doris Bad Deckenlampe", "Lamp23"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ // String msg3 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Doris Bad Deckenlampe" + "\",\"Device\":\"" + "sonoff177" + "\",\"Power\":\"power1" + "\",\"Message\":\"2\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Licht", msg3);
+ break;
+
+ case R.id.buttonWandlampeBad:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Doris Bad Wandlampe", "Lamp24"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ // String msg4 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Doris Bad Wandlampe" + "\",\"Device\":\"" + "sonoff177" + "\",\"Power\":\"power2" + "\",\"Message\":\"2\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Licht", msg4);
+ break;
+
+ case R.id.buttonRollo1:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Alle Rollo", "Rollo1", 100));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg5 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Alle Rollo" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"100\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg5);
+ break;
+
+ case R.id.buttonRollo2:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Alle Rollo", "Rollo1", 50));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg6 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Alle Rollo" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"50\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg6);
+ break;
+
+ case R.id.buttonRollo3:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Alle Rollo", "Rollo1", 0));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg7 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Alle Rollo" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"0\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg7);
+ break;
+
+ case R.id.buttonRollo4:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Terrasse Rollo", "sonoff171", 100));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg8 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Terrasse Rollo" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"100\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg8);
+ break;
+
+ case R.id.buttonRollo5:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Terrasse Rollo", "sonoff171", 50));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg9 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Terrasse Rollo" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"50\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg9);
+ break;
+
+ case R.id.buttonRollo6:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Terrasse Rollo", "sonoff171", 0));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg10 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Terrasse Rollo" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"0\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg10);
+ break;
+
+ case R.id.buttonRollo7:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Rollo Fenster links", "sonoff172", 100));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg11 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Rollo Fenster links" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"100\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg11);
+ break;
+
+ case R.id.buttonRollo8:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Rollo Fenster links", "sonoff172", 50));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg12 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Rollo Fenster links" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"50\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg12);
+ break;
+
+ case R.id.buttonRollo9:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Rollo Fenster links", "sonoff172", 0));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg13 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Rollo Fenster links" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"0\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg13);
+ break;
+
+ case R.id.buttonRollo10:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Rollo Fenster rechts", "sonoff173", 100));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg14 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Rollo Fenster rechts" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"100\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg14);
+ break;
+
+ case R.id.buttonRollo11:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Rollo Fenster rechts", "sonoff173", 50));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg15 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Rollo Fenster rechts" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"50\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg15);
+ break;
+
+ case R.id.buttonRollo12:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Rollo Fenster rechts", "sonoff173", 0));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg16 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Rollo Fenster rechts" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"0\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg16);
+ break;
+
+ case R.id.buttonRollo13:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Bad Rollo", "sonoff174", 100));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg17 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Bad Rollo" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"100\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg17);
+ break;
+
+ case R.id.buttonRollo14:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Bad Rollo", "sonoff174", 50));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg18 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Bad Rollo" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"50\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg18);
+ break;
+
+ case R.id.buttonRollo15:
+ msg = gson.toJson(new Rollo(MainActivity.ID, "Bad Rollo", "sonoff174", 0));
+ MqttClient.publish("cmnd/Haussteuerung/Rollo", msg);
+ // String msg19 = "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Bad Rollo" + "\",\"Device\":\"" + v.getTag().toString() + "\",\"Power\":\"SHUTTERPOSITION" + "\",\"Message\":\"0\"}";
+ // MqttClient.publish("cmnd/Haussteuerung/Rollo", msg19);
+ break;
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pausedDorisLicht = true;
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ pausedDorisLicht = false;
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ pausedDorisLicht = true;
+ }
+}
+
+class Rollo {
+ @SerializedName("DeviceID")
+ private final String deviceId;
+ @SerializedName("Name")
+ private final String name;
+ @SerializedName("Device")
+ private final String device;
+ @SerializedName("Shutterposition")
+ private final int shutterposition;
+
+ public Rollo(String deviceId, String name, String device, int shutterposition) {
+ this.deviceId = deviceId;
+ this.name = name;
+ this.device = device;
+ this.shutterposition = shutterposition;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/activityGlocke.java b/app/src/main/java/com/haussteuerung/activityGlocke.java
new file mode 100644
index 0000000..8fbca65
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/activityGlocke.java
@@ -0,0 +1,101 @@
+package com.haussteuerung;
+
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.util.Log;
+import android.widget.Button;
+import android.widget.Toast;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import com.google.gson.Gson;
+import com.ortiz.touchview.TouchImageView;
+
+import java.io.File;
+
+public class activityGlocke extends AppCompatActivity {
+
+ public static boolean pausedGlocke = true;
+ Gson gson = new Gson();
+ String msg;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.color.black));
+
+ pausedGlocke = false;
+
+ setContentView(R.layout.activity_glocke);
+ setTitle("Haussteuerung - Glocke");
+
+ TouchImageView fotoGlocke = findViewById(R.id.fotoGlocke);
+
+ Intent i = getIntent();
+ File file = new File(Environment.getExternalStorageDirectory().getPath() + "/Pictures/Haussteuerung/cam.jpg");
+ if (i.getExtras() != null) {
+ if (i.getExtras() != null && i.hasExtra("TimeFB")) {
+ file = new File(Environment.getExternalStorageDirectory().getPath() + "/Pictures/Haussteuerung/" + i.getStringExtra("TimeFB") + ".jpg");
+ Log.d("ZeitGlocke", i.getStringExtra("TimeFB"));
+ } else {
+ file = new File(Environment.getExternalStorageDirectory().getPath() + "/Pictures/Haussteuerung/cam.jpg");
+ }
+ }
+
+ if(file.exists()){
+ Bitmap myBitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
+ Log.d("ImageView", file.getAbsolutePath());
+ fotoGlocke.setImageBitmap(myBitmap);
+ Log.d("Foto", "ImageView erfolgreich");
+ } else {
+ Log.d("Foto", "ImageView fehlgeschlagen");
+ Toast.makeText(this, "Laden des Fotos fehlgeschlagen", Toast.LENGTH_LONG).show();
+ }
+
+ Button buttonGlockeDoors = findViewById(R.id.buttonGlockeDoors);
+ buttonGlockeDoors.setOnClickListener(view -> {
+ msg = gson.toJson(new Licht(MainActivity.ID, "Gartentor", "Lamp10"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ msg = gson.toJson(new Licht(MainActivity.ID, "Eingangstuer", "Lamp11"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ });
+
+ Button buttonKamera = findViewById(R.id.buttonKamera);
+ buttonKamera.setOnClickListener(view -> {
+ String url = "https://webcam.klebl.info/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=wuuPhkmUCeI9WG7C&user=admin&password=Florian1";
+ Intent intentOne = new Intent(Intent.ACTION_VIEW);
+ intentOne.setData(Uri.parse(url));
+ startActivity(intentOne);
+ });
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pausedGlocke = true;
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ pausedGlocke = false;
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ pausedGlocke = true;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/activityHaus.java b/app/src/main/java/com/haussteuerung/activityHaus.java
new file mode 100644
index 0000000..15b4f44
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/activityHaus.java
@@ -0,0 +1,240 @@
+package com.haussteuerung;
+
+import android.graphics.Color;
+import android.os.Bundle;
+import android.os.Handler;
+import android.widget.TextView;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+public class activityHaus extends AppCompatActivity {
+
+ public static boolean pausedHaus = true;
+ private TextView tv_Zustand1;
+ private TextView tv_Zustand2;
+ private TextView tv_Zustand3;
+ private TextView tv_Zustand4;
+ private TextView tv_Zustand5;
+ private TextView tv_Zustand6;
+ private TextView tv_Zustand7;
+ // private TextView tv_Zustand8;
+ private TextView tv_Zustand9;
+ private TextView tv_Zustand10;
+ private TextView tv_Zustand11;
+ private TextView tv_Zustand12;
+ private TextView tv_Zustand13;
+ private TextView tv_Zustand14;
+ private TextView tv_Zustand15;
+ private TextView tv_Zustand16;
+ private TextView tv_Zustand17;
+ private TextView tv_Zustand18;
+
+ final Handler myHandler = new Handler();
+ final Timer myTimer = new Timer();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.color.black));
+
+ pausedHaus = false;
+
+ setContentView(R.layout.activity_haus);
+ setTitle("Haussteuerung - Hausansicht");
+
+ tv_Zustand1 = findViewById(R.id.tv_Zustand1);
+ tv_Zustand2 = findViewById(R.id.tv_Zustand2);
+ tv_Zustand3 = findViewById(R.id.tv_Zustand3);
+ tv_Zustand4 = findViewById(R.id.tv_Zustand4);
+ tv_Zustand5 = findViewById(R.id.tv_Zustand5);
+ tv_Zustand6 = findViewById(R.id.tv_Zustand6);
+ tv_Zustand7 = findViewById(R.id.tv_Zustand7);
+ tv_Zustand9 = findViewById(R.id.tv_Zustand9);
+ tv_Zustand10 = findViewById(R.id.tv_Zustand10);
+ tv_Zustand11 = findViewById(R.id.tv_Zustand11);
+ tv_Zustand12 = findViewById(R.id.tv_Zustand12);
+ tv_Zustand13 = findViewById(R.id.tv_Zustand13);
+ tv_Zustand14 = findViewById(R.id.tv_Zustand14);
+ tv_Zustand15 = findViewById(R.id.tv_Zustand15);
+ tv_Zustand16 = findViewById(R.id.tv_Zustand16);
+ tv_Zustand17 = findViewById(R.id.tv_Zustand17);
+ tv_Zustand18 = findViewById(R.id.tv_Zustand18);
+ }
+
+ // Runnable method
+ final Runnable myRunnable = new Runnable() {
+ public void run() {
+ if (MqttClient.tv_Zustand1.equals("zu")) {
+ tv_Zustand1.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand1.setTextColor(Color.RED);
+ } else {
+ tv_Zustand1.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand1.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand2.equals("zu")) {
+ tv_Zustand2.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand2.setTextColor(Color.RED);
+ } else {
+ tv_Zustand2.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand2.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand3.equals("zu")) {
+ tv_Zustand3.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand3.setTextColor(Color.RED);
+ } else {
+ tv_Zustand3.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand3.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand4.equals("zu")) {
+ tv_Zustand4.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand4.setTextColor(Color.RED);
+ } else {
+ tv_Zustand4.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand4.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand5.equals("zu")) {
+ tv_Zustand5.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand5.setTextColor(Color.RED);
+ } else {
+ tv_Zustand5.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand5.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand6.equals("zu")) {
+ tv_Zustand6.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand6.setTextColor(Color.RED);
+ } else {
+ tv_Zustand6.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand6.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand7.equals("zu")) {
+ tv_Zustand7.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand7.setTextColor(Color.RED);
+ } else {
+ tv_Zustand7.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand7.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand9.equals("zu")) {
+ tv_Zustand9.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand9.setTextColor(Color.RED);
+ } else {
+ tv_Zustand9.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand9.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand10.equals("zu")) {
+ tv_Zustand10.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand10.setTextColor(Color.RED);
+ } else {
+ tv_Zustand10.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand10.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand11.equals("zu")) {
+ tv_Zustand11.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand11.setTextColor(Color.RED);
+ } else {
+ tv_Zustand11.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand11.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand12.equals("zu")) {
+ tv_Zustand12.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand12.setTextColor(Color.RED);
+ } else {
+ tv_Zustand12.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand12.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand13.equals("zu")) {
+ tv_Zustand13.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand13.setTextColor(Color.RED);
+ } else {
+ tv_Zustand13.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand13.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand14.equals("zu")) {
+ tv_Zustand14.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand14.setTextColor(Color.RED);
+ } else {
+ tv_Zustand14.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand14.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand15.equals("zu")) {
+ tv_Zustand15.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand15.setTextColor(Color.RED);
+ } else {
+ tv_Zustand15.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand15.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand16.equals("zu")) {
+ tv_Zustand16.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand16.setTextColor(Color.RED);
+ } else {
+ tv_Zustand16.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand16.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand17.equals("zu")) {
+ tv_Zustand17.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand17.setTextColor(Color.RED);
+ } else {
+ tv_Zustand17.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand17.setTextColor(Color.GREEN);
+ }
+
+ if (MqttClient.tv_Zustand18.equals("zu")) {
+ tv_Zustand18.setText(getResources().getString(R.string.geschlossen));
+ tv_Zustand18.setTextColor(Color.RED);
+ } else {
+ tv_Zustand18.setText(getResources().getString(R.string.geoeffnet));
+ tv_Zustand18.setTextColor(Color.GREEN);
+ } }
+ };
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pausedHaus = true;
+ myTimer.cancel();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ pausedHaus = false;
+ TimerTask myTask = new TimerTask() {
+ public void run() {
+ myHandler.post(myRunnable); // updateUI method
+ }
+ };
+ myTimer.schedule(myTask,0,1000); // TimerTask, delay, period
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ pausedHaus = true;
+ myTimer.cancel();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/activityLWP.java b/app/src/main/java/com/haussteuerung/activityLWP.java
new file mode 100644
index 0000000..012e6c4
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/activityLWP.java
@@ -0,0 +1,86 @@
+package com.haussteuerung;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.MenuItem;
+
+import androidx.activity.EdgeToEdge;
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import com.google.android.material.bottomnavigation.BottomNavigationView;
+import com.google.android.material.navigation.NavigationBarView;
+
+public class activityLWP extends AppCompatActivity implements NavigationBarView.OnItemSelectedListener {
+
+ public static boolean pausedLWP = true;
+ BottomNavigationView bottomNavigationView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Ändern der Statusbar-Farbe
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.drawable.gradient_titlebar));
+
+ pausedLWP = false;
+
+ setContentView(R.layout.activity_lwp);
+ setTitle("Haussteuerung - Wärmepumpe");
+
+ bottomNavigationView = findViewById(R.id.bottomNavigationView);
+
+ bottomNavigationView.setOnItemSelectedListener(this);
+ bottomNavigationView.setSelectedItemId(R.id.heizkoerper);
+ bottomNavigationView.setItemIconTintList(null);
+ }
+
+ FragmentWW fragmentWW = new FragmentWW();
+ FragmentHeizung fragmentHeizung = new FragmentHeizung();
+ FragmentHeizkoerper fragmentHeizkoerper = new FragmentHeizkoerper();
+
+ @Override
+ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
+ int itemId = item.getItemId();
+ if (itemId == R.id.warmwasser) {
+ getSupportFragmentManager().beginTransaction().replace(R.id.flFragment, fragmentWW).commit();
+ return true;
+ } else if (itemId == R.id.heizung) {
+ getSupportFragmentManager().beginTransaction().replace(R.id.flFragment, fragmentHeizung).commit();
+ return true;
+ } else if (itemId == R.id.heizkoerper) {
+ getSupportFragmentManager().beginTransaction().replace(R.id.flFragment, fragmentHeizkoerper).commit();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pausedLWP = true;
+ Log.d("LWPActivityPause", "true");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ pausedLWP = false;
+ Log.d("LWPActivityPause", "false");
+
+
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ pausedLWP = true;
+ Log.d("LWPActivityPause", "true");
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/activityLicht.java b/app/src/main/java/com/haussteuerung/activityLicht.java
new file mode 100644
index 0000000..56d3552
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/activityLicht.java
@@ -0,0 +1,265 @@
+package com.haussteuerung;
+
+import android.annotation.SuppressLint;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import com.google.gson.Gson;
+import com.google.gson.annotations.SerializedName;
+
+public class activityLicht extends AppCompatActivity implements View.OnClickListener {
+
+ public static boolean pausedLicht = true;
+ private CheckBox checkWM1, checkWM2, checkWM3, checkWM4;
+ public static String nameTom = "";
+ public static String nameFlo = "";
+ public static String nameStefan = "";
+ public static String nameGlocke = "";
+ public static boolean checkedTom;
+ public static boolean checkedFlo;
+ public static boolean checkedStefan;
+ public static boolean checkedGlocke;
+ Gson gson = new Gson();
+ String msg;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.color.black));
+
+ pausedLicht = false;
+
+ setContentView(R.layout.activity_licht);
+ setTitle("Haussteuerung - Licht");
+
+ Button buttonLicht1 = findViewById(R.id.buttonLicht1);
+ Button buttonLicht2 = findViewById(R.id.buttonLicht2);
+ Button buttonLicht3 = findViewById(R.id.buttonLicht3);
+ Button buttonLicht4 = findViewById(R.id.buttonLicht4);
+ Button buttonLicht5 = findViewById(R.id.buttonLicht5);
+ Button buttonLicht6 = findViewById(R.id.buttonLicht6);
+ Button buttonLicht7 = findViewById(R.id.buttonLicht7);
+ Button buttonLicht8 = findViewById(R.id.buttonLicht8);
+ Button buttonLicht9 = findViewById(R.id.buttonLicht9);
+ Button buttonLicht10 = findViewById(R.id.buttonLicht10);
+ Button buttonLicht11 = findViewById(R.id.buttonLicht11);
+ Button buttonLicht12 = findViewById(R.id.buttonLicht12);
+ Button buttonLicht13 = findViewById(R.id.buttonLicht13);
+ Button buttonLicht14 = findViewById(R.id.buttonLicht14);
+ Button buttonLicht15 = findViewById(R.id.buttonLicht15);
+ Button buttonLicht16 = findViewById(R.id.buttonLicht16);
+ Button buttonLicht17 = findViewById(R.id.buttonLicht17);
+ Button buttonLicht18 = findViewById(R.id.buttonLicht18);
+ Button buttonLicht19 = findViewById(R.id.buttonLicht19);
+ Button buttonLicht20 = findViewById(R.id.buttonLicht20);
+
+ checkWM1 = findViewById(R.id.checkWM1);
+ checkWM2 = findViewById(R.id.checkWM2);
+ checkWM3 = findViewById(R.id.checkWM3);
+ checkWM4 = findViewById(R.id.checkWM4);
+ checkWM1.setChecked(checkedTom);
+ checkWM1.setOnClickListener(view -> {
+ if (checkWM1.isChecked()) {
+ // msg = gson.toJson(new Checkboxen(MainActivity.ID, "WMTom", true));
+ MqttClient.publish("cmnd/Haussteuerung/Waschmaschine/Tom", "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"WMTom\"" + ",\"Checkbox\":\"true\"}");
+ } else {
+ // msg = gson.toJson(new Checkboxen(MainActivity.ID, "WMTom", false));
+ MqttClient.publish("cmnd/Haussteuerung/Waschmaschine/Tom", "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"WMTom\"" + ",\"Checkbox\":\"false\"}");
+ }
+ // MqttClient.publish("cmnd/Haussteuerung/Waschmaschine/Tom", msg);
+ });
+ checkWM2.setChecked(checkedFlo);
+ checkWM2.setOnClickListener(view -> {
+ if (checkWM2.isChecked()) {
+ // msg = gson.toJson(new Checkboxen(MainActivity.ID, "WMFlo", true));
+ MqttClient.publish("cmnd/Haussteuerung/Waschmaschine/Flo", "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"WMFlo\"" + ",\"Checkbox\":\"true\"}");
+ } else {
+ // msg = gson.toJson(new Checkboxen(MainActivity.ID, "WMFlo", false));
+ MqttClient.publish("cmnd/Haussteuerung/Waschmaschine/Flo", "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"WMFlo\"" + ",\"Checkbox\":\"false\"}");
+ }
+ // MqttClient.publish("cmnd/Haussteuerung/Waschmaschine/Flo", msg);
+ });
+ checkWM3.setChecked(checkedStefan);
+ checkWM3.setOnClickListener(view -> {
+ if (checkWM3.isChecked()) {
+ // msg = gson.toJson(new Checkboxen(MainActivity.ID, "WMStefan", true));
+ MqttClient.publish("cmnd/Haussteuerung/Waschmaschine/Stefan", "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"WMStefan\"" + ",\"Checkbox\":\"true\"}");
+ } else {
+ // msg = gson.toJson(new Checkboxen(MainActivity.ID, "WMStefan", false));
+ MqttClient.publish("cmnd/Haussteuerung/Waschmaschine/Stefan", "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"WMStefan\"" + ",\"Checkbox\":\"false\"}");
+ }
+ // MqttClient.publish("cmnd/Haussteuerung/Waschmaschine/Stefan", msg);
+ });
+ checkWM4.setChecked(checkedGlocke);
+ checkWM4.setOnClickListener(view -> {
+ if (checkWM4.isChecked()) {
+ // msg = gson.toJson(new Checkboxen(MainActivity.ID, "Glocke", true));
+ MqttClient.publish("cmnd/Haussteuerung/Glocke", "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Glocke\"" + ",\"Checkbox\":\"true\"}");
+ } else {
+ // msg = gson.toJson(new Checkboxen(MainActivity.ID, "Glocke", false));
+ MqttClient.publish("cmnd/Haussteuerung/Glocke", "{\"DeviceID\":\"" + MainActivity.ID + "\",\"Name\":\"Glocke\"" + ",\"Checkbox\":\"false\"}");
+ }
+ // MqttClient.publish("cmnd/Haussteuerung/Glocke", msg);
+ });
+
+ buttonLicht1.setOnClickListener(this);
+ buttonLicht2.setOnClickListener(this);
+ buttonLicht3.setOnClickListener(this);
+ buttonLicht4.setOnClickListener(this);
+ buttonLicht5.setOnClickListener(this);
+ buttonLicht6.setOnClickListener(this);
+ buttonLicht7.setOnClickListener(this);
+ buttonLicht8.setOnClickListener(this);
+ buttonLicht9.setOnClickListener(this);
+ buttonLicht10.setOnClickListener(this);
+ buttonLicht11.setOnClickListener(this);
+ buttonLicht12.setOnClickListener(this);
+ buttonLicht13.setOnClickListener(this);
+ buttonLicht14.setOnClickListener(this);
+ buttonLicht15.setOnClickListener(this);
+ buttonLicht16.setOnClickListener(this);
+ buttonLicht17.setOnClickListener(this);
+ buttonLicht18.setOnClickListener(this);
+ buttonLicht19.setOnClickListener(this);
+ buttonLicht20.setOnClickListener(this);
+ }
+
+ @SuppressLint("NonConstantResourceId")
+ @Override
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.buttonLicht1:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Tom Zimmer", "Lamp01"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht2:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Wohnzimmer", "Lamp02"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht3:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Stehlampe WZ", "Lamp03"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht4:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Esszimmer", "Lamp04"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht5:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Küche", "Lamp05"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht6:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Gang", "Lamp06"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht7:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Stiegenhaus", "Lamp07"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht8:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Obergeschoss", "Lamp08"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht9:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Schlafzimmer", "Lamp09"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht10:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Gartentor", "Lamp10"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht11:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Eingangstuer", "Lamp11"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht12:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Garagentor", "Lamp12"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht13:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Nachtkastl Tom", "Lamp13"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht14:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Obergeschoss", "Lamp14"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht15:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Obergeschoss", "Lamp15"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht16:
+ msg = gson.toJson(new Licht(MainActivity.ID, "vuDuoSZ", "Lamp16"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht17:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Zirkulationspumpe", "Lamp17"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht18:
+ msg = gson.toJson(new Licht(MainActivity.ID, "PCFlo", "Lamp18"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ case R.id.buttonLicht19:
+ Intent iSky = new Intent(activityLicht.this, activitySky.class);
+ startActivity(iSky);
+ break;
+ case R.id.buttonLicht20:
+ msg = gson.toJson(new Licht(MainActivity.ID, "Licht Flo", "Lamp20"));
+ MqttClient.publish("cmnd/Haussteuerung/Licht", msg);
+ break;
+ }
+ }
+
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pausedLicht = true;
+ Log.d("LichtActivityPause", "true");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ pausedLicht = false;
+ Log.d("LichtActivityPause", "false");
+
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ pausedLicht = true;
+ Log.d("LichtActivityPause", "true");
+ }
+}
+
+class Checkboxen {
+ @SerializedName("DeviceID")
+ private final String deviceId;
+ @SerializedName("Name")
+ private final String name;
+ @SerializedName("Checkbox")
+ private final boolean checkbox;
+
+ public Checkboxen(String deviceId, String name, boolean checkbox) {
+ this.deviceId = deviceId;
+ this.name = name;
+ this.checkbox = checkbox;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/activityLog.java b/app/src/main/java/com/haussteuerung/activityLog.java
new file mode 100644
index 0000000..a44d66a
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/activityLog.java
@@ -0,0 +1,72 @@
+package com.haussteuerung;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.widget.TextView;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+public class activityLog extends AppCompatActivity {
+
+ public static boolean pausedLog = true;
+ private TextView textLog;
+ final Handler myHandler = new Handler();
+ final Timer myTimer = new Timer();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.color.black));
+
+ pausedLog = false;
+
+ setContentView(R.layout.activity_log);
+ setTitle("Haussteuerung - Log");
+
+ textLog = findViewById(R.id.textLog);
+ }
+
+ // Runnable method
+ final Runnable myRunnable = new Runnable() {
+ public void run() {
+ textLog.setText(MqttClient.logContent);
+ }
+ };
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pausedLog = true;
+ myTimer.cancel();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ pausedLog = false;
+ TimerTask myTask = new TimerTask() {
+ public void run() {
+ myHandler.post(myRunnable); // updateUI method
+ }
+ };
+ myTimer.schedule(myTask,0,1000); // TimerTask, delay, period
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ pausedLog = true;
+ myTimer.cancel();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/activitySky.java b/app/src/main/java/com/haussteuerung/activitySky.java
new file mode 100644
index 0000000..ed22599
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/activitySky.java
@@ -0,0 +1,127 @@
+package com.haussteuerung;
+
+import android.app.TimePickerDialog;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.TimePicker;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+import com.google.gson.Gson;
+import com.google.gson.annotations.SerializedName;
+
+import java.time.LocalTime;
+import java.util.Locale;
+
+public class activitySky extends AppCompatActivity {
+
+ private Button buttonSkyZeit;
+ private CheckBox checkSky;
+ public static String zeitSky = "", zeitSkyMqtt = "";
+ public static boolean isChecked = false, pausedSky = true;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
+ assert actionBar != null;
+ actionBar.setBackgroundDrawable(AppCompatResources.getDrawable(getApplicationContext(), R.color.black));
+
+ pausedSky = false;
+
+ setContentView(R.layout.activity_sky);
+ setTitle("Haussteuerung - Sky");
+
+ checkSky = findViewById(R.id.checkSky);
+ buttonSkyZeit = findViewById(R.id.buttonSkyZeit);
+ Button buttonSkySend = findViewById(R.id.buttonSkySend);
+
+ buttonSkyZeit.setText(zeitSkyMqtt);
+ checkSky.setChecked(isChecked);
+
+ buttonSkyZeit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timePickerDialog(buttonSkyZeit);
+ }
+ });
+
+ buttonSkySend.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Gson gson = new Gson();
+ String msg;
+ if (checkSky.isChecked()) {
+ msg = gson.toJson(new Sky(MainActivity.ID, buttonSkyZeit.getText().toString(), true));
+ MqttClient.publish("cmnd/Haussteuerung/Sky", msg);
+ } else if (!checkSky.isChecked()) {
+ msg = gson.toJson(new Sky(MainActivity.ID, buttonSkyZeit.getText().toString(), false));
+ MqttClient.publish("cmnd/Haussteuerung/Sky", msg);
+ }
+ finish();
+ }
+ });
+
+ Log.d("ActivitySky","Created");
+ } public void timePickerDialog(Button button) {
+ LocalTime localTime = LocalTime.parse(button.getText());
+ int hour = localTime.getHour();
+ int minute = localTime.getMinute();
+ TimePickerDialog.OnTimeSetListener onTimeSetListener = new TimePickerDialog.OnTimeSetListener() {
+ @Override
+ public void onTimeSet(TimePicker timePicker, int selectedHour, int selectedMinute) {
+ button.setText(String.format(Locale.getDefault(), "%02d:%02d", selectedHour, selectedMinute));
+ }
+ };
+ TimePickerDialog timePickerDialog = new TimePickerDialog(this, onTimeSetListener, hour, minute, true);
+ timePickerDialog.show();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ pausedSky = true;
+ // Log.d("TimerSkyActivity", "Canceled");
+ Log.d("ActivitySky","Paused");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ pausedSky = false;
+ buttonSkyZeit.setText(zeitSkyMqtt);
+ checkSky.setChecked(isChecked);
+ Log.d("ActivitySky","Resumed");
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ pausedSky = true;
+ Log.d("ActivitySky","Stopped");
+ }
+}
+
+class Sky {
+ @SerializedName("DeviceID")
+ private final String deviceId;
+ @SerializedName("Datum")
+ private final String datum;
+ @SerializedName("CheckboxSky")
+ private final boolean checkboxSky;
+
+ public Sky(String deviceId, String datum, boolean checkboxSky) {
+ this.deviceId = deviceId;
+ this.datum = datum;
+ this.checkboxSky = checkboxSky;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/haussteuerung/noConnection.java b/app/src/main/java/com/haussteuerung/noConnection.java
new file mode 100644
index 0000000..58c0d2a
--- /dev/null
+++ b/app/src/main/java/com/haussteuerung/noConnection.java
@@ -0,0 +1,24 @@
+package com.haussteuerung;
+
+import android.os.Bundle;
+
+import androidx.activity.EdgeToEdge;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.graphics.Insets;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsCompat;
+
+public class noConnection extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ EdgeToEdge.enable(this);
+ setContentView(R.layout.activity_no_connection);
+ ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activityChristmas), (v, insets) -> {
+ Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
+ v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
+ return insets;
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/alarm_false.xml b/app/src/main/res/drawable/alarm_false.xml
new file mode 100644
index 0000000..694cad0
--- /dev/null
+++ b/app/src/main/res/drawable/alarm_false.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/alarm_true.xml b/app/src/main/res/drawable/alarm_true.xml
new file mode 100644
index 0000000..49cce8b
--- /dev/null
+++ b/app/src/main/res/drawable/alarm_true.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/app_widget_background.xml b/app/src/main/res/drawable/app_widget_background.xml
new file mode 100644
index 0000000..785445c
--- /dev/null
+++ b/app/src/main/res/drawable/app_widget_background.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/app_widget_inner_view_background.xml b/app/src/main/res/drawable/app_widget_inner_view_background.xml
new file mode 100644
index 0000000..007e287
--- /dev/null
+++ b/app/src/main/res/drawable/app_widget_inner_view_background.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/button_text_color.xml b/app/src/main/res/drawable/button_text_color.xml
new file mode 100644
index 0000000..01f6764
--- /dev/null
+++ b/app/src/main/res/drawable/button_text_color.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/button_ww.xml b/app/src/main/res/drawable/button_ww.xml
new file mode 100644
index 0000000..52e630d
--- /dev/null
+++ b/app/src/main/res/drawable/button_ww.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/christmas_blue.xml b/app/src/main/res/drawable/christmas_blue.xml
new file mode 100644
index 0000000..02b8509
--- /dev/null
+++ b/app/src/main/res/drawable/christmas_blue.xml
@@ -0,0 +1,13 @@
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/christmas_changing.xml b/app/src/main/res/drawable/christmas_changing.xml
new file mode 100644
index 0000000..dc660f0
--- /dev/null
+++ b/app/src/main/res/drawable/christmas_changing.xml
@@ -0,0 +1,14 @@
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/christmas_green.xml b/app/src/main/res/drawable/christmas_green.xml
new file mode 100644
index 0000000..6e0e763
--- /dev/null
+++ b/app/src/main/res/drawable/christmas_green.xml
@@ -0,0 +1,13 @@
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/christmas_lightblue.xml b/app/src/main/res/drawable/christmas_lightblue.xml
new file mode 100644
index 0000000..d8e4a35
--- /dev/null
+++ b/app/src/main/res/drawable/christmas_lightblue.xml
@@ -0,0 +1,13 @@
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/christmas_purple.xml b/app/src/main/res/drawable/christmas_purple.xml
new file mode 100644
index 0000000..67ab1f4
--- /dev/null
+++ b/app/src/main/res/drawable/christmas_purple.xml
@@ -0,0 +1,13 @@
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/christmas_red.xml b/app/src/main/res/drawable/christmas_red.xml
new file mode 100644
index 0000000..cc1b515
--- /dev/null
+++ b/app/src/main/res/drawable/christmas_red.xml
@@ -0,0 +1,13 @@
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/christmas_white.xml b/app/src/main/res/drawable/christmas_white.xml
new file mode 100644
index 0000000..ec77322
--- /dev/null
+++ b/app/src/main/res/drawable/christmas_white.xml
@@ -0,0 +1,13 @@
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/christmas_yellow.xml b/app/src/main/res/drawable/christmas_yellow.xml
new file mode 100644
index 0000000..401ce51
--- /dev/null
+++ b/app/src/main/res/drawable/christmas_yellow.xml
@@ -0,0 +1,13 @@
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/gradient.xml b/app/src/main/res/drawable/gradient.xml
new file mode 100644
index 0000000..32289e7
--- /dev/null
+++ b/app/src/main/res/drawable/gradient.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/gradient_pressed.xml b/app/src/main/res/drawable/gradient_pressed.xml
new file mode 100644
index 0000000..01d922d
--- /dev/null
+++ b/app/src/main/res/drawable/gradient_pressed.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/gradient_titlebar.xml b/app/src/main/res/drawable/gradient_titlebar.xml
new file mode 100644
index 0000000..5bafe99
--- /dev/null
+++ b/app/src/main/res/drawable/gradient_titlebar.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/grey_button_color.xml b/app/src/main/res/drawable/grey_button_color.xml
new file mode 100644
index 0000000..4b7afe6
--- /dev/null
+++ b/app/src/main/res/drawable/grey_button_color.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/haus.JPG b/app/src/main/res/drawable/haus.JPG
new file mode 100644
index 0000000..b39fbb7
Binary files /dev/null and b/app/src/main/res/drawable/haus.JPG differ
diff --git a/app/src/main/res/drawable/haus_icon.png b/app/src/main/res/drawable/haus_icon.png
new file mode 100644
index 0000000..b3f6a10
Binary files /dev/null and b/app/src/main/res/drawable/haus_icon.png differ
diff --git a/app/src/main/res/drawable/haus_neu.jpg b/app/src/main/res/drawable/haus_neu.jpg
new file mode 100644
index 0000000..d2addbc
Binary files /dev/null and b/app/src/main/res/drawable/haus_neu.jpg differ
diff --git a/app/src/main/res/drawable/heizung_black.png b/app/src/main/res/drawable/heizung_black.png
new file mode 100644
index 0000000..0bfb53b
Binary files /dev/null and b/app/src/main/res/drawable/heizung_black.png differ
diff --git a/app/src/main/res/drawable/heizung_white.png b/app/src/main/res/drawable/heizung_white.png
new file mode 100644
index 0000000..d964692
Binary files /dev/null and b/app/src/main/res/drawable/heizung_white.png differ
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..07d5da9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..2b068d1
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/img_0775.JPG b/app/src/main/res/drawable/img_0775.JPG
new file mode 100644
index 0000000..3dcbc43
Binary files /dev/null and b/app/src/main/res/drawable/img_0775.JPG differ
diff --git a/app/src/main/res/drawable/lwp.png b/app/src/main/res/drawable/lwp.png
new file mode 100644
index 0000000..2e2303a
Binary files /dev/null and b/app/src/main/res/drawable/lwp.png differ
diff --git a/app/src/main/res/drawable/popup_background.xml b/app/src/main/res/drawable/popup_background.xml
new file mode 100644
index 0000000..53c5a82
--- /dev/null
+++ b/app/src/main/res/drawable/popup_background.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/warmwasser_black.png b/app/src/main/res/drawable/warmwasser_black.png
new file mode 100644
index 0000000..f161f7d
Binary files /dev/null and b/app/src/main/res/drawable/warmwasser_black.png differ
diff --git a/app/src/main/res/drawable/warmwasser_white.png b/app/src/main/res/drawable/warmwasser_white.png
new file mode 100644
index 0000000..b6df334
Binary files /dev/null and b/app/src/main/res/drawable/warmwasser_white.png differ
diff --git a/app/src/main/res/drawable/warning.jpg b/app/src/main/res/drawable/warning.jpg
new file mode 100644
index 0000000..d1d671f
Binary files /dev/null and b/app/src/main/res/drawable/warning.jpg differ
diff --git a/app/src/main/res/layout/activity_christmas.xml b/app/src/main/res/layout/activity_christmas.xml
new file mode 100644
index 0000000..fb454a6
--- /dev/null
+++ b/app/src/main/res/layout/activity_christmas.xml
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_doris.xml b/app/src/main/res/layout/activity_doris.xml
new file mode 100644
index 0000000..32dbb34
--- /dev/null
+++ b/app/src/main/res/layout/activity_doris.xml
@@ -0,0 +1,233 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_doris_licht.xml b/app/src/main/res/layout/activity_doris_licht.xml
new file mode 100644
index 0000000..673cb69
--- /dev/null
+++ b/app/src/main/res/layout/activity_doris_licht.xml
@@ -0,0 +1,315 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_file_download.xml b/app/src/main/res/layout/activity_file_download.xml
new file mode 100644
index 0000000..4893604
--- /dev/null
+++ b/app/src/main/res/layout/activity_file_download.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_glocke.xml b/app/src/main/res/layout/activity_glocke.xml
new file mode 100644
index 0000000..f062f07
--- /dev/null
+++ b/app/src/main/res/layout/activity_glocke.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_haus.xml b/app/src/main/res/layout/activity_haus.xml
new file mode 100644
index 0000000..e10bc15
--- /dev/null
+++ b/app/src/main/res/layout/activity_haus.xml
@@ -0,0 +1,421 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_licht.xml b/app/src/main/res/layout/activity_licht.xml
new file mode 100644
index 0000000..b578324
--- /dev/null
+++ b/app/src/main/res/layout/activity_licht.xml
@@ -0,0 +1,408 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_log.xml b/app/src/main/res/layout/activity_log.xml
new file mode 100644
index 0000000..60ee4d5
--- /dev/null
+++ b/app/src/main/res/layout/activity_log.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_lwp.xml b/app/src/main/res/layout/activity_lwp.xml
new file mode 100644
index 0000000..15844ab
--- /dev/null
+++ b/app/src/main/res/layout/activity_lwp.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..2be7da3
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_no_connection.xml b/app/src/main/res/layout/activity_no_connection.xml
new file mode 100644
index 0000000..c5ded9d
--- /dev/null
+++ b/app/src/main/res/layout/activity_no_connection.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_sky.xml b/app/src/main/res/layout/activity_sky.xml
new file mode 100644
index 0000000..619d1f7
--- /dev/null
+++ b/app/src/main/res/layout/activity_sky.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_heizkoerper.xml b/app/src/main/res/layout/fragment_heizkoerper.xml
new file mode 100644
index 0000000..5d303ef
--- /dev/null
+++ b/app/src/main/res/layout/fragment_heizkoerper.xml
@@ -0,0 +1,921 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_heizung.xml b/app/src/main/res/layout/fragment_heizung.xml
new file mode 100644
index 0000000..12307f0
--- /dev/null
+++ b/app/src/main/res/layout/fragment_heizung.xml
@@ -0,0 +1,283 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_ww.xml b/app/src/main/res/layout/fragment_ww.xml
new file mode 100644
index 0000000..99586e6
--- /dev/null
+++ b/app/src/main/res/layout/fragment_ww.xml
@@ -0,0 +1,368 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_adnotification.xml b/app/src/main/res/layout/layout_adnotification.xml
new file mode 100644
index 0000000..05e6162
--- /dev/null
+++ b/app/src/main/res/layout/layout_adnotification.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_alarm.xml b/app/src/main/res/layout/layout_alarm.xml
new file mode 100644
index 0000000..faf0fbd
--- /dev/null
+++ b/app/src/main/res/layout/layout_alarm.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_haus.xml b/app/src/main/res/layout/layout_haus.xml
new file mode 100644
index 0000000..439ecd3
--- /dev/null
+++ b/app/src/main/res/layout/layout_haus.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_numberpicker.xml b/app/src/main/res/layout/layout_numberpicker.xml
new file mode 100644
index 0000000..ac1f21f
--- /dev/null
+++ b/app/src/main/res/layout/layout_numberpicker.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/layout_version.xml b/app/src/main/res/layout/layout_version.xml
new file mode 100644
index 0000000..6143de8
--- /dev/null
+++ b/app/src/main/res/layout/layout_version.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/bottom_nav_menu_lwp.xml b/app/src/main/res/menu/bottom_nav_menu_lwp.xml
new file mode 100644
index 0000000..96bf420
--- /dev/null
+++ b/app/src/main/res/menu/bottom_nav_menu_lwp.xml
@@ -0,0 +1,15 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/app/src/main/res/mipmap-anydpi/ic_launcher.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000..c209e78
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..b2dfe3d
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000..4f0f1d6
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..62b611d
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000..948a307
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..1b9a695
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..28d4b77
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9287f50
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..aa7d642
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9126ae3
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..e94699e
--- /dev/null
+++ b/app/src/main/res/values-night/themes.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..6554bbc
--- /dev/null
+++ b/app/src/main/res/values/attrs.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..9e85369
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,32 @@
+
+
+ #FFBB86FC
+ #3F51B5
+ #FF3700B3
+ #FF03DAC5
+ #FF018786
+ #FF000000
+ #FFFFFFFF
+ #ff8a00
+ #FFE1F5FE
+ #FF81D4FA
+ #FF039BE5
+ #FF01579B
+ #36D1DC
+ #d3d3d3
+ #E02F44
+ #FF780A
+ #FFB357
+ #56A64B
+ #96D98D
+ #C8F2C2
+ #C0D8FF
+ #8AB8FF
+ #949494
+ #D50000
+ #64DD17
+ #FFFF00
+ #FF81D4FA
+ #FF01579B
+ #FFBB86FC
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..983666a
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,151 @@
+
+ Haussteuerung
+ Test
+ Haus
+ Läuten
+ Licht
+ Log
+ Blutdruck
+ Zeit auswählen
+ SYS
+ DIA
+ Zucker
+ Temperatur
+ Absenden
+ Windel
+ 120
+ 80
+ 35
+ Deckenlampe
+ Stehlampe
+ Bad Deckenlampe
+ Bad Wandlampe
+ alle Rollo auf
+ alle Rollo zu
+ alle Rollo 50%
+ Fenster links auf
+ Fenster links 50%
+ Fenster links zu
+ Fenster rechts auf
+ Fenster rechts 50%
+ Fenster rechts zu
+ Bad Rollo auf
+ Bad Rollo 50%
+ Bad Rollo zu
+ Terrasse Rollo auf
+ Terrasse Rollo 50%
+ Terrasse Rollo zu
+ Tom
+ Haustür
+ Warmwasser
+ Wohnzimmer
+ Stehlampe WZ
+ Esszimmer
+ Küche
+ Gang
+ Stiegenhaus
+ Obergeschoss
+ Schlafzimmer
+ Gartentor
+ Garage
+ Nachtkastl Tom
+ vuDuoWZ on
+ Glocke
+ vuDuoSZ on
+ Heizung
+ SkyQ
+ Licht Flo
+ WM Tom
+ WM Flo
+ WM Stefan
+ als SMS senden
+ Doris Licht
+ Doris
+ Alarm
+ TODO
+
+
+ default_notification_channel_id
+ Test
+ Add widget
+ This is an app widget description
+ activitiyHausNeu
+ Home
+ Dashboard
+ Notifications
+ MQTT
+ Hello blank fragment
+ min
+ max
+ Werte ändern
+ geschlossen
+ geöffnet
+ man
+ auto
+ Grossraum
+ 19.5°
+ Dachboden
+ Stefan
+ Florian
+ Bad
+ WC EG
+ Vorraum
+ Arbeitszimmer
+ Doris Bad
+ soll
+ VL
+ Sky Q Abschalttimer
+ Türen öffnen
+ Kamera
+ Boiler\nOben
+ Boiler\nUnten
+ 38°
+ 44°
+ Version 25.531.1
+ Früh
+ +2h
+ Nacht
+ Install
+ Eingangstür
+ Garagetür
+ Kellertür
+ Terrassentür Doris
+ Fenster links Doris
+ Fenster rechts Doris
+ Fenster Bad Doris
+ Fenster Wohnzimmer
+ Fenster Esszimmer
+ Fenster Essplatz-Küche
+ Fenster Küche
+ Fenster Garderobe
+ Fenster WC
+ Fenster Dachboden
+ Fenster Flo
+ Fenster Stefan
+ Fenster Bad
+ Alarm wirklich einschalten?
+ Nein
+ Ja, einschalten
+ Garagentor öffnen/schließen? \nSchiebetor öffnen/schließen?
+ Schiebetor
+ °C
+ Alarm ein.
+ Alarm aus.
+ Waschmaschine 1 läuft.
+ Waschmaschine 1 ist fertig/ausgeschaltet.
+ Waschmaschine 2 läuft.
+ Waschmaschine 2 ist fertig/ausgeschaltet.
+ Tor Steuerung
+ Alarm Steuerung
+ Version
+ Heizkörper
+ Silent Mode
+ Zirkulationspumpe
+ Christmas
+ Ein/aus
+ ON
+ OFF
+ Growatt ein.
+ Growatt aus.
+ PC Flo
+
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
new file mode 100644
index 0000000..6f0d96d
--- /dev/null
+++ b/app/src/main/res/values/themes.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml
new file mode 100644
index 0000000..fa0f996
--- /dev/null
+++ b/app/src/main/res/xml/backup_rules.xml
@@ -0,0 +1,13 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml
new file mode 100644
index 0000000..9ee9997
--- /dev/null
+++ b/app/src/main/res/xml/data_extraction_rules.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/file_paths.xml b/app/src/main/res/xml/file_paths.xml
new file mode 100644
index 0000000..1555e4c
--- /dev/null
+++ b/app/src/main/res/xml/file_paths.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/test/java/com/haussteuerung/ExampleUnitTest.java b/app/src/test/java/com/haussteuerung/ExampleUnitTest.java
new file mode 100644
index 0000000..bf263d8
--- /dev/null
+++ b/app/src/test/java/com/haussteuerung/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.haussteuerung;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..7b3e59f
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,18 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ maven {
+ url 'https://jitpack.io'
+ }
+ }
+ dependencies {
+ classpath libs.google.services
+ }
+}
+
+plugins {
+alias(libs.plugins.androidApplication) apply false
+}
+
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..00d252e
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,22 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. For more details, visit
+# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true
+android.nonFinalResIds=false
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
new file mode 100644
index 0000000..f5528d7
--- /dev/null
+++ b/gradle/libs.versions.toml
@@ -0,0 +1,33 @@
+[versions]
+agp = "8.3.2"
+junit = "4.13.2"
+junitVersion = "1.1.5"
+espressoCore = "3.5.1"
+appcompat = "1.6.1"
+material = "1.11.0"
+pahoMqttv3 = "1.2.5"
+pahoMqttService = "1.1.1"
+googleServices = "4.4.1"
+firebaseMessaging = "23.4.1"
+touchImageView = "3.2.0"
+gson = "2.10.1"
+activity = "1.9.0"
+constraintlayout = "2.1.4"
+
+[libraries]
+junit = { group = "junit", name = "junit", version.ref = "junit" }
+ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
+espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
+appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
+material = { group = "com.google.android.material", name = "material", version.ref = "material" }
+pahoMqttv3 = { group = "org.eclipse.paho", name = "org.eclipse.paho.client.mqttv3", version.ref = "pahoMqttv3" }
+pahoMqttService = { group = "org.eclipse.paho", name = "org.eclipse.paho.android.service", version.ref = "pahoMqttService" }
+google-services = { group = "com.google.gms", name = "google-services", version.ref = "googleServices" }
+firebase-messaging = { group = "com.google.firebase", name = "firebase-messaging", version.ref = "firebaseMessaging" }
+touchImageView = { group = "com.github.MikeOrtiz", name = "TouchImageView", version.ref = "touchImageView" }
+gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
+activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
+constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
+
+[plugins]
+androidApplication = { id = "com.android.application", version.ref = "agp" }
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..e708b1c
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..5d295fa
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Apr 19 12:54:48 CEST 2024
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..4f906e0
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..107acd3
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/haussteuerung-key.jks b/haussteuerung-key.jks
new file mode 100644
index 0000000..815d4bf
Binary files /dev/null and b/haussteuerung-key.jks differ
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..15fec37
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,25 @@
+pluginManagement {
+ repositories {
+ google {
+ content {
+ includeGroupByRegex("com\\.android.*")
+ includeGroupByRegex("com\\.google.*")
+ includeGroupByRegex("androidx.*")
+ }
+ }
+ mavenCentral()
+ gradlePluginPortal()
+ maven { url "https://jitpack.io" }
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ maven { url "https://jitpack.io" }
+ }
+}
+
+rootProject.name = "Haussteuerung"
+include ':app'