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.
This commit is contained in:
parent
987469140e
commit
5224de0d20
21
wecker.sh
21
wecker.sh
@ -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
|
||||
@ -229,6 +219,8 @@ current_colortemp="$end_colortemp"
|
||||
set_brightness "$end_brightness"
|
||||
set_colortemp "$end_colortemp"
|
||||
|
||||
/root/iobroker_scripts/schlafzimmer/rgb.sh # Call the rgb.sh script
|
||||
|
||||
# Execute the check_ip function.
|
||||
check_ip
|
||||
echo "$A72_ip"
|
||||
@ -272,11 +264,6 @@ 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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user