== Debugging ==
[[PageOutline]]

This page contains shows various forms of log output that occur during execution of the IR components in MiOS, specifically those using the SQBlaster Plugin.

The examples shown include both successful requests and executions, along with un-successful executions for the common cases.  They are intended as a guide to debugging a particular configuration, since there are many things that may prevent an environment from working correctly.

In most cases, the samples provided will require you to have access to the `LuaUPnP.log` file.  This can be done by logging into your Vera using `ssh`.  Alternatively, on new MiOS Firmware versions, you can view the log files ''online'' using the URL:

    http://192.168.x.xxx/cgi-bin/cmh/log.sh?Device=LuaUPnP


Separately, if you wish to ''call'' an ''IR Action'' on an ''IR Device'', this can be done via a URL like:
    http://192.168.x.xxx:49451/data_request?id=lu_action&DeviceNum=202&serviceId=urn:micasaverde-com:serviceId:DiscretePower1&action=On

The example above will request ''DiscretePower1::On'', MiOS Device ''202''.  The specific ''IR Actions'' that are available will depend upon your installed ''IR Device''.  Please look at your `I_SQdevxxxxxxx.xml` file for other examples (Such as ''TogglePower1::!OnOff'')

Note: The log output below may be trimmed in order to make it more readable.


=== General Health ===
The SQBlaster Plugin periodically wakes up and emits the following output in the `LuaUPnP.log` file.  This is used to test that the Puck is contactable, and show the corresponding ''Up'' or ''Down'' status on the Dashboard UI, along with the details show in the Dashboard Dialog.

{{{
50 04/17/11 ...	luup_log:90: SQBlaster refreshCache called <0x402>
50 04/17/11 ...	luup_log:90: SQBlaster refreshCache: 0 <0x402>
50 04/17/11 ...	luup_log:90: SQBlaster Successful execution of URL content=
50 04/17/11 ...	luup_log:90: SQBlaster Name sq-blaster-xxxx.local, Firmware Version A052, 
                Date Aug 14 2010, MAC 00:12:b8:00:xx:xx, Antenna N/A, syslog N/A, syslog IP N/A <0x402>
}}}

=== Request to Send an IR Code from the IR Device ===
The following example shows a ''DiscretePower1::On'' action being requested against MiOS Device ''202''.  This request came from a SQRemote AV Control request.

Internally, at the end of this request, MiOS will determine the correct IR ''!ProntoCode'' to send, and push it through to the associated ''IRTransmitter'' (see below)
{{{
12 04/17/11 ...	luvd_get_info_data_request starting /data_request?id=lu_action&DeviceNum=202
                &serviceId=urn:micasaverde-com:serviceId:DiscretePower1&action=On
08 04/17/11 ...	JobHandler_LuaUPnP::HandleActionRequest
                device: 202 service: urn:micasaverde-com:serviceId:DiscretePower1 action: On
08 04/17/11 ...	JobHandler_LuaUPnP::HandleActionRequest
                argument DeviceNum=202
08 04/17/11 ...	JobHandler_LuaUPnP::HandleActionRequest
                argument serviceId=urn:micasaverde-com:serviceId:DiscretePower1
08 04/17/11 ...	JobHandler_LuaUPnP::HandleActionRequest
                argument action=On
}}}


=== Request to Send an IR Code from the IR Device - No IRTransmitter Associated (Device not ready) ===
This is typically what you'll see when there's no ''IRTransmitter'' associated with your ''IRDevice'', after attempting to "call" one of it's IR ''Actions''.

It also happens when your ''IRDevice'' Plugin (`D_SQdevxxxxxxxx.xml`) is missing it's implementation file (`I_SQdevxxxxxxxx.xml`).  The names must match the declaration in the `<implementationFile>` XML element in the Plugin declaration file.  In this case you'll also get an error, early in the MiOS Startup processes, where it indicates that the Device has no Implementation.

{{{
12 04/17/11 ... luvd_get_info_data_request starting /data_request?id=lu_action&DeviceNum=86
                &serviceId=urn:micasaverde-com:serviceId:TogglePower1&action=OnOff
08 04/17/11 ... JobHandler_LuaUPnP::HandleActionRequest
                device: 86 service: urn:micasaverde-com:serviceId:TogglePower1 action: OnOff
08 04/17/11 ... JobHandler_LuaUPnP::HandleActionRequest
                argument DeviceNum=86
08 04/17/11 ... JobHandler_LuaUPnP::HandleActionRequest
                argument serviceId=urn:micasaverde-com:serviceId:TogglePower1
08 04/17/11 ... JobHandler_LuaUPnP::HandleActionRequest
                argument action=OnOff
02 04/17/11 ... Device_LuaUPnP::HandleActionRequest 86 not ready
02 04/17/11 ... JobHandler_LuaUPnP::RunAction device 86 action urn:micasaverde-com:serviceId:TogglePower1/OnOff
                failed with -911/Device not ready
}}}



=== Request to Send an IR Code from the IR Transmitter ===
The following example shows an IR ''!ProntoCode'' being passed through from a MiOS ''IRDevice'', to the attached MiOS ''IRTransmitter'' device.
{{{
08 04/17/11 ... JobHandler_LuaUPnP::HandleActionRequest device: 90
                service: urn:micasaverde-com:serviceId:IrTransmitter1 action: SendProntoCode <0x380f>
08 04/17/11 ... JobHandler_LuaUPnP::HandleActionRequest argument ProntoCode=P44c0 301c 17b6 7ca4 6e8a 7b96
                cfc2 2234 5204 d2f0 188d 3de6 bc60 1d22 9694 1ccc 83f4 3009 31a2 277c 4ae1 e277 61ac f79e
                83f4 3009 31a2 277c 4ae1 e277 61ac f79e 5204 d2f0 188d 3de6 bc60 1d22 9694 1ccc 83f4 3009
                31a2 277c 4ae1 e277 61ac f79e bf94 1d27 3d8f cfb4 81c4 6171 95b8 abd0 83f4 3009 31a2 277c
                4ae1 e277 61ac f79e 83f4 3009 31a2 277c 4ae1 e277 61ac f79e 9867 f1d1 545b 5d71 1e9a 17f6
                a50e f196 5204 d2f0 188d 3de6 bc60 1d22 9694 1ccc 9867 f1d1 545b 5d71 1e9a 17f6 a50e f196
                c0db 2848 da61 776c 9eac 142c 3ff9 172f  <0x380f>
}}}

=== IR Transmitter succeeded in sending IR Code ===
{{{
50 04/17/11 ... luup_log:90: Web request returned status=200 response=
                in 0ms <0x380f>
}}}

=== IR Transmitter failing to send an IR Code, SQBlaster not contactable ===
{{{
01 04/17/11 ... luup_log:90: Web request returned no response ProntoCode=P44c0 301c 17b6 7ca4 6e8a 7b96
                cfc2 2234 5204 d2f0 188d 3de6 bc60 1d22 9694 1ccc 83f4 3009 31a2 277c 4ae1 e277 61ac f79e
                83f4 3009 31a2 277c 4ae1 e277 61ac f79e 5204 d2f0 188d 3de6 bc60 1d22 9694 1ccc 83f4 3009
                31a2 277c 4ae1 e277 61ac f79e bf94 1d27 3d8f cfb4 81c4 6171 95b8 abd0 83f4 3009 31a2 277c
                4ae1 e277 61ac f79e 83f4 3009 31a2 277c 4ae1 e277 61ac f79e 9867 f1d1 545b 5d71 1e9a 17f6
                a50e f196 5204 d2f0 188d 3de6 bc60 1d22 9694 1ccc 9867 f1d1 545b 5d71 1e9a 17f6 a50e f196
                c0db 2848 da61 776c 9eac 142c 3ff9 172f   in 0ms <0x380f>
}}}