Code: Select all
print('----------------------')
print(vol_tv)
print('----------------------')
I get an overview of all values (without XML layout due to the log I think).
Moderators: leecollings, remb0
Code: Select all
print('----------------------')
print(vol_tv)
print('----------------------')
Eh?!?! Sorry I'm still learning all this stuff..G3rard wrote:Good to hear it's working![]()
I update the dimmer with the commandArray['UpdateDevice'] command. That means that the % is updated, without actually firing the LUA command which is update the volume.
I do that to prevent potential loops in volume updates.
The only thing the is that the percentage is being updated, but the sliders isn't. For me that is no problem.
If there are no volume loops to be expected you can update the dimmer via JSON and then the slider will be at the right place.
Code: Select all
commandArray = {}
function execute(command)
-- returns success, error code, output.
local f = io.popen(command..' 2>&1 && echo " $?"')
local output = f:read"*a"
return output
end
--read xml and remove value strings
--<MasterVolume><value>-60.0</value></MasterVolume> becomes -60.0
function get(data,name)
data = data:match("<"..name..">(.-)</"..name..">")
data = data:gsub("<value>", "")
data = data:gsub("</value>", "")
return data
end
vol_tv = execute('curl --url "http://192.168.1.12/goform/formMainZone_MainZoneXml.xml" &')
--get volume of TV and update volume switch in Domoticz if it differs
local vol_tv = get(vol_tv,"MasterVolume")
local vol_domo = otherdevices_svalues['Denon Volume']
print(vol_tv)
vol_tv = tonumber(vol_tv) + 80
print(vol_tv)
if otherdevices['Denon Volume'] ~= 'Off' then
if (vol_domo ~= vol_tv) then
--commandArray['UpdateDevice'] = otherdevices_idx['Denon Volume'] ..' |2|' .. vol_tv
os.execute('curl -s "http://192.168.1.26:8080/json.htm?type=command¶m=switchlight&idx=284&switchcmd=Set%20Level&level='..vol_tv..'" &')
end
end
return commandArray
Code: Select all
commandArray = {}
function execute(command)
-- returns success, error code, output.
local f = io.popen(command..' 2>&1 && echo " $?"')
local output = f:read"*a"
return output
end
--read xml and remove value strings
--<MasterVolume><value>-60.0</value></MasterVolume> becomes -60.0
function get(data,name)
data = data:match("<"..name..">(.-)</"..name..">")
data = data:gsub("<value>", "")
data = data:gsub("</value>", "")
return data
end
vol_tv = execute('curl --url "http://192.168.1.12/goform/formMainZone_MainZoneXml.xml" &')
--get volume of TV and update volume switch in Domoticz if it differs
local vol_tv = get(vol_tv,"MasterVolume")
local vol_domo = otherdevices_svalues['Denon Volume']
print(vol_tv)
vol_tv = tonumber(vol_tv) + 80
print(vol_tv)
if otherdevices['Denon Volume'] ~= 'Off' then
--if (vol_domo ~= vol_tv) then
difference = math.abs(vol_domo - vol_tv)
if difference > 1 then
--commandArray['UpdateDevice'] = otherdevices_idx['Denon Volume'] ..' |2|' .. vol_tv
os.execute('curl -s "http://192.168.1.26:8080/json.htm?type=command¶m=switchlight&idx=284&switchcmd=Set%20Level&level='..vol_tv..'" &')
end
end
return commandArray
Hehe, I'm having issues trying to get the values to match.. Like setting it to 65% will set receiver to 64%.. I have tried numerous different things and I can't quite get them to match, although there is no volume loop at least! I just like everything just rightG3rard wrote:I think it's quite pretty![]()
Will have a look at that as well, because I think there will be no volume loop this way and updating the slider as well is a bit nicer
Good idea! I'll hold out as I think its an eDomoticz thing.. G3rard has hacked a fix so hopefully that will be implementedtrixwood wrote:new virtual sensor and device script if original change, change new with original+1.
Users browsing this forum: No registered users and 1 guest