Compare commits

..

6 Commits

Author SHA1 Message Date
6b20f31fc2
Enhance play.sh script for volume adjustment
This commit includes improvements to the 'play.sh' script:
- Added a 'while' loop for volume 100, ensuring continuous playback with the specified volume.
- Changed the volume increment loop to start from volume 20 and increase by 10 in each iteration.
- Improved comments and formatting in the script.

The changes aim to enhance the script's functionality by addressing volume-related issues and providing better clarity in the script structure.
2024-02-13 09:52:16 +01:00
fd6dd6f9bf
Refactor generate_text.sh script
This commit includes changes to the 'generate_text.sh' script:
- Updated the 'rm' command to recursively remove files in the text directory using 'rm -rf'.
- Improved comments and formatting in the script.

The changes aim to enhance the script by ensuring a more thorough removal of files in the text directory and improving overall script readability.
2024-02-13 09:51:25 +01:00
b67b4a657b
Update generate_mp3.sh script
This commit includes changes to the 'generate_mp3.sh' script:
- Removed the commented-out command to open 'handout.md' file.
- Updated the command to open 'handout.html' file using 'am start'.
- Improved comments and formatting in the script.

The changes aim to enhance the script by removing unnecessary code and improving readability.

Note: Ensure that the 'am start' command works as expected with the updated file path.
2024-02-13 09:50:36 +01:00
e8599fda30
Update wecker.sh script
This commit includes changes to the 'wecker.sh' script:
- Added '&' to run 'killall mpv' command in the background to avoid blocking.
- Modified the invocation of 'rgb.sh' to redirect output to /dev/null and run it in the background.
- Improved comments and formatting in the script.

These changes aim to optimize script execution and enhance readability.

Note: Ensure that the 'rgb.sh' script runs as expected in the background.
2024-02-13 09:48:10 +01:00
5224de0d20
Refactor alarm script and integrate RGB control
This commit refactors the 'wecker.sh' script to enhance functionality and integrate RGB control.

Changes:
- Removed redundant color variables (red, green, blue) as RGB control is now managed by an external script.
- Replaced 'set_color' function with a call to the 'rgb.sh' script for RGB control.
- Introduced the use of 'pkill rgb.sh' to stop the RGB script when the alarm is turned off.
- Added the execution of 'rgb.sh' at the end of the script for dynamic color cycling.
- Enhanced code readability and removed unnecessary sleep commands for color cycling.
- Modified the 'check_notification' function to ensure proper termination of the RGB script.

Usage:
1. Ensure the 'rgb.sh' script is available in the specified path.
2. Run the 'wecker.sh' script to manage alarms with integrated RGB control.

Note: Adjust the paths and dependencies based on your system configuration and requirements.
2024-02-09 08:37:27 +01:00
987469140e
Initial commit for RGB Cycling Script
This commit introduces the RGB Cycling Script for the ioBroker Zigbee Adapter.
The script is designed to cycle through RGB colors on an ioBroker device using a zigbee adapter.

Author: Michael Haider

Description:
- The script defines RGB colors: red, green, and blue.
- A function 'set_color' is created to set the color on the ioBroker device.
- The main loop continuously cycles through the colors: green, red, and blue.
- Instructions are provided in the script header to replace the ioBroker address for controlling the color.

Usage:
1. Ensure the script has execution permissions (chmod +x rgb.sh).
2. Replace 'zigbee.0.04cd15fffee03198.color' with the actual ioBroker address for color control.
3. Run the script to start cycling through RGB colors.

Note: Adjust the sleep intervals or uncomment the sleep commands based on your preferences.
2024-02-09 08:35:24 +01:00
5 changed files with 54 additions and 25 deletions

View File

@ -26,8 +26,7 @@ mp3_dir="/sdcard/.mp3"
# remove old files
rm -f "$txt_dir"/*complete.txt
# open handout.md file
#am start --user 0 -a android.intent.action.VIEW -d content://pl.solidexplorer2.files/storage/emulated/0/.text/handout.html -t text/html
# open handout.html file
am start --user 0 -n org.bromite.chromium/org.chromium.chrome.browser.ChromeTabbedActivity -d content://pl.solidexplorer2.files/storage/emulated/0/.text/handout.html -t text/html
# Function to create MP3 files

View File

@ -14,7 +14,7 @@ html_file="$text_dir/handout.html"
all=("date" "time" "weather") # Add more elements as needed
# remove files in text_dir
rm -f $text_dir/*
rm -rf $text_dir/*
# Function to get the IP address of Lisa's iPhone
check_ip() {

View File

@ -21,6 +21,10 @@ for ((volume = 20; volume <= 100; volume += 10)); do
# Wait for the completion of the current mpv process before starting the next one
wait
while [[ volume == 100 ]]; do
/data/data/com.termux/files/usr/bin/mpv --replaygain=track --volume="$volume" /data/scripts/your-new-morning-alarm.ogg &
done
done
# End of the script

39
rgb.sh Normal file
View File

@ -0,0 +1,39 @@
#!/bin/bash
#
# RGB Cycling Script for ioBroker Zigbee Adapter
# Author: Michael Haider
# Description: This script cycles through RGB colors on an ioBroker device
# using a zigbee adapter.
# Instructions: Replace 'zigbee.0.04cd15fffee03198.color' with the actual
# ioBroker address for controlling the color.
#
# Colors
red="ff0000"
green="00ff00"
blue="0000ff"
# Function to set the color on the ioBroker device
set_color() {
local color_value=$1
iobroker state set zigbee.0.04cd15fffee03198.color "$color_value"
}
# Main loop to cycle through colors
while true; do
# Set the color to green
set_color "$green"
echo "Color set to green"
#sleep 1
# Set the color to red
set_color "$red"
echo "Color set to red"
#sleep 1
# Set the color to blue
set_color "$blue"
echo "Color set to blue"
#sleep 1
done

View File

@ -34,11 +34,6 @@ done
# Adjust brightness and color temperature in ioBroker
# Colors
red="ff0000"
green="00ff00"
blue="0000ff"
iobroker state set zigbee.0.04cd15fffee03198.state false
iobroker state set zigbee.0.04cd15fffee03198.brightness 1
iobroker state set zigbee.0.04cd15fffee03198.colortemp 1600
@ -58,12 +53,6 @@ set_colortemp() {
echo "Current Colortemp: $colortemp_value"
}
set_color() {
local color_value=$1
# Replace 'zigbee.0.04cd15fffee03198.color' with the actual ioBroker address for color
iobroker state set zigbee.0.04cd15fffee03198.color "$color_value"
}
# Get the IP address of Lisa's iPhone (without ping test)
check_ip() {
mac_address="e4:cd:d1" # Replace this with the MAC address
@ -136,8 +125,9 @@ check_notification() {
# Alarm turned off
date && echo "Alarm turned off."
echo "$output"
ssh -i /root/.ssh/A72 root@$A72_ip 'killall mpv'
pkill rgb.sh # Kill the rgb.sh script
iobroker state set zigbee.0.04cd15fffee03198.state false
ssh -i /root/.ssh/A72 root@$A72_ip 'killall mpv' &
/root/iobroker_scripts/general/generate_text.sh # Call generate_text.sh script
exit # Exit the script when the alarm is turned off
else
@ -149,7 +139,7 @@ check_notification() {
fi
done
# Phone could not be reached.
# Phone could not be reached.
echo "Phone could not be reached after $max_attempts attempts."
date && echo "Alarm turned off."
ssh -i /root/.ssh/A72 root@$A72_ip 'killall mpv'
@ -229,6 +219,8 @@ current_colortemp="$end_colortemp"
set_brightness "$end_brightness"
set_colortemp "$end_colortemp"
/root/iobroker_scripts/schlafzimmer/rgb.sh >/dev/null & # Call the rgb.sh script
# Execute the check_ip function.
check_ip
echo "$A72_ip"
@ -272,17 +264,12 @@ if [ $current_brightness -eq $end_brightness ] && [ $current_colortemp -eq $end_
fi
else
check_external_light_status
set_color "$green"
sleep 5
set_color "$red"
sleep 5
set_color "$blue"
check_notification #&
fi
if [ "$alarm_dismissed" = true ]; then
echo "Alarm dismissed"
exit # Exit the script when the alarm is dismissed
fi
if [ "$alarm_dismissed" = true ]; then
echo "Alarm dismissed"
exit # Exit the script when the alarm is dismissed
fi
done
fi