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.
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’.
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 )
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.
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
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))