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:
Ratatoskr 2024-01-27 00:21:00 +01:00
parent 122fdc6669
commit 53000fc607
Signed by: Ratatoskr
GPG Key ID: 28B77439A6D78F4E

View File

@ -10,8 +10,8 @@
# Customizable settings:
# - Adjust ioBroker brightness and color temperature commands
set -e # Stop the script on errors
set -x # Enable debugging # Uncomment for a more detailed log
#set -e # Stop the script on errors
#set -x # Enable debugging # Uncomment for a more detailed log
# Debug
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.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)
check_ip() {
mac_address="e4:cd:d1" # Replace this with the MAC address