Very strange invokeproperty method. I don't understand it, so please feel free to help me 
I was trying to toggle a device's power, using the code below:
This code changes both the home and device powerstate property values, but no command is sent. With this device, I do not have a toggle command set, but rather on and off commands. If you modify the above code to turn the device on instead of toggle (sys://Schema/System/Boolean/Toggle changes to sys://Schema/System/Boolean/On) it works just fine!
What is really confusing is the code below works and on/off commands are sent appropriately:
In case you are wondering, you can also replace objRcvr with the direct path (devices.CustomDevices.TXNR905) and similar behavoir is observed. All getReceiverInHome() does is grab the nth receiver found under home and return the receiver object.
The help file says this:
InvokeProperty Method Premise Scripting Reference
InvokeProperty
object.InvokeProperty(ControlCode, Property, Action)
Arguments object (required) Any PremiseObject. ControlCode (required) Long value specifying the desired type of action on the property. Send the Property (required) Schema object of Property Object to be invoked. For example, Schema.Device.Power.PowerState Action(required) Schema object of action to be invoked. For example, Schema.System.Boolean.Toggle. Example 'toggle the power on the light referenced by this
Remarks The InvokeProperty Method completes an action upon a property with a specified type of action based on the Control Code passed to the method. To send multiple flags, add the values of the flags together and send that number.
1 - SVCC_NOTIFY (notify updates within local machine) 2 - SVCC_UNDO (create undo unit(s)) 4 - SVCC_LOCAL (don't replicate with server; don't add to replication log) 8 - SVCC_FORCE (force update, even if property is the same) 16 - SVCC_EXIST (when creating, return an existing object if already there, when setting, indicates that property change is part of a command invocation) 64 - SVCC_FIXED (upon creation, sets object has fixed, so that it can't be deleted by a user)

I was trying to toggle a device's power, using the code below:
Code:
'find the desired receiver
Set objRcvr = getReceiverInHome(0)
set objRcvr = objRcvr.boundobject
Set objProp = sys.GetObject("sys://Schema/Device/Power/PowerState")
Set objAction = sys.GetObject("sys://Schema/System/Boolean/Toggle")
objRcvr.InvokeProperty 9, objProp, objAction
This code changes both the home and device powerstate property values, but no command is sent. With this device, I do not have a toggle command set, but rather on and off commands. If you modify the above code to turn the device on instead of toggle (sys://Schema/System/Boolean/Toggle changes to sys://Schema/System/Boolean/On) it works just fine!
What is really confusing is the code below works and on/off commands are sent appropriately:
Code:
'find the desired receiver
Set objRcvr = getReceiverInHome(0)
'set objRcvr = objRcvr.boundobject
Set objProp = sys.GetObject("sys://Schema/Device/Power/PowerState")
Set objAction = sys.GetObject("sys://Schema/System/Boolean/Toggle")
objRcvr.InvokeProperty 9, objProp, objAction
In case you are wondering, you can also replace objRcvr with the direct path (devices.CustomDevices.TXNR905) and similar behavoir is observed. All getReceiverInHome() does is grab the nth receiver found under home and return the receiver object.
The help file says this:
InvokeProperty Method Premise Scripting Reference
InvokeProperty
object.InvokeProperty(ControlCode, Property, Action)
Arguments object (required) Any PremiseObject. ControlCode (required) Long value specifying the desired type of action on the property. Send the Property (required) Schema object of Property Object to be invoked. For example, Schema.Device.Power.PowerState Action(required) Schema object of action to be invoked. For example, Schema.System.Boolean.Toggle. Example 'toggle the power on the light referenced by this
Code:
'the 9 represents the SVCC_NOTIFY and SVCC_FORCE codes being sent to the method
set objProp = sys.GetObject("sys://Schema/Device/Power/PowerState")
set objAction = sys.GetObject("sys://Schema/System/Boolean/Toggle")
this.InvokeProperty 9, objProp, objAction
1 - SVCC_NOTIFY (notify updates within local machine) 2 - SVCC_UNDO (create undo unit(s)) 4 - SVCC_LOCAL (don't replicate with server; don't add to replication log) 8 - SVCC_FORCE (force update, even if property is the same) 16 - SVCC_EXIST (when creating, return an existing object if already there, when setting, indicates that property change is part of a command invocation) 64 - SVCC_FIXED (upon creation, sets object has fixed, so that it can't be deleted by a user)