Version 0.9.1
#!/bin/ksh
#set a scene. E.g. "at_home"
#variabeln
scene=${1:?"$1 Must be a valid scene name"}
#get base dir
BASEDIR=$(dirname "$0")
if [ -L $0 ] ; then
BASEDIR=$(dirname $(readlink -f "$0"))
fi
#config
if [ -e "$BASEDIR/../config.conf" ]; then
. "$BASEDIR/../config.conf"
else
echo "No config found at: $BASEDIR/../config.conf"
fi
function wLog {
log="${logdir}/set_scene.log"
date=$(date "+%Y-%m-%d_%H:%M:%S.%N")
echo "$date $USER $1 $2 $3 $4 $5 $6 $7 $8 $9" >> "$log"
}
case "$scene" in
"at_home")
;;
"go2bed")
wLog "go2bed"
#"$shdir/_get/turn_off.sh" "RXV779" #RXV779
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_7-0-37" #WZ Power 1.switchBinary
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_9-0-67-1" #BZ Heat 1.thermostat
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_13-0-67-1" #WZ Heat 1.thermostat
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_14-0-67-1" #WZ Heat 2.thermostat
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_15-0-67-1" #WZ Heat 3.thermostat
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_16-0-67-1" #WZ Heat 4.thermostat
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_12-0-38" #WZ Lamp 1 Dimmer
;;
"wz_heat_on")
wLog "wz_heat_on"
#"$shdir/_get/turn_on.sh" "ZWayVDev_zway_13-0-67-1" #WZ Heat 1.thermostat
#"$shdir/_get/turn_on.sh" "ZWayVDev_zway_14-0-67-1" #WZ Heat 2.thermostat
#"$shdir/_get/turn_on.sh" "ZWayVDev_zway_15-0-67-1" #WZ Heat 3.thermostat
#"$shdir/_get/turn_on.sh" "ZWayVDev_zway_16-0-67-1" #WZ Heat 4.thermostat
;;
"wz_heat_off")
wLog "wz_heat_off"
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_13-0-67-1" #WZ Heat 1.thermostat
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_14-0-67-1" #WZ Heat 2.thermostat
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_15-0-67-1" #WZ Heat 3.thermostat
#"$shdir/_get/turn_off.sh" "ZWayVDev_zway_16-0-67-1" #WZ Heat 4.thermostat
;;
"watch_movie")
wLog "watch_movie"
#"$shdir/_get/set_device.sh" "ZWayVDev_zway_7-0-37" "on" #WZ Power 1.switchBinary
#"$shdir/_get/set_device.sh" "ZWayVDev_zway_13-0-67-1" "20" #WZ Heat 1.thermostat
#"$shdir/_get/set_device.sh" "ZWayVDev_zway_14-0-67-1" "20" #WZ Heat 2.thermostat
#"$shdir/_get/set_device.sh" "ZWayVDev_zway_15-0-67-1" "23" #WZ Heat 1.thermostat
#"$shdir/_get/set_device.sh" "ZWayVDev_zway_16-0-67-1" "23" #WZ Heat 1.thermostat
#"$shdir/_get/set_device.sh" "ZWayVDev_zway_12-0-38" "50" #WZ Lamp 1 Dimmer
sleep 2
#"$shdir/_get/set_rxv779.sh" "power" "On"
#"$shdir/_get/set_rxv779.sh" "volume" -320
#"$shdir/_get/set_rxv779.sh" "input" "HDMI1"
#"$shdir/_get/set_rxv779.sh" "audio_type" "Spectacle"
;;
*)
echo "Unknown scene $1 $2 $3 $4 $5 $6 $7 $8 $9 $10"
wLog "unknown_scene" $1 $2 $3 $4 $5 $6 $7 $8 $9 $10
exit 1
;;
esac