Child Motion Sensor SetArmed Question [SOLVED]

For a custom sensor that is triggered by a remote machine i am creating a sensor. Everything is working and triggering fine when i do it through Lua. My problem is in the UI

luup.chdev.append(parentDevice, ptr, “bi_”… parentDevice …“_sensor”, luup.devices[parentDevice].description …" Motion Sensor", “urn:schemas-micasaverde-com:device:MotionSensor:1”, “D_MotionSensor1.xml”, “”, SES_SID …“,Armed=1\n”… SES_SID …“,Tripped=0”, true, false)

It creates the motion sensor just fine and creates the sensor in an armed state. However if i try to hit bypass button or arm button it gives and error No implementation

08 07/07/14 11:51:00.706 JobHandler_LuaUPnP::HandleActionRequest device: 196 service: urn:micasaverde-com:serviceId:SecuritySensor1 action: SetArmed <0x30ceb680> 08 07/07/14 11:51:00.706 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=196 <0x30ceb680> 02 07/07/14 11:51:00.707 Device_LuaUPnP::HandleActionRequest 196 none of the 1 implementations handled it <0x30ceb680> 02 07/07/14 11:51:00.708 JobHandler_LuaUPnP::RunAction device 196 action urn:micasaverde-com:serviceId:SecuritySensor1/SetArmed failed with 501/No implementation <0x30ceb680>

What would be the most efficient way to handle this? Would i just create an Implementation file for the functions? Also If i manually changed the Armed Var to 0 it goes to the bypass state.

First, decide if the parent device’s Implementation file is where you want to put the code, or if you want to create a separate Implementation file for the children. Both are valid, but I think most developers go for the former. If you do this then you will need to put a “HandleChildren” directive somewhere in the parent’s implementation file. See the usual example.

Then you need to ensure that your Implementation file contains an action for urn:micasaverde-com:serviceId:SecuritySensor1/SetArmed. That code will be pretty short: all it will do is likely set the child device’s Armed variable.

Thanks futzle that was exactly what i needed! ;D In case anyone else needs to do this here is how i implemented it

Added this just before in the Implementation file


Added an action in the , your job code would be different but this will get the motionsensorid var from my parent device if greater than 0 and turn the child device to whatever state is requested.

<job> MotionSID = tonumber(luup.variable_get(CMD_SID, "MotionSensorID", parentDevice) , 10) or 0 if( MotionSID > 0 ) then luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1", "Armed", lul_settings.newArmedValue, tonumber(MotionSID) ) return 4 else return 2 end </job>

Do make sure that your code returns 4 on success (or 2 on failure), as described here.

I didn’t but now i did :slight_smile: and updated my previous post