n8henrie/fauxmo

Alexa Response for simple URL call

Closed this issue · 24 comments

  • Operating system and version: Raspi Jessy
  • Python version: 3.6.4
  • Fauxmo version (fauxmo --version): 4.7
  • Echo device type (e.g. Echo, Echo Plus, Dot): Echo Gen 2
  • [Echo Firmware Version]: 608490620

My Issue

I have the following configuration

....
"SimpleHTTPPlugin": {
   "DEVICES": [
       {
         "port": 12342,
         "on_cmd": "http://192.168.1.18:8080/displayCamera/1",
          "off_cmd": "http://192.168.1.18:8080/displayCamera/1",
          "method": "GET",
          "name": "Kamera eins"
.....

If I call "Alexa turn camera one on" The URL is fired, but the response from Alexa is "Camera one does not react".
Calling "Alexa turn camera one off" works and the response from Alexa is "Ok".

This worked before. Does anyone have an idea?

I haven't had any issues, but haven't been using this plugin.

The debug log may be helpful -- please follow the issue template.

EDIT: What is the response code for the URL? If not in [200, 201] that could be the culprit.

Debug output:

(fauxmo) pi@base:~ $ fauxmo -c /home/pi/fauxmo/config.json -vvv
2018-06-02 13:25:58 fauxmo:37       INFO     Fauxmo v0.4.7
2018-06-02 13:25:58 fauxmo:38       DEBUG    3.6.4 (default, Feb 27 2018, 19:46:24)
[GCC 6.3.0 20170516]
2018-06-02 13:25:58 fauxmo:24       DEBUG    Attempting to get IP address automatically
2018-06-02 13:25:58 fauxmo:40       DEBUG    Using IP address: 192.168.1.16
2018-06-02 13:25:58 fauxmo:100      DEBUG    plugin_vars: {}
2018-06-02 13:25:58 fauxmo:103      DEBUG    device config: {'port': 12340, 'on_cmd': 'http://192.168.1.16:8080/alarmOn', 'off_cmd': 'http://192.168.1.16:8080/alarmOff', 'method': 'GET', 'name': 'Alarmanlage'}
2018-06-02 13:25:58 asyncio:1068     INFO     <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 12340)>]> is serving
2018-06-02 13:25:58 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'Alarmanlage', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75d80670>}
2018-06-02 13:25:58 fauxmo:103      DEBUG    device config: {'port': 12341, 'on_cmd': 'http://192.168.1.15/config/xmlapi/statechange.cgi?ise_id=2901&new_value=true', 'off_cmd': 'http://192.168.1.15/config/xmlapi/statechange.cgi?ise_id=2901&new_value=false', 'method': 'GET', 'name': 'Stehlampe'}
2018-06-02 13:25:58 asyncio:1068     INFO     <Server sockets=[<socket.socket fd=8, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 12341)>]> is serving
2018-06-02 13:25:58 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'Stehlampe', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75cf1f50>}
2018-06-02 13:25:58 fauxmo:103      DEBUG    device config: {'port': 12342, 'off_cmd': 'http://192.168.1.18:8080/displayCamera/1', 'on_cmd': 'http://192.168.1.18:8080/displayCamera/1', 'method': 'GET', 'name': 'Kamera eins'}
2018-06-02 13:25:58 asyncio:1068     INFO     <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 12342)>]> is serving
2018-06-02 13:25:58 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'Kamera eins', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x76799f50>}
2018-06-02 13:25:58 fauxmo:103      DEBUG    device config: {'port': 12343, 'on_cmd': 'http://192.168.1.18:8080/displayCamera/2', 'off_cmd': 'http://192.168.1.18:8080/displayCamera/2', 'method': 'GET', 'name': 'Kamera zwei'}
2018-06-02 13:25:58 asyncio:1068     INFO     <Server sockets=[<socket.socket fd=10, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 12343)>]> is serving
2018-06-02 13:25:58 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'Kamera zwei', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75cf1950>}
2018-06-02 13:25:58 fauxmo:123      INFO     Starting UDP server
2018-06-02 13:25:58 asyncio:948      DEBUG    Datagram endpoint remote_addr=None created: (<_SelectorDatagramTransport fd=11 read=idle write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0x75d805b0>)
2018-06-02 13:26:07 asyncio:1385     INFO     poll took 8868.648 ms: 1 events
2018-06-02 13:26:07 fauxmo:341      DEBUG    Received data below from ('192.168.1.78', 56562):
2018-06-02 13:26:07 fauxmo:342      DEBUG    M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 2
ST: urn:mdx-netflix-com:service:target:0


2018-06-02 13:26:07 asyncio:1385     DEBUG    poll took 120.077 ms: 1 events
2018-06-02 13:26:07 fauxmo:341      DEBUG    Received data below from ('192.168.1.78', 56562):
2018-06-02 13:26:07 fauxmo:342      DEBUG    M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 2
ST: urn:dial-multiscreen-org:service:dial:1

2018-06-02 13:26:18 asyncio:1385     INFO     poll took 10339.890 ms: 1 events
2018-06-02 13:26:18 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 12342)>]> got a new connection from ('192.168.1.123', 39140): <socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.16', 12342), raddr=('192.168.1.123', 39140)>
2018-06-02 13:26:18 fauxmo:41       DEBUG    Connection made with: ('192.168.1.123', 39140)
2018-06-02 13:26:18 fauxmo:52       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
SOAPACTION: "urn:Belkin:service:basicevent:1#SetBinaryState"
Content-Type: text/xml; charset="utf-8"
Accept:
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEORD Build/LVY48F)
Host: 192.168.1.16:12342
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:SetBinaryState></s:Body></s:Envelope>
2018-06-02 13:26:18 fauxmo:63       INFO     request BasicEvent1
2018-06-02 13:26:18 fauxmo:125      DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x76799f50>
2018-06-02 13:26:18 fauxmo:177      INFO     Attempting to turn on Kamera eins
2018-06-02 13:26:18 fauxmo:207      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Sat, 02 Jun 2018 11:26:18 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:SetBinaryStateResponse></s:Body></s:Envelope>
2018-06-02 13:26:18 asyncio:1427     WARNING  Executing <Handle cancelled _SelectorSocketTransport._read_ready() created at /usr/local/lib/python3.6/asyncio/selector_events.py:262> took 0.198 seconds
2018-06-02 13:26:18 asyncio:1385     DEBUG    poll took 4.806 ms: 1 events
2018-06-02 13:26:18 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 12342)>]> got a new connection from ('192.168.1.123', 56012): <socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.16', 12342), raddr=('192.168.1.123', 56012)>
2018-06-02 13:26:18 fauxmo:41       DEBUG    Connection made with: ('192.168.1.123', 56012)
2018-06-02 13:26:18 fauxmo:52       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"
Content-Type: text/xml; charset="utf-8"
Accept:
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEORD Build/LVY48F)
Host: 192.168.1.16:12342
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>
2018-06-02 13:26:18 fauxmo:63       INFO     request BasicEvent1
2018-06-02 13:26:18 fauxmo:125      DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x76799f50>
2018-06-02 13:26:18 fauxmo:151      INFO     Attempting to get state for Kamera eins
2018-06-02 13:26:18 fauxmo:162      INFO     Kamera eins state: unknown
2018-06-02 13:26:18 fauxmo:207      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Sat, 02 Jun 2018 11:26:18 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>0</BinaryState></u:GetBinaryStateResponse></s:Body></s:Envelope>
2018-06-02 13:26:19 asyncio:1385     INFO     poll took 1005.483 ms: 1 events
2018-06-02 13:26:19 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 12342)>]> got a new connection from ('192.168.1.123', 47243): <socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.16', 12342), raddr=('192.168.1.123', 47243)>
2018-06-02 13:26:19 fauxmo:41       DEBUG    Connection made with: ('192.168.1.123', 47243)
2018-06-02 13:26:19 fauxmo:52       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"
Content-Type: text/xml; charset="utf-8"
Accept:
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEORD Build/LVY48F)
Host: 192.168.1.16:12342
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>
2018-06-02 13:26:19 fauxmo:63       INFO     request BasicEvent1
2018-06-02 13:26:19 fauxmo:125      DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x76799f50>
2018-06-02 13:26:19 fauxmo:151      INFO     Attempting to get state for Kamera eins
2018-06-02 13:26:19 fauxmo:162      INFO     Kamera eins state: unknown
2018-06-02 13:26:19 fauxmo:207      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Sat, 02 Jun 2018 11:26:19 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>0</BinaryState></u:GetBinaryStateResponse></s:Body></s:Envelope>
2018-06-02 13:26:20 asyncio:1385     INFO     poll took 1004.874 ms: 1 events
2018-06-02 13:26:20 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 12342)>]> got a new connection from ('192.168.1.123', 51348): <socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.16', 12342), raddr=('192.168.1.123', 51348)>
2018-06-02 13:26:20 fauxmo:41       DEBUG    Connection made with: ('192.168.1.123', 51348)
2018-06-02 13:26:20 fauxmo:52       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"
Content-Type: text/xml; charset="utf-8"
Accept:
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEORD Build/LVY48F)
Host: 192.168.1.16:12342
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>
2018-06-02 13:26:20 fauxmo:63       INFO     request BasicEvent1
2018-06-02 13:26:20 fauxmo:125      DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x76799f50>
2018-06-02 13:26:20 fauxmo:151      INFO     Attempting to get state for Kamera eins
2018-06-02 13:26:20 fauxmo:162      INFO     Kamera eins state: unknown
2018-06-02 13:26:20 fauxmo:207      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Sat, 02 Jun 2018 11:26:20 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>0</BinaryState></u:GetBinaryStateResponse></s:Body></s:Envelope>
2018-06-02 13:26:22 asyncio:1385     INFO     poll took 2185.715 ms: 1 events
2018-06-02 13:26:22 fauxmo:341      DEBUG    Received data below from ('192.168.1.78', 56562):
2018-06-02 13:26:22 fauxmo:342      DEBUG    M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 2
ST: urn:mdx-netflix-com:service:target:0


2018-06-02 13:26:22 asyncio:1385     DEBUG    poll took 101.629 ms: 1 events
2018-06-02 13:26:22 fauxmo:341      DEBUG    Received data below from ('192.168.1.78', 56562):
2018-06-02 13:26:22 fauxmo:342      DEBUG    M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 2
ST: urn:dial-multiscreen-org:service:dial:1


2018-06-02 13:26:26 asyncio:1385     INFO     poll took 3420.515 ms: 1 events
2018-06-02 13:26:26 fauxmo:341      DEBUG    Received data below from ('192.168.1.89', 56282):
2018-06-02 13:26:26 fauxmo:342      DEBUG    M-SEARCH * HTTP/1.1
Host:239.255.255.250:1900
ST:urn:schemas-upnp-org:service:WANIPConnection:1
Man:"ssdp:discover"
MX:3

pi@base:~ $ curl -v http://192.168.1.18:8080/displayCamera/1
*   Trying 192.168.1.18...
* TCP_NODELAY set
* Connected to 192.168.1.18 (192.168.1.18) port 8080 (#0)
> GET /displayCamera/1 HTTP/1.1
> Host: 192.168.1.18:8080
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 16
< Date: Sun, 03 Jun 2018 08:07:49 GMT
< Server: dashboard
<
* Curl_http_done: called premature == 0
* Connection #0 to host 192.168.1.18 left intact
{"status": "OK"}pi@base:~ $

Response is json and response code is 200

Huh, I can't replicate.

Here's how I tested:

  1. On a separate device (with no firewall interference), run python3 -m http.server --bind '0.0.0.0' 9999, which starts up an http server that should allow you to GET the directory contents at the root path, or a specific filename by using the filename as the path.
  2. Configure Fauxmo, with the relevant portion being:
    "SimpleHTTPPlugin": {
        "DEVICES": [
            {
                "name": "Fake Test Switch",
                "on_cmd": "http://server-ip-address:9999/file-that-exists.txt",
                "off_cmd": "http://server-ip-address:9999/",
                "method": "GET",
                "port": 43752
            }
    ]
  3. In Alexa, discover devices and make sure Fake Test Switch shows up
  4. Turn on Fake Test Switch, and watch the logs for the python http server. As long as you listed the root directory or an existing file path, you should get a 200 response code, and Alexa should reply "OK."

Of note, if you list a file that doesn't exist, you'll get a 404 and Alexa will reply that the device is not responding.

Can you try this and report back?

Tested the above setting, but it doesn't work either :-(
When having

"name": "Monitor",
"on_cmd" = "http://192.168.1.16:9999/foo.txt"

The python http server reports

"GET /foo.txt HTTP/1.1" 200 -

The logs are:

2018-06-04 21:05:21 fauxmo:37       INFO     Fauxmo v0.4.7
2018-06-04 21:05:21 fauxmo:38       DEBUG    3.6.4 (default, Feb 27 2018, 19:46:24)
[GCC 6.3.0 20170516]
2018-06-04 21:05:21 fauxmo:24       DEBUG    Attempting to get IP address automatically
2018-06-04 21:05:21 fauxmo:40       DEBUG    Using IP address: 192.168.1.16
2018-06-04 21:05:21 fauxmo:100      DEBUG    plugin_vars: {}
2018-06-04 21:05:21 fauxmo:103      DEBUG    device config: {'name': 'Monitor', 'on_cmd': 'http://192.168.1.16:9999/foo.txt', 'off_cmd': 'http://192.168.1.16:9999/', 'method': 'GET', 'port': 43752}
2018-06-04 21:05:21 asyncio:1068     INFO     <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 43752)>]> is serving
2018-06-04 21:05:21 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'Monitor', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75d81690>}
2018-06-04 21:05:21 fauxmo:123      INFO     Starting UDP server
2018-06-04 21:05:21 asyncio:948      DEBUG    Datagram endpoint remote_addr=None created: (<_SelectorDatagramTransport fd=8 read=idle write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0x75d813b0>)
2018-06-04 21:05:48 asyncio:1385     INFO     poll took 27019.215 ms: 1 events
2018-06-04 21:05:48 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 43752)>]> got a new connection from ('192.168.1.123', 35417): <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.16', 43752), raddr=('192.168.1.123', 35417)>
2018-06-04 21:05:48 fauxmo:41       DEBUG    Connection made with: ('192.168.1.123', 35417)
2018-06-04 21:05:48 fauxmo:52       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
SOAPACTION: "urn:Belkin:service:basicevent:1#SetBinaryState"
Content-Type: text/xml; charset="utf-8"
Accept:
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEORD Build/LVY48F)
Host: 192.168.1.16:43752
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:SetBinaryState></s:Body></s:Envelope>
2018-06-04 21:05:48 fauxmo:63       INFO     request BasicEvent1
2018-06-04 21:05:48 fauxmo:125      DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75d81690>
2018-06-04 21:05:48 fauxmo:177      INFO     Attempting to turn on Monitor
2018-06-04 21:05:48 fauxmo:207      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Mon, 04 Jun 2018 19:05:48 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:SetBinaryStateResponse></s:Body></s:Envelope>
2018-06-04 21:05:48 asyncio:1385     DEBUG    poll took 7.369 ms: 1 events
2018-06-04 21:05:48 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 43752)>]> got a new connection from ('192.168.1.123', 48322): <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.16', 43752), raddr=('192.168.1.123', 48322)>
2018-06-04 21:05:48 fauxmo:41       DEBUG    Connection made with: ('192.168.1.123', 48322)
2018-06-04 21:05:48 fauxmo:52       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"
Content-Type: text/xml; charset="utf-8"
Accept:
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEORD Build/LVY48F)
Host: 192.168.1.16:43752
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>
2018-06-04 21:05:48 fauxmo:63       INFO     request BasicEvent1
2018-06-04 21:05:48 fauxmo:125      DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75d81690>
2018-06-04 21:05:48 fauxmo:151      INFO     Attempting to get state for Monitor
2018-06-04 21:05:48 fauxmo:162      INFO     Monitor state: unknown
2018-06-04 21:05:48 fauxmo:207      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Mon, 04 Jun 2018 19:05:48 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>0</BinaryState></u:GetBinaryStateResponse></s:Body></s:Envelope>
2018-06-04 21:05:49 asyncio:1385     INFO     poll took 1009.335 ms: 1 events
2018-06-04 21:05:49 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 43752)>]> got a new connection from ('192.168.1.123', 44702): <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.16', 43752), raddr=('192.168.1.123', 44702)>
2018-06-04 21:05:49 fauxmo:41       DEBUG    Connection made with: ('192.168.1.123', 44702)
2018-06-04 21:05:49 fauxmo:52       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"
Content-Type: text/xml; charset="utf-8"
Accept:
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEORD Build/LVY48F)
Host: 192.168.1.16:43752
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>
2018-06-04 21:05:49 fauxmo:63       INFO     request BasicEvent1
2018-06-04 21:05:49 fauxmo:125      DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75d81690>
2018-06-04 21:05:49 fauxmo:151      INFO     Attempting to get state for Monitor
2018-06-04 21:05:49 fauxmo:162      INFO     Monitor state: unknown
2018-06-04 21:05:49 fauxmo:207      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Mon, 04 Jun 2018 19:05:49 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>0</BinaryState></u:GetBinaryStateResponse></s:Body></s:Envelope>
2018-06-04 21:05:50 asyncio:1385     INFO     poll took 1003.581 ms: 1 events
2018-06-04 21:05:50 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 43752)>]> got a new connection from ('192.168.1.123', 57716): <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.16', 43752), raddr=('192.168.1.123', 57716)>
2018-06-04 21:05:50 fauxmo:41       DEBUG    Connection made with: ('192.168.1.123', 57716)
2018-06-04 21:05:50 fauxmo:52       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"
Content-Type: text/xml; charset="utf-8"
Accept:
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEORD Build/LVY48F)
Host: 192.168.1.16:43752
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>
2018-06-04 21:05:50 fauxmo:63       INFO     request BasicEvent1
2018-06-04 21:05:50 fauxmo:125      DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75d81690>
2018-06-04 21:05:50 fauxmo:151      INFO     Attempting to get state for Monitor
2018-06-04 21:05:50 fauxmo:162      INFO     Monitor state: unknown
2018-06-04 21:05:50 fauxmo:207      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Mon, 04 Jun 2018 19:05:50 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>0</BinaryState></u:GetBinaryStateResponse></s:Body></s:Envelope>
2018-06-04 21:06:13 asyncio:1385     INFO     poll took 22725.174 ms: 1 events
2018-06-04 21:06:13 fauxmo:341      DEBUG    Received data below from ('192.168.1.1', 41254):
2018-06-04 21:06:13 fauxmo:342      DEBUG    NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age=120
LOCATION: http://192.168.1.1:59862/rootDesc.xml
SERVER: AsusWRT/3.0.0.4 UPnP/1.1 MiniUPnPd/1.9
NT: upnp:rootdevice
USN: uuid:695a6ceb-944c-4f57-bb3b-78ecf03d86ce::upnp:rootdevice
NTS: ssdp:alive
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 1
BOOTID.UPNP.ORG: 1
CONFIGID.UPNP.ORG: 1337


2018-06-04 21:06:13 asyncio:1385     DEBUG    poll took 0.159 ms: 1 events
2018-06-04 21:06:13 fauxmo:341      DEBUG    Received data below from ('192.168.1.1', 41254):
2018-06-04 21:06:13 fauxmo:342      DEBUG    NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age=120
LOCATION: http://192.168.1.1:59862/rootDesc.xml
SERVER: AsusWRT/3.0.0.4 UPnP/1.1 MiniUPnPd/1.9
NT: urn:schemas-upnp-org:device:InternetGatewayDevice:1
USN: uuid:695a6ceb-944c-4f57-bb3b-78ecf03d86ce::urn:schemas-upnp-org:device:InternetGatewayDevice:1
NTS: ssdp:alive
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 1
BOOTID.UPNP.ORG: 1
CONFIGID.UPNP.ORG: 1337

After the SetBinaryState it tries 3 times GetBinaryState, even if the response is already 200 after the first GetBinaryState. Look like it does not recognize the response correctly?

Do you have the same FW version of Echo?

If I configure

    "state_cmd": "http://192.168.1.16:8080/status",
    "state_response_on": "OK",
    "state_response_off": "OFF",

and the URL http://192.168.1.16:8080/status returns always OK (fake status URL) the thing works! Seems like the status URL is always needed, since the device is discovered by the Alexa app as a switch?
But what if I don't have the possibility to get the device state?

? SimpleHTTPlugin doesn't have a state_response_on -- are you looking at RESTAPIPlugin?

Echo FW: 608488620
Dot FW: 608490720

I think there's something else going on -- I did not set a status URL and mine worked fine, the test config above was literally copied and pasted.

Sorry I didn't notice earlier, but why is your on and off command the same thing?

"on_cmd": "http://192.168.1.18:8080/displayCamera/1",
"off_cmd": "http://192.168.1.18:8080/displayCamera/1",

As far as I can tell, your latest log makes it look like it's working properly:

2018-06-04 21:05:48 asyncio:1385     INFO     poll took 27019.215 ms: 1 events
2018-06-04 21:05:48 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.16', 43752)>]> got a new connection from ('192.168.1.123', 35417): <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.16', 43752), raddr=('192.168.1.123', 35417)>
2018-06-04 21:05:48 fauxmo:41       DEBUG    Connection made with: ('192.168.1.123', 35417)
2018-06-04 21:05:48 fauxmo:52       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
SOAPACTION: "urn:Belkin:service:basicevent:1#SetBinaryState"
Content-Type: text/xml; charset="utf-8"
Accept:
User-Agent: Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEORD Build/LVY48F)
Host: 192.168.1.16:43752
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 299

<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:SetBinaryState></s:Body></s:Envelope>
2018-06-04 21:05:48 fauxmo:63       INFO     request BasicEvent1
2018-06-04 21:05:48 fauxmo:125      DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75d81690>
2018-06-04 21:05:48 fauxmo:177      INFO     Attempting to turn on Monitor
2018-06-04 21:05:48 fauxmo:207      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Mon, 04 Jun 2018 19:05:48 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:SetBinaryStateResponse></s:Body></s:Envelope>

Sorry I didn't notice earlier, but why is your on and off command the same thing?

"on_cmd": "http://192.168.1.18:8080/displayCamera/1",
"off_cmd": "http://192.168.1.18:8080/displayCamera/1",

This is just because I trigger a web cam to stream live pictures on a TV screen. There is a timer implemented, which turns the webcam off automatically, so I just don't need an off_cmd

? SimpleHTTPlugin doesn't have a state_response_on -- are you looking at RESTAPIPlugin

Hmmm... no I definitely configured SimpleHTTPPlugin

The firmware however differs. You don't have 608490620

I want to go back to your post above:

If I configure

"state_cmd": "http://192.168.1.16:8080/status",
"state_response_on": "OK",
"state_response_off": "OFF",

As discussed above, state_response_on isn't a recognized argument for SimpleHTTPPlugin, so I assume it's just getting handed off in **kwargs somewhere and ignored.

Since it seems like it was working when you put in a (fake?) state_cmd, can you go back and try one configuration with state_cmd and one without, post the verbose logs for each, and report back the results (whether or not you got the "does not react" response)?

Bump -- will close in 1 week due to inactivity if no response

I have a similar issue, and the mention of a 'timer for turning off' I suspect is the issue.

To turn the relay on on my raspberry Pi the http request runs a PHP script

"on_command": "http://192.168.1.129/sprinkler3.php"

This basically runs another php script that turns on GPIO pin, sleeps 5 minutes, turns GPIO off

This works, and your get an 'OK' from Alexa, but it locks up the Pi while the timer runs, so you can't issue another Alexa command to turn it back off during the countdown.

I modified it so the timer runs in background -

The sprinkler3.php file is basically

sprinkler1on.php being the on / sleep / off script - at now & disown is to make the timer run in the background and let the php process continue.

Now when I say Alexa turn on Sprinkler 3 the relay clicks on and stays on for the sleep duration set, but Alexa responds "Sprinkler3 isn't responding" I can now however say "Alexa turn off Sprinkler3" and it does go off before the timer expires.

So while the timer appears to run in background, and continue. It doesn't give the correct response to Alexa that the command has been successfully executed.

This functionality would be great to get working, as there are numerous people asking for a 'turn this device on for X minutes' option. My application being a garden sprinkler.

Just had a play with command line plugin. Used this to execute the same sprinkler3.php file on the command line. Problem solved. Great program this !

@consumerize this sounds like a problem with your PHP app -- Fauxmo just checks the response code. If it is 200 or 201, it reports to the Echo that the command was a success. If your PHP server is waiting for the full 5 minutes before it responds then that's a problem -- the Echo has a built-in timeout (that I don't remember off hand).

Modifying it to run its request in the background and make sure it responds with a successful response code should resolve the problem.

I think @RaphaelVogel's problem may have been something different, since it is clearly responding with a 200, and based off the timestamps seems to be doing so at the time of the initial request.

Hello, I think I have the same problem or might be not.

I wanted to control my logitech media server. I was capable to start the music and it plays without problem. However, the status for the Faux WeMo device in Alexa changes from on to off after couple seconds.

I have this config.json:

{ "FAUXMO": { "ip_address": "auto" }, "PLUGINS": { "SimpleHTTPPlugin": { "DEVICES": [{ "port": 12340, "on_cmd": "http://192.168.2.186:9000/status.html?p0=playlist&p1=play&p2=http://prem4.di.fm/deephouse&player=cc%3Acc%3A11%3A81%3A45%3A28", "off_cmd": "http://192.168.2.186:9000/status.html?p0=stop&player=cc%3Acc%3A11%3A81%3A45%3A28", "method": "GET", "name": "Deep House" }, { "port": 12341, "on_cmd": "http://192.168.2.186:9000/status.html?p0=playlist&p1=play&p2=http://prem1.di.fm/jazzhouse&player=cc%3Acc%3A11%3A81%3A45%3A28", "off_cmd": "http://192.168.2.186:9000/status.html?p0=stop&player=cc%3Acc%3A11%3A81%3A45%3A28", "method": "GET", "name": "Jazz House" }] } } }

BTW, I removed the DI PASS KEY from the URL. But, it doesn't impact at the end.

The debug that I get is:

`<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1">0</u:GetBinaryStateResponse></s:Body></s:Envelope>
2018-08-25 12:21:17 asyncio:1379 INFO poll took 5053.374 ms: 1 events
2018-08-25 12:21:17 asyncio:182 DEBUG <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.2.186', 12340)>]> got a new connection from ('192.168.2.134', 44201): <socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.2.186', 12340), raddr=('192.168.2.134', 44201)>
2018-08-25 12:21:17 fauxmo:41 DEBUG Connection made with: ('192.168.2.134', 44201)
2018-08-25 12:21:17 fauxmo:52 DEBUG Received message:
POST /upnp/control/basicevent1 HTTP/1.1
Host: 192.168.2.186:12340
Accept: /
Content-type: text/xml; charset="utf-8"
SOAPACTION: "urn:Belkin:service:basicevent:1#SetBinaryState"
Content-Length: 299

1

2018-08-25 12:21:17 fauxmo:63 INFO request BasicEvent1
2018-08-25 12:21:17 fauxmo:125 DEBUG Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0xb5f75170>
2018-08-25 12:21:17 fauxmo:177 INFO Attempting to turn on Deep House
2018-08-25 12:21:18 fauxmo:207 DEBUG HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Sat, 25 Aug 2018 16:21:18 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryStateResponse xmlns:u="urn:Belkin:service:basicevent:1">1</u:SetBinaryStateResponse></s:Body></s:Envelope>
2018-08-25 12:21:18 asyncio:1421 WARNING Executing <Handle cancelled _SelectorSocketTransport._read_ready() created at /usr/local/lib/python3.6/asyncio/selector_events.py:262> took 0.684 seconds
2018-08-25 12:21:21 asyncio:1379 INFO poll took 3269.034 ms: 1 events
2018-08-25 12:21:21 asyncio:182 DEBUG <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.2.186', 12340)>]> got a new connection from ('192.168.2.134', 44202): <socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.2.186', 12340), raddr=('192.168.2.134', 44202)>
2018-08-25 12:21:21 fauxmo:41 DEBUG Connection made with: ('192.168.2.134', 44202)
2018-08-25 12:21:21 fauxmo:52 DEBUG Received message:
POST /upnp/control/basicevent1 HTTP/1.1
Host: 192.168.2.186:12340
Accept: /
Content-type: text/xml; charset="utf-8"
SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"
Content-Length: 299

1

2018-08-25 12:21:21 fauxmo:63 INFO request BasicEvent1
2018-08-25 12:21:21 fauxmo:125 DEBUG Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0xb5f75170>
2018-08-25 12:21:21 fauxmo:151 INFO Attempting to get state for Deep House
2018-08-25 12:21:21 fauxmo:162 INFO Deep House state: unknown
2018-08-25 12:21:21 fauxmo:207 DEBUG HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Sat, 25 Aug 2018 16:21:21 GMT
EXT:
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close`

As you can see,, I get the OK, but it seems that Alexa tries to get the state and it appears as unknown.

Is there something that I am missing?

Thank you in advance.

I've read the simplehttpplugin code. Now, I understand why I am getting the "unknown". What I want is not supported. But, I willl change to my needs. Great job, BTW

Thanks.

If there is a REST / http endpoint that will give you the current state / status, you should be able to write a custom state_cmd and get it to work.

I've read the simplehttpplugin code. Now, I understand why I am getting the "unknown". What I want is not supported. But, I willl change to my needs. Great job, BTW

Thank you for your answer. I’ve already done custom state_cmd and it is working. But, I want to do something more broad for the squeezebox server and create better plugin which other people can use.