Page 6 of 6
Re: Simple LMS LUA volume dimmer
Posted: Wednesday 09 November 2016 7:18
by Nautilus
simon_rb wrote:Working working working
THANK YOU!
Same issue here with the 1% out with Siri, and the slider within the native home app will always jump back down 1% when you release. I have noticed a couple of times when I have turn my 'Lounge Touch V' it has gone to 99% That could be a problem. I noticed you haven't used the uservariables in your scripts. Have you noticed this behaviour?
I use Eve, not the native home app (except the widget) but I can check at some point. In Eve I don't see this behavior (jump back to 1% nor 99%), though if I move the slider, it will send multiple values (move slider from 20->50, around 15 values are sent) and as it reacts both ways (changes in Domoticz as well), the slider moves quite slowly, it takes couple of seconds as it goes through each step. In Domoticz web UI or e.g. iPhone Pilot app this does not happen, must be homekit / homebridge related thing.
I Don't need the uservariable as when the terrace player turn on, I always set it to 60% volume (which will be sent to the dimmer as well) so there is no need to store the volume level for turning the player back On (after it has been Off).
Re: Simple LMS LUA volume dimmer
Posted: Wednesday 09 November 2016 7:39
by simon_rb
Nautilus wrote:I Don't need the uservariable as when the terrace player turn on, I always set it to 60% volume (which will be sent to the dimmer as well) so there is no need to store the volume level for turning the player back On (after it has been Off).
Is that done within domoticz or is there an option on the s side that sets player to 60%. Might be an idea for me to do the same
I only use the widget from the quick slide up fav thing.
Re: Simple LMS LUA volume dimmer
Posted: Wednesday 09 November 2016 8:58
by Nautilus
I'm using Domoticz for, not sure if there is something on the LMS side.
Code: Select all
if ((devicechanged['Musiikki terassi'] == 'On' or devicechanged['Musiikki terassi'] == 'Playing') and uservariables['SBTerassiStatus'] == 'Off') then
commandArray[#commandArray+1]={['Variable:SBTerassiStatus'] = 'On'}
commandArray[#commandArray+1]={['Musiikki terassi']='Set Volume 60'}
end
Here I use the uservariable 'SBTerassiStatus' to avoid the volume setting happening if the status changes for some reason between 'On' and 'Playing' but not needed necessarily.
Re: Simple LMS LUA volume dimmer
Posted: Wednesday 09 November 2016 11:49
by simon_rb
Do you add that script above as a new script or add it to the existing one?
Re: Simple LMS LUA volume dimmer
Posted: Wednesday 09 November 2016 13:36
by Nautilus
simon_rb wrote:Do you add that script above as a new script or add it to the existing one?
It is on my device script, here's the whole thing in current form:
Code: Select all
commandArray = {}
if ((devicechanged['Musiikki terassi'] == 'On' or devicechanged['Musiikki terassi'] == 'Playing') and uservariables['SBTerassiStatus'] == 'Off') then
commandArray[#commandArray+1]={['Variable:SBTerassiStatus'] = 'On'}
commandArray[#commandArray+1]={['Musiikki terassi']='Set Volume 60'}
os.execute('curl -s "http://url/json.htm?type=command¶m=switchlight&idx=314&switchcmd=Set%20Level&level=61" &')
elseif (devicechanged['Musiikki terassi'] == 'Off' or devicechanged['Musiikki terassi'] == 'Stopped' or devicechanged['Musiikki terassi'] == 'Disconnected') then
if otherdevices['Terassin äänenvoimakkuus'] ~= 'Off' then
commandArray[#commandArray+1]={['Terassin äänenvoimakkuus'] = 'Off'}
end
commandArray[#commandArray+1]={['Variable:SBTerassiStatus'] = 'Off'}
end
if devicechanged['Terassin äänenvoimakkuus'] ~= 'Off' and devicechanged['Terassin äänenvoimakkuus'] ~= nil then
if tonumber(otherdevices_svalues['Terassin äänenvoimakkuus']) > 0 then
volume = otherdevices_svalues['Terassin äänenvoimakkuus']
commandArray['Musiikki terassi']='Set Volume '..volume
end
end
Re: Simple LMS LUA volume dimmer
Posted: Wednesday 09 November 2016 15:15
by simon_rb
Working like a dream.. Hopefully we are all sorted! Thank you for helping me bring an idea to life lol!
Cheers
Re: Simple LMS LUA volume dimmer
Posted: Friday 11 November 2016 10:08
by simon_rb
My issue with the dimmers going to 100% when turned on has been fixed thanks to TheRamon, think it was the way edomoticz cached the values from domoticz. Excellent!
Re: Simple LMS LUA volume dimmer
Posted: Wednesday 16 November 2016 20:06
by simon_rb
Is there a way to send
http://192.168.1.26:8080/json.htm?type= ... l&level=50 for example without the witch sending an on command? Should be able to work around it but each time it fires an On command doesn't show up in the log though..
For the time being I'm running a Lua script that if it detects the change then it'll run the bash script that used to run when the amp turned on...
Simple LMS LUA volume dimmer
Posted: Sunday 11 December 2016 15:27
by G3rard
Here is my LUA code for the Sonos volume dimmer (as promised in an earlier post).
I am using
https://github.com/gerard33/sonos for controlling the Sonos. So the LUA code is depending on that.
So if you don't use that, you have to find another way to update and read the volume on the Sonos.
Sonos kantoor volume = the volume dimmer
Device script
Code: Select all
commandArray = {}
if devicechanged['Sonos kantoor volume'] then
targetvolume = otherdevices_svalues['Sonos kantoor volume']
--divide by 2, math.ceil(number) and math.floor(number) rounds up and down respectively
--targetvolume = math.ceil(targetvolume / 5)
targetvolume = math.floor((targetvolume / 5) + 0.5) --volume on silder 20 => becomes 4 on Sonos
--print(targetvolume)
local vol_kantoor = 'curl --url "http://127.0.0.1/fp/sonos/index.php?zone=115&action=Setvol&volume=' .. targetvolume .. '" &'
os.execute(vol_kantoor)
end
return commandArray
Time script
Code: Select all
commandArray = {}
--compare volume Sonos kantoor and update it in Domoticz without triggering to avoid loop
--this is done by using commandArray['UpdateDevice']
if otherdevices['Sonos kantoor'] == 'On' then
local domo_volume = otherdevices_svalues['Sonos kantoor volume']
local actual_volume = execute('curl --url "http://127.0.0.1/fp/sonos/index.php?zone=115&action=GetVolume" &')
local idx_sonos_kantoor_volume = '409'
--remove spaces and zero
actual_volume = actual_volume:gsub("%s+", "")
actual_volume = actual_volume:gsub("0", "")
--print(actual_volume)
if tonumber(actual_volume) ~= nill then --if volume is 0 then php gives '0 0' but both nulls are replace with ""
--do volume times 5 so slider is more logical
actual_volume = tonumber(actual_volume) * 5
end
--print('volume domo: ' .. domo_volume)
--print('volume sonos: ' .. actual_volume)
--update volume if sonos is on and volume differs
if (tonumber(domo_volume) ~= tonumber(actual_volume)) then
commandArray['UpdateDevice'] = otherdevices_idx['Sonos kantoor volume'] ..'|2|' .. actual_volume
end
end
Re: Simple LMS LUA volume dimmer
Posted: Saturday 28 January 2017 15:14
by pvklink
Is there a way to put the ip-adress in a parameter like
IP=''127.0.0.1'
and change the below rule to use the IP parameter ?
<part of a script>
local vol_kantoor = 'curl --url "
http://127.0.0.1/fp/sonos/index.php?zon ... ol&volume=' .. targetvolume .. '" &'
os.execute(vol_kantoor)
Re: Simple LMS LUA volume dimmer
Posted: Saturday 28 January 2017 15:29
by jvdz
You mean like this?:
Code: Select all
IP='127.0.0.1'
local vol_kantoor = 'curl --url "http://'..IP..'/fp/sonos/index.php?zone=115&action=Setvol&volume=' .. targetvolume .. '" &'
os.execute(vol_kantoor)
Jos
Re: Simple LMS LUA volume dimmer
Posted: Saturday 28 January 2017 17:46
by pvklink
Works great!
1) When i put the receiver on, this script default sets the receiver to RADIO
2) I also have a switch Mode with options like CD, RADIO etc.
I want the switch MODE set to RADIO so that this switch values matches with the settings that i mentioned at 1)
I tried this but i doesnt work:
commandArray['Denon mode'] = "fmradio" (this is one of the options in this selector switch)
commandArray = {}
IP = '192.168.178.176' --IP of denon
DEV='Denon aanuit'
MAXLEVEL=50
-- default zender lukt niet en switch waarde default zetten
if devicechanged[DEV] == 'On' then
local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON" &' --aan
os.execute(play)
local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutZone_InputFunction/TUNER" &' --radio aan
os.execute(play)
commandArray['Denon mode'] = "fmradio"
elseif devicechanged[DEV] == 'Off' then
local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FOFF" &' --uit
--local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutVolumeMute%2Fon" &' --mute
os.execute(play)
end
if devicechanged[DEV] then
NewLevel = otherdevices_svalues[DEV]
if NewLevel ~= "Off" and NewLevel ~= "0" then
if tonumber(NewLevel) > MAXLEVEL then --volume maxlevel
NewLevel = MAXLEVEL
end
SendLevel = NewLevel - 80 --79.5
os.execute ("curl http://" .. (IP) .. "/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/" .. (SendLevel))
end
end
return commandArray
Re: Simple LMS LUA volume dimmer
Posted: Monday 30 January 2017 20:03
by simon_rb
Instead of ['Denon mode'] = "fmradio" try the percentage it is.. like Level 10 or level 20 so on and so on..
Sent from my iPhone using Tapatalk
Re: Simple LMS LUA volume dimmer
Posted: Monday 30 January 2017 20:11
by pvklink
Works great!
commandArray = {}
IP = '192.168.178.176' --IP of denon
IPTV = '192.168.178.13' --IP of tv
DEV='Denon aanuit'
MAXLEVEL=50
if devicechanged[DEV] == 'On' then
local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON" &'
os.execute(play)
ping_success=os.execute('ping -c1 192.168.178.13')
if ping_success then
otherdevices_svalues['Denon mode'] = "20"
else
otherdevices_svalues['Denon mode'] = "10"
end
elseif devicechanged[DEV] == 'Off' then
local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FOFF" &' -- oud local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutVolumeMute%2Fon" &' --mute
os.execute(play)
end
if devicechanged[DEV] then
NewLevel = otherdevices_svalues[DEV]
if NewLevel ~= "Off" and NewLevel ~= "0" then
if tonumber(NewLevel) > MAXLEVEL then --volume maxlevel
NewLevel = MAXLEVEL
end
SendLevel = NewLevel - 80 --79.5
os.execute ("curl http://" .. (IP) .. "/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/" .. (SendLevel))
end
end
return commandArray
Re: Simple LMS LUA volume dimmer
Posted: Thursday 14 September 2017 15:18
by zwaffie
I'am confused.
Can someone give me a step by step description for how to use this?
I don't get any results with the many scripts in this thread.
I got 6 divices
AmmoBox (LMS speaker)
BoomZero (LMS speaker)
Woonkamer (LMS speaker)
VolumeAmmoBox (dimmer)
VolumeBoomzero (dimmer)
VolumeWoonkamer (dimmer)
Let we start with one.
How can I control the volume of my AmmoBox lms speaker?
Which scripts will be the correct one?
I hope someone will help me.
gr,
Sven