Virtual Dimmer for Volume Control

Is there anyway to create a “virtual” dimmer that could control another plugin / device? I am trying to find a way to control my AV receiver volume through imperihome, by creating a dimmer device. The device would have to present itself as a dimmer, but would set the volume variable on the receiver plugin instead of the dimmer load level.

Any thoughts?

So, I figured this one out.

I made a dummy dimmer with a custom I_DimmableLight1.xml file using the code below. This code changes the volume (scaled 0 - 100% within the specified listening range) on the target receiver. Not the cleanest code, but it gets the job done.

[code]local dBVolume
local maxVol
local minVol
local deviceID
–104 = living room amp
–109 = loft amp
–105 = living room amp volume control
–107 = loft volume control

			if lul_device == 105 then
				--Living Room Volume Control
				deviceID = 104 
			elseif lul_device == 107 then
				--Loft Volume Control
				deviceID = 109
			end
			
			luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", lul_settings.newLoadlevelTarget, lul_device)
			luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", lul_settings.newLoadlevelTarget, lul_device)
			--luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget =lul_settings.newLoadlevelTarget}, 34)
			maxVol = 134
			minVol = 80
			dbVolume = math.floor(((maxVol-minVol)*lul_settings.newLoadlevelTarget)/100+minVol)
			luup.call_action("urn:pioneer-com:serviceId:Receiver1", "SetVolumeTarget", {newTargetValue = dbVolume}, deviceID)[/code]

What AVR plugin does Imperihome not support? I’ve been thinking about purchasing IH but I’m finding more and more things it lacks and/or needs many work-arounds to handle.

I’m using the Pioneer plugin. I don’t really see how imperihome could support this plugin, it would be alot of work for a small audience. I customized the plugin for my use anyway.

Imperihome in indeed an awesome app though, it provides a good deal of customization without having to write custom code. Best money spent on automation equipment in my house. I’m using it on several wall mounted tablets.

I have an Arduino plugged into my veralite usb port - acting as a gateway to various gadgets - and I control all this stuff by sending command codes to it (through the vera serial port). So far I’ve been doing this simply by using scenes with luup code typed in. For example, I have a scene that is called “Living Room Lights Full”, and in the scenes luup code box is the singular line:

luup.io.write(“128,255”,69)

In this example, 128 is the device code, and 255 is the data (brightness level).

Similar to what you did with volume, I would prefer to have a dimmer in my control panel that somehow runs this line of code.

When you say “I made a dummy dimmer…”, that’s the part I know nothing about… perhaps you can help? The luup files and how they relate to each other I’ve never studied.
Thanks for any help you can offer.

Just seeing this and interested as well. Still working well? Can you give more details on how you did this?

Also, using the dimmer widget, can you get the on\off to control power for the receiver?

i finally figured it out

so i use a Denon AVR E400 there is a plugin available but i wanted to tuse a dimmer as volume control

I crated a virtual Dimmer and created a custom implementation file


<?xml version="1.0"?>
<implementation>
	<functions>
		function virtual_dimmable_light_startup (lul_device)
			luup.log ("Virtual dimmable light running...")
		end
	</functions>
	<startup>virtual_dimmable_light_startup</startup>
	<actionList>
		<action>
			<serviceId>urn:upnp-org:serviceId:Dimming1</serviceId>
			<name>SetLoadLevelTarget</name>
			<job>
				luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", lul_settings.newLoadlevelTarget, lul_device)
				luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", lul_settings.newLoadlevelTarget, lul_device)
				
				local dBVolume = luup.variable_get ("urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", lul_device)
				luup.call_action ("urn:upnp-org:serviceId:RenderingControl1", "SetVolume", {DesiredVolume= dBVolume}, 358)
				if (tonumber (lul_settings.newLoadlevelTarget, 10) == 0) then
					luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Status", "0", lul_device)
				else
					luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Status", "1", lul_device)
				end
				
				return 4, 5
				
			</job>
		</action>
	</actionList>
</implementation>

took me a while to get this

im the implementation u need to Get the number value of the dimmer and then pass it to the avr

local dBVolume = luup.variable_get ("urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", lul_device) luup.call_action ("urn:upnp-org:serviceId:RenderingControl1", "SetVolume", {DesiredVolume= dBVolume}, 358)