Motion vs. Door Sensors

All of the z-wave motion and door sensors that I currently have actually use the Motion schema in Vera. I also have a non-z-wave door sensor that uses the Door schema in Vera.

My question is, are there any z-wave devices that will also use this door schema? Does anybody know why both the motion and door sensors use the same Motion scheme in Vera?

A motion and door sensor are essentially the same thing…they are either tripped (open/motion) or not-tripped (closed/no-motion).

The only difference is how they are represented.

You can change a few items to make them show up nicely in the GUI.

For the device representing the door, in the advanced tab:
Change device_type to urn:schemas-micasaverde-com:device:DoorSensor:1
Change device_file to D_DoorSensor1.xml

Save it, reload the page, and you should have a door icon instead of the running man.

[quote=“PurdueGuy, post:2, topic:174530”]A motion and door sensor are essentially the same thing…they are either tripped (open/motion) or not-tripped (closed/no-motion).

The only difference is how they are represented.

You can change a few items to make them show up nicely in the GUI.

For the device representing the door, in the advanced tab:
Change device_type to urn:schemas-micasaverde-com:device:DoorSensor:1
Change device_file to D_DoorSensor1.xml

Save it, reload the page, and you should have a door icon instead of the running man.[/quote]

I tried this on a Mimolite binary contact which is defaulted to running man and I wanted a door for the garage door.

Well after reset it changes it back. Any other ideas?

Well after reset it changes it back. Any other ideas?

You changed the device file and Vera changed it back? Now that is odd and definitely should not happen.

[quote=“RexBeckett, post:4, topic:174530”]

Well after reset it changes it back. Any other ideas?

You changed the device file and Vera changed it back? Now that is odd and definitely should not happen.[/quote]

I think I got it figured out, but the bottom line is it wasn’t VERA. The it was a child device controlled by the “MIMOlite Plugin”. I have went into the “I_MimoSensor.xml” file and changed out the
“urn:schemas-micasaverde-com:device:MotionSensor:1”

and

“D_MotionSensor1.xml”

with the DoorSensor ones.

I’m currently testing now.

If I change the Device Type, will I need to redo all my scenes?

I made a change in the Russound file one time to add SwitchPower and all my previous scenes broke.

I think I got it figured out, but the bottom line is it wasn't VERA. The it was a child device controlled by the "MIMOlite Plugin". I have went into the "I_MimoSensor.xml" file and changed out the "urn:schemas-micasaverde-com:device:MotionSensor:1"

That makes sense. The plugin would set the device type on every restart. You may need to change the device file as well as the device type. It may not matter on UI5 but apparently it does on UI7.

If I change the Device Type, will I need to redo all my scenes?

'fraid so. The device will have different service ID, variable names and actions so the original triggers and actions will not fire.

Thanks for your experience sir!

[quote=“RexBeckett, post:7, topic:174530”]

I think I got it figured out, but the bottom line is it wasn’t VERA. The it was a child device controlled by the “MIMOlite Plugin”. I have went into the “I_MimoSensor.xml” file and changed out the
“urn:schemas-micasaverde-com:device:MotionSensor:1”

That makes sense. The plugin would set the device type on every restart. You may need to change the device file as well as the device type. It may not matter on UI5 but apparently it does on UI7.[/quote]

I had changed both from the get go so I’m not sure if UI5 needed to or not but all is working good.

I think my next step is to play around with the same file and delete the other devices it creates. MIMOLite Plugin creates like 3 child devices (sensors), But I only need the on/off relay (parent device) and the tripped not tripped door sensor (security sensor or 1 child device). The other 2 children are useless to me right now and I end up just hiding them with lua start up code. But with 4 garage doors and an electronic driveway gate it alot of hidden devices that still show on phone and clutter things up.

Here’s my modified version I’m using with door vs. running man if anyone wants it and can you see what I should remove to get rid of the “Current Level” and “Pulse” child devices Could also be called “GenericSensor1” and “EnergyMetering1”

[code]<?xml version="1.0"?>


local g_mimoDevices = {}
local g_parentDevice
local g_childDevices = {
– { door_sensor = x1, generic_sensor = y1, power_meter = z1 },
– { door_sensor = x2, generic_sensor = y2, power_meter = z2 },
– …
– { door_sensor = xn, generic_sensor = yn, power_meter = zn }
}

local SID_MIMO = “urn:micasaverde-com:serviceId:MimoSensor1”
local SID_SECURITY = “urn:micasaverde-com:serviceId:SecuritySensor1”
local SID_GENERIC = “urn:micasaverde-com:serviceId:GenericSensor1”
local SID_ENERGY = “urn:micasaverde-com:serviceId:EnergyMetering1”

local DEV_TYPE_DOOR_SENSOR = “urn:schemas-micasaverde-com:device:DoorSensor:1”
local DEV_TYPE_GENERIC_SENSOR = “urn:schemas-micasaverde-com:device:GenericSensor:1”
local DEV_TYPE_POWER_METER = “urn:schemas-micasaverde-com:device:PowerMeter:1”

local function CreateChildDevices()
local ptr = luup.chdev.start( g_parentDevice )
for , mimoDev in pairs( g_mimoDevices ) do
– Create the security sensor.
luup.chdev.append( g_parentDevice, ptr, "mimo
"… mimoDev …“_bs”, “Mimo #”… mimoDev …" binary sensor",
DEV_TYPE_DOOR_SENSOR, “D_DoorSensor1.xml”, “I_SecuritySensor1.xml”,
SID_SECURITY …“,Tripped=0\n”… SID_SECURITY …“,Armed=0”, false )

  -- Create the generic sensor.
  luup.chdev.append( g_parentDevice, ptr, "mimo_".. mimoDev .."_gs", "Mimo #".. mimoDev .." generic sensor",
    DEV_TYPE_GENERIC_SENSOR, "D_GenericSensor1.xml", "",
    SID_GENERIC ..",CurrentLevel=0", false )

  -- Create the generic sensor.
  luup.chdev.append( g_parentDevice, ptr, "mimo_".. mimoDev .."_pm", "Mimo #".. mimoDev .." pulse meter",
    DEV_TYPE_POWER_METER, "D_PowerMeter1.xml", "",
    SID_ENERGY ..",Pulse=0", false )
end
luup.chdev.sync( g_parentDevice, ptr )

end

local function GetChildDevices()
for devNum, devAttr in pairs( luup.devices ) do
if devAttr.id:find(“^mimo”) then
– We found a child device. Get its “virtual” parent.
local vParent = devAttr.id:match(“mimo_(%d+)”)
vParent = tonumber( vParent, 10 )

    if not g_childDevices[vParent] then
      g_childDevices[vParent] = {}
    end

    if devAttr.device_type == DEV_TYPE_DOOR_SENSOR then
      g_childDevices[vParent].door_sensor = devNum
    elseif devAttr.device_type == DEV_TYPE_GENERIC_SENSOR then
      g_childDevices[vParent].generic_sensor = devNum
    else
      g_childDevices[vParent].power_meter = devNum
    end
  end
end

end

function UpdateTripped (lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set( SID_SECURITY, “Tripped”, lul_value_new, g_childDevices[lul_device].door_sensor )
end

function UpdateLevel (lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set( SID_GENERIC, “CurrentLevel”, lul_value_new, g_childDevices[lul_device].generic_sensor )
end

function UpdatePulse (lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set( SID_ENERGY, “Pulse”, lul_value_new, g_childDevices[lul_device].power_meter )
end

function Startup (lul_device)

-- Comma separated list of MIMO device IDs.
local mimoDevices = luup.variable_get( SID_MIMO, "MIMO_Devices", lul_device ) or ""
if mimoDevices == "" then
  luup.variable_set( SID_MIMO, "MIMO_Devices", "", lul_device)
  luup.log( "(MimoPlugin::Startup) No MIMO devices to monitor. Quit" )
  return
end
for devNum in mimoDevices:gmatch( "%d+" ) do
  table.insert( g_mimoDevices, tonumber( devNum, 10 ) )
end

g_parentDevice = lul_device

CreateChildDevices()
GetChildDevices()

for i,devNum in pairs(g_mimoDevices) do
  luup.variable_watch( "UpdateTripped", SID_SECURITY, "Tripped", devNum )
  luup.variable_watch( "UpdateLevel", SID_GENERIC, "CurrentLevel", devNum )
  luup.variable_watch( "UpdatePulse", SID_ENERGY, "Pulse", devNum )
end

end

Startup
[/code]

I have commented-out the parts that create and watch the two devices that you don’t want.

[code]<?xml version="1.0"?>


local g_mimoDevices = {}
local g_parentDevice
local g_childDevices = {
– { door_sensor = x1, generic_sensor = y1, power_meter = z1 },
– { door_sensor = x2, generic_sensor = y2, power_meter = z2 },
– …
– { door_sensor = xn, generic_sensor = yn, power_meter = zn }
}

local SID_MIMO = “urn:micasaverde-com:serviceId:MimoSensor1”
local SID_SECURITY = “urn:micasaverde-com:serviceId:SecuritySensor1”
local SID_GENERIC = “urn:micasaverde-com:serviceId:GenericSensor1”
local SID_ENERGY = “urn:micasaverde-com:serviceId:EnergyMetering1”

local DEV_TYPE_DOOR_SENSOR = “urn:schemas-micasaverde-com:device:DoorSensor:1”
local DEV_TYPE_GENERIC_SENSOR = “urn:schemas-micasaverde-com:device:GenericSensor:1”
local DEV_TYPE_POWER_METER = “urn:schemas-micasaverde-com:device:PowerMeter:1”

local function CreateChildDevices()
local ptr = luup.chdev.start( g_parentDevice )
for , mimoDev in pairs( g_mimoDevices ) do
– Create the security sensor.
luup.chdev.append( g_parentDevice, ptr, "mimo
"… mimoDev …“_bs”, “Mimo #”… mimoDev …" binary sensor",
DEV_TYPE_DOOR_SENSOR, “D_DoorSensor1.xml”, “I_SecuritySensor1.xml”,
SID_SECURITY …“,Tripped=0\n”… SID_SECURITY …“,Armed=0”, false )

  -- Create the generic sensor.

– luup.chdev.append( g_parentDevice, ptr, “mimo_”… mimoDev …“_gs”, “Mimo #”… mimoDev …" generic sensor",
– DEV_TYPE_GENERIC_SENSOR, “D_GenericSensor1.xml”, “”,
– SID_GENERIC …“,CurrentLevel=0”, false )

  -- Create the generic sensor.

– luup.chdev.append( g_parentDevice, ptr, “mimo_”… mimoDev …“_pm”, “Mimo #”… mimoDev …" pulse meter",
– DEV_TYPE_POWER_METER, “D_PowerMeter1.xml”, “”,
– SID_ENERGY …“,Pulse=0”, false )
end
luup.chdev.sync( g_parentDevice, ptr )
end

local function GetChildDevices()
for devNum, devAttr in pairs( luup.devices ) do
if devAttr.id:find(“^mimo”) then
– We found a child device. Get its “virtual” parent.
local vParent = devAttr.id:match(“mimo_(%d+)”)
vParent = tonumber( vParent, 10 )

    if not g_childDevices[vParent] then
      g_childDevices[vParent] = {}
    end

    if devAttr.device_type == DEV_TYPE_DOOR_SENSOR then
      g_childDevices[vParent].door_sensor = devNum
    elseif devAttr.device_type == DEV_TYPE_GENERIC_SENSOR then
      g_childDevices[vParent].generic_sensor = devNum
    else
      g_childDevices[vParent].power_meter = devNum
    end
  end
end

end

function UpdateTripped (lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set( SID_SECURITY, “Tripped”, lul_value_new, g_childDevices[lul_device].door_sensor )
end

function UpdateLevel (lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set( SID_GENERIC, “CurrentLevel”, lul_value_new, g_childDevices[lul_device].generic_sensor )
end

function UpdatePulse (lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
luup.variable_set( SID_ENERGY, “Pulse”, lul_value_new, g_childDevices[lul_device].power_meter )
end

function Startup (lul_device)

-- Comma separated list of MIMO device IDs.
local mimoDevices = luup.variable_get( SID_MIMO, "MIMO_Devices", lul_device ) or ""
if mimoDevices == "" then
  luup.variable_set( SID_MIMO, "MIMO_Devices", "", lul_device)
  luup.log( "(MimoPlugin::Startup) No MIMO devices to monitor. Quit" )
  return
end
for devNum in mimoDevices:gmatch( "%d+" ) do
  table.insert( g_mimoDevices, tonumber( devNum, 10 ) )
end

g_parentDevice = lul_device

CreateChildDevices()
GetChildDevices()

for i,devNum in pairs(g_mimoDevices) do
  luup.variable_watch( "UpdateTripped", SID_SECURITY, "Tripped", devNum )

– luup.variable_watch( “UpdateLevel”, SID_GENERIC, “CurrentLevel”, devNum )
– luup.variable_watch( “UpdatePulse”, SID_ENERGY, “Pulse”, devNum )
end
end

Startup
[/code]

Honestly I totally believe you, but I’m blind.

I was comparing the original with what you posted and I can’t find the differences. What am I missing?

EDIT: I still haven’t tried it, but I have compared side by side and I’m thinking maybe a paste error?

I was comparing the original with what you posted and I can't find the differences. What am I missing?

Look for the lines that start with two dashes (–). That makes them a comment so they will not be executed.

[quote=“RexBeckett, post:12, topic:174530”]

I was comparing the original with what you posted and I can’t find the differences. What am I missing?

Look for the lines that start with two dashes (–). That makes them a comment so they will not be executed.[/quote]

Ahhhh yes. Told you I was blind. LOL