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.
This commit is contained in:
parent
122fdc6669
commit
53000fc607
24
wecker.sh
24
wecker.sh
@ -10,8 +10,8 @@
|
|||||||
# Customizable settings:
|
# Customizable settings:
|
||||||
# - Adjust ioBroker brightness and color temperature commands
|
# - Adjust ioBroker brightness and color temperature commands
|
||||||
|
|
||||||
set -e # Stop the script on errors
|
#set -e # Stop the script on errors
|
||||||
set -x # Enable debugging # Uncomment for a more detailed log
|
#set -x # Enable debugging # Uncomment for a more detailed log
|
||||||
|
|
||||||
# Debug
|
# Debug
|
||||||
debug=false
|
debug=false
|
||||||
@ -41,6 +41,26 @@ iobroker state set zigbee.0.04cd15fffee03198.brightness 1
|
|||||||
iobroker state set zigbee.0.04cd15fffee03198.colortemp 1600
|
iobroker state set zigbee.0.04cd15fffee03198.colortemp 1600
|
||||||
iobroker state set zigbee.0.04cd15fffee03198.state true
|
iobroker state set zigbee.0.04cd15fffee03198.state true
|
||||||
|
|
||||||
|
set_brightness() {
|
||||||
|
local brightness_value=$1
|
||||||
|
# Replace 'zigbee.0.04cd15fffee03198.brightness' with the actual ioBroker address for brightness
|
||||||
|
iobroker state set zigbee.0.04cd15fffee03198.brightness "$brightness_value"
|
||||||
|
echo "Current brightness: $brightness_value"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_colortemp() {
|
||||||
|
local colortemp_value=$1
|
||||||
|
# Replace 'zigbee.0.04cd15fffee03198.colortemp' with the actual ioBroker address for color temperature
|
||||||
|
iobroker state set zigbee.0.04cd15fffee03198.colortemp "$colortemp_value"
|
||||||
|
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)
|
# Get the IP address of Lisa's iPhone (without ping test)
|
||||||
check_ip() {
|
check_ip() {
|
||||||
mac_address="e4:cd:d1" # Replace this with the MAC address
|
mac_address="e4:cd:d1" # Replace this with the MAC address
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user