49 Commits

Author SHA1 Message Date
2badabb616
Refactor script to generate MP3 files
In this commit, I made several improvements to the 'generate_mp3.sh' script:

1. Removed old complete files before processing to ensure a clean slate.
2. Modified the 'create_mp3_files' function to use '>>' instead of '>' when appending text to the complete files.
3. Updated the comments in the script for better clarity.

These changes help maintain a more organized and reliable MP3 generation process. The script now properly appends text to the 'de_complete.txt' and 'es_complete.txt' files, and it removes old complete files before starting the processing.

File Changes:
- Modified 'generate_mp3.sh' (see diff for details)

Note: Please review and test the changes to ensure they meet your requirements.
2024-01-29 13:31:29 +01:00
53000fc607
Refactor wecker.sh script
- Commented out 'set -e' and 'set -x' to prevent stopping the script on errors and disable debugging by default.
- Introduced functions set_brightness, set_colortemp, and set_color for better code organization.
- Modified brightness and color temperature commands to use the new functions.
2024-01-27 00:21:00 +01:00
122fdc6669
Added generate_text.sh script:
- Author: Michael Haider
- Created on: 26.01.2024
- Description: This script generates various text files with information such as date, time, news, and weather in German and Spanish.
- The script includes functions to check the IP address of Lisa's iPhone, generate text files in German and Spanish, transfer files to the A72 device, and start generate_mp3.sh on the A72.
- The generated texts are outputted in both German and Spanish.
2024-01-26 23:50:24 +01:00
e2b06dab34
Initial commit
Added generate_mp3.sh script:
- Author: Michael Haider
- Created on: 26.01.2024
- Description: This script generates MP3 files from text files in German and Spanish using gtts-cli (Google Text-to-Speech).
- The script exports the path to the programs, defines language and category order, sets directories, and includes a function to create MP3 files.
- The generated MP3 files are created with gtts-cli in German or Spanish slow mode based on the file content.
- The script then sets the media volume and loops through categories and languages to play the generated MP3 files at normal or half speed, based on the language indication.
2024-01-26 23:49:50 +01:00
6d5ce74f08
Refactor wecker.sh script
Made the following changes to the wecker.sh script:
- Adjusted comments and translated the comments and script messages into English for better clarity.
- Introduced error handling for SSH commands, Bluetooth operations, and volume adjustments to ensure the script exits gracefully in case of failures.
- Updated variable names for consistency and improved overall readability of the script.
- Removed unnecessary debug-related code and streamlined the script structure.
- Addressed formatting issues for better code presentation.
2024-01-26 23:47:53 +01:00
fe66c936c4
Refactor morning-alarm.sh script
Adjusted comments and translated the comments and script messages into English for better clarity. The script now provides more informative output during its execution, including status messages for Bluetooth operations, volume adjustment, and alarm notification checks. Additionally, introduced error handling for Bluetooth and volume adjustment operations to ensure the script exits gracefully in case of failures.

The main program section and function names have been retained for continuity, but the script's overall readability and understandability have been improved through language translation and comments rephrasing.
2024-01-26 23:47:02 +01:00
4bb7048638
Fix weckzeit_datei path in A72_alarm_getter.sh
Corrected the path for the 'weckzeit_datei' variable in A72_alarm_getter.sh script. The original path was pointing to '/root/iobroker_scripts/generel/.weckzeiten.txt' and has been updated to the correct path '/root/iobroker_scripts/general/.weckzeiten.txt'.

This ensures that the script can accurately locate and utilize the 'weckzeit_datei' file, preventing potential issues related to the incorrect file path.
2024-01-26 23:45:34 +01:00
d68beee2b8
Added Soundfile (your-new-morning-alarm.ogg) to repo. 2024-01-24 16:15:05 +01:00
d9dc246bed
Update morning-alarm.sh script
Modify the morning-alarm.sh script to enhance clarity and maintainability. The changes involve updating the path for the mpv command to use '/data/scripts/your-new-morning-alarm.ogg' instead of the previous path '/product/media/audio/alarms/your-new-morning-alarm.ogg'. This adjustment ensures consistency with other script paths and makes it easier to locate the alarm sound file.

Changes made:
- Update the path for the mpv command to '/data/scripts/your-new-morning-alarm.ogg'

This modification simplifies the script and aligns it with the path used in other related scripts, improving overall script coherence.
2024-01-24 16:13:32 +01:00
8b38398164
Improve wecker.sh script
Adjust the SSH command in the wecker.sh script for better readability and functionality. Instead of 'cmd media_session volume --set 5 --stream 9', use the more descriptive 'cmd media_session volume scripts/--set 5 --stream 9'. Additionally, update the path for the mpv command to use '/data/scripts/your-new-morning-alarm.ogg'. This change ensures consistency and clarity in the script.

Changes made:
- Replace 'cmd media_session volume --set 5 --stream 9' with 'cmd media_session volume scripts/--set 5 --stream 9'
- Update the path for mpv command to '/data/scripts/your-new-morning-alarm.ogg'
2024-01-24 16:10:31 +01:00
091d1e8d2b
Improve script execution and debugging
- Enabled debugging mode to provide a more detailed log when needed.
- Modified the interval in the check_ip function to 5 seconds for better accuracy in IP retrieval attempts.
- Refactored the sleep_duration calculation to ensure it accurately reflects the intended duration between adjustments.
- Adjusted the loop in gradual adjustment to start from 1, ensuring the initial values are set correctly.
- Replaced multiple consecutive '&& sleep' statements with separate lines for improved readability.
- Simplified the error handling in check_ip and check_notification functions for clarity.
- Removed unnecessary '|| true' statements in error handling.
- Added echo statements to print the light status when it is off in check_external_light_status.
- Improved comments for better script understanding.

These changes enhance the script's execution, improve debugging capabilities, and make the code more readable and maintainable.
2023-12-30 16:41:23 +01:00
05af18857a
Refactor brightness and colortemp_step calculations
- Simplified calculation of brightness_step and colortemp_step for better readability.
- Corrected the calculation of reached final values for brightness and color temperature.
- Introduced sleep_duration variable for improved flexibility in sleep intervals.
- Adjusted the loop to start from 0 to correctly set the initial values.
- Added a comment to clarify the purpose of the loop and its iteration.
- Set the current_brightness and current_colortemp directly to the end values after the loop, ensuring they reach the intended final values.
- Moved the sleep_duration calculation inside the loop for consistency.

This refactoring enhances the script's clarity and ensures accurate calculation of brightness and color temperature steps during the gradual adjustment process. The changes also include improvements in sleep duration handling.
2023-12-30 12:01:12 +01:00
5ecd10a431
Refactor wecker.sh script for better readability and functionality
- Updated comments for better clarity and documentation
- Introduced a DEBUG variable to toggle debugging information
- Utilized set -e to stop the script on errors for better error handling
- Corrected the script flow to ensure proper execution of color changes
- Introduced a new ssh_command function for executing SSH commands
- Improved check_ip function for finding the IP address more reliably
- Added DEBUG checks to bypass certain functions for debugging purposes
- Fixed issues with sleep intervals during script execution
- Improved logging by adding echo statements for important steps
- Adjusted variable names for better readability
- Removed unnecessary comments and debug statements
- Added set -e for better error handling
- Introduced command-line option -d for enabling DEBUG mode
- Improved formatting and indentation for better code readability
2023-12-29 22:01:23 +01:00
3d2605a8f8
Refactor wecker.sh script for better readability and functionality
- Updated comments for better clarity and documentation
- Introduced a DEBUG variable to toggle debugging information
- Utilized set -e to stop the script on errors for better error handling
- Corrected the script flow to ensure proper execution of color changes
- Introduced a new ssh_command function for executing SSH commands
- Improved check_ip function for finding the IP address more reliably
- Added DEBUG checks to bypass certain functions for debugging purposes
- Fixed issues with sleep intervals during script execution
- Improved logging by adding echo statements for important steps
- Adjusted variable names for better readability
- Removed unnecessary comments and debug statements
- Added set -e for better error handling
- Introduced command-line option -d for enabling DEBUG mode
- Improved formatting and indentation for better code readability
2023-12-29 21:55:49 +01:00
aa04b75e41
Adjustments to wecker.sh script:
- Reordered the iobroker state set commands to set colortemp at the end for better consistency.
- Removed unnecessary ping test in the check_ip function.
- Cleaned up the check_notification function, removed unnecessary echo statements.
- Adjusted the sleep time in the check_notification function to 5 seconds.
- Updated comments and removed unnecessary comments for clarity.
- Minor formatting improvements for better readability.
- Added missing code in the color change loop, now it changes colors as intended. (hopefully)
- Removed redundant comments at the end of the script.

These changes enhance the script's clarity, remove unnecessary code, and ensure proper functionality.
2023-12-28 21:51:20 +01:00
9dfa7f7623
Optimierung von A72_alarm_getter.sh
- Entfernen des nicht benötigten Ping-Tests in der check_ip-Funktion.
- Kommentieren des Codes zum Löschen überholter 'at'-Jobs, da er derzeit auskommentiert ist (Muss ich mich ein anderes mal drum kümmern).
2023-12-28 20:33:37 +01:00
426cbc55e5
Hinzufügen von Ausgabe für Ausführungszeitpunkt 2023-12-28 20:29:52 +01:00
8c3bfed83f
Fix syntax error in check_ip function and handle unsuccessful attempts. Update wecker.sh: Fix syntax error in 'for' loop 2023-12-27 12:47:55 +01:00
a44e6c91ba
Update A72_alarm_getter.sh
- Adjusted the curl command to include the message data directly without the 'Priority' header.
2023-12-26 17:11:30 +01:00
dde161ae61
Improve IP resolution and add retry mechanism
- Modified the IP resolution process to allow for multiple attempts with a specified interval.
- Added a retry mechanism to check the IP address multiple times before considering it unsuccessful.
- If the target IP cannot be found after the specified number of attempts, an error message is displayed.
- Updated the SSH command to run the alarm script in the background.
2023-12-26 17:01:34 +01:00
5f7abef59d
Improve IP resolution and add retry mechanism
- Modified the IP resolution process to allow for multiple attempts with a specified interval.
- Added a retry mechanism to check the IP address multiple times before considering it unsuccessful.
- If the target IP cannot be found after the specified number of attempts, an error message is displayed.
- Updated the SSH command to run the alarm script in the background.
2023-12-22 17:51:48 +01:00
4761bfea0f
Refactor Wecker Script for Improved Readability and Functionality
- Combined IP retrieval and ping test into a single function 'check_ip'.
- Improved error handling for better script robustness.
- Removed unnecessary commented-out code and added comments for clarity.
- Ensured consistency in indentation and formatting.

Author: Michael, Haider
Date: 22.12.2023
2023-12-22 15:07:05 +01:00
3dd4f72a0e
Fix Weckzeit Calculation and Refactoring
- Corrected the calculation of the variable 'lightsOn' to ensure the correct time is set for turning on lights.
- Refactored the script by combining the IP retrieval and ping test into a single function 'check_ip'.
- Improved error handling and added comments for better readability.

Author: Michael, Haider
Date: 22.12.2023
2023-12-22 15:05:00 +01:00
11ae8bfaf6
Update MAC address in check_ip function
Changed the MAC address in the check_ip function to '1e:46:8c'.
2023-12-22 10:07:40 +01:00
c5d7167bb1
Keep only the next 'at'-job and delete all future jobs in A72_alarm_getter.sh
Modified delete_expired_at_jobs function to retain only the next 'at'-job and delete all upcoming jobs. This ensures that only the immediate 'at'-job remains scheduled.
2023-12-22 09:42:28 +01:00
76d38622c6
Aktualisiere IP-Adressen in A72_alarm_getter.sh und wecker.sh:
- Ändere die MAC-Adresse in beiden Skripten auf '18🆎1d' für die Funktion check_ip.
2023-12-22 09:09:17 +01:00
5bb790bb3b
Aktualisiere Wecker-Script:
- Geänderte Mac-Adresse für die Funktion check_ip.
- Verwende 'arp-scan' für die IP-Ermittlung.
- Verbesserte Ausgabe und Wartezeit in der Funktion check_notification.
- Start des Alarm-Scripts auf dem Handy mit protokollierter Ausgabe.
2023-12-22 08:05:08 +01:00
43564c52ac
Verbesserungen am Wecker-Script:
- Geänderte Mac-Adresse für Lisas iPhone in check_ip-Funktion.
- Verbesserte Ausgabe und Wartezeit in der check_notification-Funktion.
- Angepasste Schritte und Dauer für die Helligkeits- und Farbtemperaturanpassung.
- Start des Alarm-Scripts auf dem Handy ohne protokollierte Ausgabe.
2023-12-19 17:16:47 +01:00
728966a0d6
Anpassungen am morning-alarm.sh Skript:
- Änderung des Bluetooth-Ausschaltbefehls zu 'svc bluetooth disable'.
- Aktualisierung des Lautstärke-Erhöhungsbefehls.
- Verbesserte Ausgabe in der check_notification-Funktion.
- Entfernung des Timeout-Befehls bei der Überprüfung der Weckerbenachrichtigung.
- Hinzufügen von 'killall mpv' bei Beendigung des Weckers.
2023-12-18 12:58:44 +01:00
2d15fe099c
Anpassungen am Wecker-Script:
- Geänderte Mac-Adresse für Lisas iPhone in check_ip-Funktion.
- Verbesserte Ausgabe in der check_notification-Funktion.
- Angepasste Schritte und Dauer für die Helligkeits- und Farbtemperaturanpassung.
- Start des Alarm-Scripts auf dem Handy mit protokollierter Ausgabe.
2023-12-18 12:56:31 +01:00
b95e0627dc
Update wecker.sh script
- Adjusted the 'check_notification' function to execute the SSH command within a timeout.
- Modified the logging of wecker.sh start and end times for better monitoring.

Changes:
- Modified line 41 in wecker.sh to execute the SSH command within a timeout for 'check_notification' function
  from:
  output=                [0] "Beenden" -> PendingIntent{cb58c43: PendingIntentRecord{9bf5dfe com.urbandroid.sleep startActivity (allowlist: 27215bc:+30s0ms/0/NOTIFICATION_SERVICE/NotificationManagerService)}}
  to:
  output=Timeout

- Added date and echo statements to log the start and end times in 'check_notification' function.

- Moved the 'ssh root@  '/data/scripts/morning-alarm.sh'' line to the end of the script to trigger the morning alarm.

Author: Michael Haider
Date: 17.12.2023
2023-12-17 21:53:26 +01:00
b114ce5fdc
Update A72_alarm_getter.sh script
Adjusted the wecker.sh invocation in A72_alarm_getter.sh to redirect output to /root/wecker.log for better logging. Now, when scheduling a new alarm, the script will log the wecker.sh execution details to the log file.

Changes:
- Modified line 87 in A72_alarm_getter.sh to redirect wecker.sh output to /root/wecker.log
  from:
  echo "/root/iobroker_scripts/schlafzimmer/wecker.sh" | at ""
  to:
  echo "/root/iobroker_scripts/schlafzimmer/wecker.sh > /root/wecker.log" | at ""

Author: Michael Haider
Date: 17.12.2023
2023-12-17 21:49:16 +01:00
1dc5643f7b
Added script for controlling alarm on Android device
This script turns off Bluetooth, increases the media volume to 100%, and continuously checks if the alarm has been dismissed on the Android device. Additionally, it plays the morning alarm sound in an infinite loop until the alarm is dismissed.

- Script Name: morning-alarm.sh
- Features:
  - Turn off Bluetooth
  - Set media volume to 100%
  - Play the morning alarm sound in an infinite loop
  - Continuously check for alarm dismissal

Author: Michael Haider
Date: 17.12.2023
2023-12-17 21:46:44 +01:00
b881b79bf6
Änderungen am A72_alarm_getter.sh-Skript: Neues Format für Alarmzeit 2023-12-11 16:46:46 +01:00
a0dbcefb1c
Refactor A72_alarm_getter.sh script for improved readability and reliability
- Removed unnecessary variable interpolation in the 'echo' statement.
- Changed the path for 'atq' and 'atrm' commands to use the full path.
- Updated the 'ping' command to use the full path for better compatibility.
- Added comments and improved formatting for better script understanding.
2023-12-07 13:17:18 +01:00
63720dafea
Add execution timestamp and echo in A72_alarm_getter.sh
In this commit, an echo statement is added to display the execution timestamp
in the A72_alarm_getter.sh script. The timestamp is printed with the command
'echo 'Ausgeführt um: ''.

Additionally, the script now contains a function called delete_expired_at_jobs
to check and delete expired 'at' jobs. The current time is obtained using the
'date' command and stored in the variable current_time.
2023-12-05 18:00:34 +01:00
2ce472fa08
Funktion: prüfen ob Wecker am Handy aus, gefixt 2023-11-28 08:32:25 +01:00
e5a4a74da5
Enable light in check_ip function 2023-11-25 11:15:26 +01:00
96e857a4cf
Commit: Fix check_notification condition and add check_external_light_status
1. Added a new function `check_external_light_status` to check if the light is turned off externally.

2. Modified the condition in the `check_notification` function to correctly check if the notification contains "[1]" and the specified strings.

3. Corrected the assignment statement inside the `while` loop. Changed `first_brightness_cmason.nvimhange=false` to `first_brightness_change=false`.
2023-11-25 09:58:53 +01:00
fcc070e03d
Gefixt: schritte wurden nicht reichtig berechnet 2023-11-25 07:15:55 +01:00
16bf50bbb3
Check, ob Wecker am handy beendet wurde, wird nun erst ab dem Farbwechsel durchgeführt. 2023-11-25 06:53:50 +01:00
c872f1d93d
Funktion zum erfassen der Weckzeit gefixt 2023-11-25 06:49:05 +01:00
8a9dea2d71
Funktion zum licht ausschalten, wenn wecker am handy beendet 2023-11-22 12:27:46 +01:00
5d21fb28c1
Fehlerbehebung bei ping-test 2023-11-22 12:26:43 +01:00
7d9c3574a4
Mac-Adresse gekürzt für ip-Abfrage 2023-11-21 09:18:11 +01:00
1d27119800
checkt ip von a72 2023-11-21 08:49:34 +01:00
94dee024a4
wecker.sh checkt ip von a72 2023-11-19 18:45:14 +01:00
c34f28302e
initial commit 2023-11-16 09:17:08 +01:00
faec77d6eb Initial commit 2023-11-16 07:56:53 +00:00