bad device error when trying to get status on a dimmer

when i run this code via test luup code in the MIOS Developers icon on UI4 (firmware 1.1.1062)

local entry_level = luup.variable_get(“urn:schemas-upnp-org:device:DimmableLight:1”,“LoadLevelStatus”,43)

vera gives me a “bad device” error.

the dimmer switch i am reading is id 43 and the device type is “urn:schemas-upnp-org:device:DimmableLight:1” (both copied from the Advance tab of the device). its a wayne dalton HA14 light dimmer.

LuaUPUnP.log shows the error as: JobHandler_LuaUPnP::RunLua can’t find device interface <0x340e>

i must be missing something obvious but can’t for the life of me figure it out. can anyone help point me in the right direction? thanks much.

http://wiki.micasaverde.com/index.php/Luup_Scenes_Events#Dim_switch_.236_to_30.25

thanks, but i am trying to read the variable, not set it. am i missing something?

tried that anyway but got same “bad device” error. hmmm.

log says:

luup.call_action(“urn:upnp-org:serviceId:Dimming1”,“SetLoadLevelTarget”,{ newLoadlevelTarget=“30” },51) <0x2c0c>

01 11/26/10 1:09:05.556 ^[[31;1mJobHandler_LuaUPnP::RunLua can’t find device interface^[[0m <0x2c0c>

Chances are that you are using the wrong device ID. There is more than one ID for each device … You must use the ID from the ‘Advanced’ tab. The ID is named ‘id’.

yup, that’s the one i’m using

screen shot: Fotorex_Karacsonyi_Lap_04.png - Droplr

thanks for digging into this with me. i am stumped. i opened a tech support ticket, but hoping to get help here in case they are out for the holiday. (just my luck i get a few hours away from work to play and my vera does not want to cooperate… it reminds of my 4 year old daughter in several ways :slight_smile: )

i also get the “bad device” error message everytime i test in “MIOS developer” tab. my intermatic dimmable light “id” is 3. maybe someone can fix my lua code below; with this code, nothing happens but when i remove the code, the light turns on everytime we punch a pin code in the kwikset door lock. i dont want it to turn on during the day. i want the light to turn on only between 5pm and 6:15 am. please help.

current_second = os.date(‘*t’,os.time())[“hour”] * 3600 + os.date(‘*t’,os.time())[“min”] * 60

min_time_in_seconds = 17 * 3600 + 0 * 60
max_time_in_seconds = 06 * 3600 + 15 * 60

if (current_second > min_time_in_seconds) and (current_second < max_time_in_seconds)
then
luup.variable_set(“urn:schemas-upnp-org:device:DimmableLight:1”,“1”,3)
else
return false
end

and when i create a scene with this luup code:

temp=luup.variable_get(“urn:schemas-upnp-org:device:DimmableLight:1”,“LoadLevelStatus”,43)
luup.log(temp)

what i get in my log is:

luup_log:0: (null)

odd

I too get the “Bad device” error. I posted ([url=http://forum.micasaverde.com/index.php?topic=4837.0]http://forum.micasaverde.com/index.php?topic=4837.0[/url]) about it to no avail. I’m glad I’m not the only one with this problem. Hopefully MCV can help.

The first argument to luup.variable_get is the ‘serviceId’, not the ‘device_type’ (see screen
shot).

If you look in D_DimmableLight1.xml on the ‘Luup files’ tab of the ‘MiOS developers’
window you can see what services a device supports, then in turn, look into the
services files to see the variables that service provides.


require('print_r')

-- function to read the level of a dimmer
function get_level(id)
  local val = {}
  val.name = luup.devices[id].description
  val.level = luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus", id)
  return val
end

-- function to log data for debugging
function logger(t) 
  local outf = io.open('/tmp/log/cmh/test_level.log', 'a')
  outf:write(os.date('%Y-%m-%d %H:%M:%S: '))
  outf:write(print_rs(t))
  outf:close()
end

logger(get_level(3))

The source to ‘print_r’ is in this message:
[url=http://forum.micasaverde.com/index.php?topic=4590.msg25570#msg25570]http://forum.micasaverde.com/index.php?topic=4590.msg25570#msg25570[/url]

Sample output is in the second screen shot.

The sample code in the MiOS developers window is shown in screen shot 3. Leave
the device number blank.

–Jim

that did the trick. thanks so much ! (i feel thankful and dumb at the same time :slight_smile: )