integrate OpenHab

master
pidor 2019-04-12 01:05:22 +02:00
parent 2ff6641898
commit 6ff6d2e5ca
4 changed files with 25 additions and 1 deletions

View File

@ -5,10 +5,12 @@ BEAMERIP=$(cat $(dirname "$0")"/beamerip.txt")
function raisescreen() {
echo "Rolling projection screen up"
ssh pi@doorbuzz 'doorbuzz/projectionscreen.sh up'
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://10.2.113.102:8080/rest/items/chill_zone_screen_button_up"
}
function lowerscreen() {
echo "Rolling projection screen down"
ssh pi@doorbuzz 'doorbuzz/projectionscreen.sh down'
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://10.2.113.102:8080/rest/items/chill_zone_screen_button_down"
}
function beamerquery() {
signalsource="$(wget -qO - 'http://'"$projip"'/tgi/return.tgi?query=info' |awk -F'[<>]' '/<info>/{print substr($3,33,2)}')"

View File

@ -3,6 +3,7 @@ BEAMERIP=$(cat $(dirname "$0")"/beamerip.txt")
function raisescreen() {
echo "Rolling projection screen up"
ssh pi@doorbuzz 'doorbuzz/projectionscreen.sh up'
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://10.2.113.102:8080/rest/items/chill_zone_screen_button_up"
}
function pingall() {
i=1

View File

@ -43,8 +43,10 @@ function dolight() {
if [ "$2" = "on" ]
then
setvalue=1
mqtt_command=ON
else
setvalue=0
mqtt_command=OFF
fi
case "$1" in
all) dolight "main" $2
@ -52,16 +54,27 @@ function dolight() {
dolight "labsocket" $2
dolight "3dprinter" $2
dolight "alarm" $2
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$mqtt_command" "http://10.2.113.102:8080/rest/items/engineering_table_lamps"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$mqtt_command" "http://10.2.113.102:8080/rest/items/engineering_ceiling_lamps"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$mqtt_command" "http://10.2.113.102:8080/rest/items/engineering_status_lamp"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$mqtt_command" "http://10.2.113.102:8080/rest/items/chill_zone_lamps"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$mqtt_command" "http://10.2.113.102:8080/rest/items/entrance_ceiling_lamps"
;;
main) IRcmd 2 1A 1 "$setvalue"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$mqtt_command" "http://10.2.113.102:8080/rest/items/entrance_ceiling_lamps"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$mqtt_command" "http://10.2.113.102:8080/rest/items/chill_zone_lamps"
if [ "$setvalue" = "0" ] # switch off alarm light when switching off all lights
then
IRcmd2 15A 1 "$setvalue"
fi
;;
chill) IRcmd 2 1A 2 "$setvalue"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$mqtt_command" "http://10.2.113.102:8080/rest/items/chill_zone_lamps"
;;
status) IRcmd 2 2A 1 "$setvalue"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$mqtt_command" "http://10.2.113.102:8080/rest/items/engineering_status_lamp"
;;
labsocket) IRcmd 2 15A 6 "$setvalue"
;;
@ -94,5 +107,5 @@ function dolight() {
#/usr/local/bin/433send 2 1A 1 0 #off
}
logger -t $(basename $0) "$$ $1 $2"
logger -t $(basename $0) "do $$ $1 $2"
dolight "$1" "$2"

View File

@ -17,6 +17,10 @@ then
# /usr/local/bin/433send 2 $j $i 0 #off
# done
# done
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "OFF" "http://10.2.113.102:8080/rest/items/engineering_table_lamps"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "OFF" "http://10.2.113.102:8080/rest/items/engineering_ceiling_lamps"
logger -t $(basename $0) "all lights should be off now"
fi
if [ "$1" = "released" ]
@ -31,6 +35,10 @@ if [ "$1" = "released" ] # && # the door has been opened
then
#( [ "$(date +%H)" -gt 18 ] || [ "$(date +%H)" -lt 8 ] )
logger -t $(basename $0) "switching some lights on"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://10.2.113.102:8080/rest/items/engineering_table_lamps"
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://10.2.113.102:8080/rest/items/engineering_ceiling_lamps"
$(dirname "$0")/../lightcommander main on
# /usr/local/bin/433send 2 1A 1 1 #on
fi