I’m looking to slowly ramp up the volume on my receiver as a wake up alarm in combination withe the Wake Up Light app. I have a trigger to turn off the wake up light when I hit one of the light switches, and I similarly want to stop executing my luup code based on a trigger - is there a way to do this? Eg. exit luup code and turn off receiver when Wake Up Light turns off.
I’m also trying to send HTTP commands to my receiver with different volumes, but I need to put a string into the http send. Is there a way to concatenate a string and a number and then send that as an http command? The code below will hopefully clear things up.
Any help would be appreciated!
local http = require("socket.http")
local minVolume = 0
local maxVolume = 32
local timeSteps = 100
local minVolumeScaled
local maxVolumeScaled
local newVolume
minVolumeScaled = minVolume -80
maxVolumeScaled = maxVolume - 80
volumeIncrement = (maxVolumeScaled - minVolumeScaled)/timeSteps
--Turn on music
sendVC("iTunes.SetShuffleLoad&&true")
sendVC("iTunes.rqPlaylist&&Wake Up")
sendVC("Window.Focus&&iTunes")
--Turn on receiver and set to right inputs
socket.http.request("http://192.168.1.72/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON")
socket.http.request("http://192.168.1.72/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/-48.0")
socket.http.request("http://192.168.1.72/MainZone/index.put.asp?cmd0=PutZone_InputFunction%2FMPLAY")
socket.http.request("http://192.168.1.72/MainZone/index.put.asp?cmd0=PutSurroundMode%2FMUSIC&cmd1=aspMainZone_WebUpdateStatus%2F")
--Slowly ramp volume
for i=1:timeSteps
newVolume = newVolume + volumeIncrement
--Need to put in the new volume in this string
socket.http.request("http://192.168.1.72/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/-48.0")
--Insert delay here
end