Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # IP address
- ip="192.168.0.172:2025"
- if [ "$1" = "Get" ]; then
- case "$3" in
- CurrentTemperature )
- echo $(curl -s http://$ip/getSystemData | jq '.aircons.ac1.zones.z01.measuredTemp')
- ;;
- TargetTemperature )
- echo $(curl -s http://$ip/getSystemData | jq '.aircons.ac1.info.setTemp')
- ;;
- TemperatureDisplayUnits )
- echo 0
- ;;
- CurrentHeatingCoolingState )
- if [ $(curl -s http://$ip/getSystemData | jq '.aircons.ac1.info.mode') = '"cool"' ]; then
- echo 2
- elif [ $(curl -s http://$ip/getSystemData | jq '.aircons.ac1.info.mode') = '"heat"' ]; then
- echo 1
- else
- echo 0
- fi
- ;;
- #damper open/closed = switch on/off = 1/0
- On )
- if [ $(curl -s http://$ip/getSystemData | jq '.aircons.ac1.zones.z01.state') = '"open"' ]; then
- echo 1
- else
- echo 0
- fi
- ;;
- esac
- fi
- if [ "$1" = "Set" ]; then
- case "$3" in
- TargetHeatingCoolingState )
- case "$4" in
- 0 )
- curl -g http://$ip/setAircon?json={"ac1":{"info":{"state":"off"}}}
- ;;
- 1 )
- curl -g http://$ip/setAircon?json={"ac1":{"info":{"state":"on"",""mode":"heat"}}}
- ;;
- 2 )
- curl -g http://$ip/setAircon?json={"ac1":{"info":{"state":"on"",""mode":"cool"}}}
- ;;
- esac
- ;;
- TargetTemperature )
- curl -g http://$ip/setAircon?json={"ac1":{"info":{"setTemp":"$4"}}}
- ;;
- On )
- if [ "$4" = "true" ]; then
- curl -g http://$ip/setAircon?json={"ac1":{"zones":{"z01":{"state":"open"}}}}
- else
- curl -g http://$ip/setAircon?json={"ac1":{"zones":{"z01":{"state":"close"}}}}
- fi
- ;;
- esac
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement