Giter Site home page Giter Site logo

n8henrie / fauxmo Goto Github PK

View Code? Open in Web Editor NEW
348.0 35.0 73.0 476 KB

Emulated Belkin WeMo devices that work with the Amazon Echo

Home Page: https://n8henrie.com/2016/02/fauxmo-home-automation-with-the-amazon-echo-raspberry-pi-and-homeassistant/

License: Other

Python 86.88% Makefile 2.44% Dockerfile 1.18% Nix 9.50%
python3 home-automation amazon-echo echo

fauxmo's Introduction

Fauxmo README

master: master branch build status dev: dev branch build status

Python 3 module that emulates Belkin WeMo devices for use with the Amazon Echo.

Originally forked from https://github.com/makermusings/fauxmo, unforked to enable GitHub code search (which currently doesn't work in a fork), and because the libraries have diverged substantially.

Introduction

The Amazon Echo is able to control certain types of home automation devices by voice. Fauxmo provides emulated Belkin Wemo devices that the Echo can turn on and off by voice, locally, and with minimal lag time. Currently these Fauxmo devices can be configured to make requests to an HTTP server such as Home Assistant or to run other commands locally on the device and only require a JSON config file for setup.

As of version v0.4.0, Fauxmo uses several API features and f-strings that require Python 3.6+. I highly recommend looking into pyenv if you're currently on an older Python version and willing to upgrade. Otherwise, check out the FAQ section at the bottom for tips on installing an older Fauxmo version (though note that I will not be continuing development or support for older versions).

For what it's worth, if you're concerned about installing pyenv on a low-resource machine like the Raspberry Pi, I encourage you to review my notes on the size and time required to install Python 3.6 with pyenv on a Raspberry Pi and the nontrivial improvement in speed (with a simple pystone benchmark) using an optimized pyenv-installed 3.6 as compared to the default Raspbian 3.5.3.

Terminology

faux (\ˈfō\): imitation

WeMo: Belkin home automation product with which the Amazon Echo can interface

Fauxmo (\ˈfō-mō\): Python 3 module that emulates Belkin WeMo devices for use with the Amazon Echo.

Fauxmo has a server component that helps register "devices" with the Echo (which may be referred to as the Fauxmo server or Fauxmo core). These devices are then exposed individually, each requiring its own port, and may be referred to as a Fauxmo device or a Fauxmo instance. The Echo interacts with each Fauxmo device as if it were a separate WeMo device.

Usage

Installation into a venv is highly recommended, especially since it's baked into the recent Python versions that Fauxmo requires.

Additionally, please ensure you're using a recent version of pip (>= 9.0.1) prior to installation: pip install --upgrade pip

Simple install: From PyPI

  1. python3 -m venv .venv
  2. source ./.venv/bin/activate
  3. python3 -m pip install fauxmo
  4. Make a config.json based on config-sample.json
  5. fauxmo -c config.json [-v]

As of v0.6.0, you can optionally install uvloop for potentially better performance, which might be helpful if you have a large number of devices or a network with lots of broadcast mdns traffic. If it is present, fauxmo will take advantage. It is not terribly difficult to install uvloop but you are on your own: https://github.com/MagicStack/uvloop.

Simple install of dev branch from GitHub

This is a good strategy for testing features in development -- for actually contributing to development, clone the repo as per below)

  1. python3 -m venv .venv
  2. source ./.venv/bin/activate
  3. pip install [-e] git+https://github.com/n8henrie/fauxmo.git@dev

Install for development from GitHub

  1. git clone https://github.com/n8henrie/fauxmo.git
  2. cd fauxmo
  3. python3 -m venv .venv
  4. source ./.venv/bin/activate
  5. pip install -e .[dev,test]
  6. cp config-sample.json config.json
  7. Edit config.json
  8. fauxmo [-v]

Set up the Echo

  1. Open the Amazon Alexa webapp to the Smart Home page
  2. With Fauxmo running, click "Discover devices" (or tell Alexa to "find connected devices")
  3. Ensure that your Fauxmo devices were discovered and appear with their names in the web interface
  4. Test: "Alexa, turn on [the kitchen light]"

Set Fauxmo to run automatically in the background

NB: As discussed in #20, the example files in extras/ are not included when you install from PyPI* (using pip). If you want to use them, you either need to clone the repo or you can download them individually using tools like wget or curl by navigating to the file in your web browser, clicking the Raw button, and using the resulting URL in your address bar.

* As of Fauxmo v0.4.0 extras/ has been added to MANIFEST.in and may be included somewhere depending on installation from the .tar.gz vs whl format -- if you can't find them, you should probably just get the files manually as described above.

systemd (e.g. Raspbian Jessie)

  1. Recommended: add an unprivileged user to run Fauxmo: sudo useradd -r -s /bin/false fauxmo
    • NB: Fauxmo may require root privileges if you're using ports below 1024
  2. sudo cp extras/fauxmo.service /etc/systemd/system/fauxmo.service
  3. Edit the paths in /etc/systemd/system/fauxmo.service
  4. sudo systemctl enable fauxmo.service
  5. sudo systemctl start fauxmo.service

launchd (OS X)

  1. cp extras/com.n8henrie.fauxmo.plist ~/Library/LaunchAgents/com.n8henrie.fauxmo.plist
  2. Edit the paths in ~/Library/LaunchAgents/com.n8henrie.fauxmo.plist
    • You can remove the StandardOutPath and StandardErrorPath sections if desired
  3. launchctl load ~/Library/LaunchAgents/com.n8henrie.fauxmo.plist
  4. launchctl start com.n8henrie.fauxmo

Plugins

Plugins are small user-extendible classes that allow users to easily make their own actions for Fauxmo to run by way of Alexa commands. They were previously called Handlers and may be referred to as such in places in the code and documentation.

Fauxmo v0.4.0 implements a new and breaking change in the way Handlers were implemented in previous versions, which requires modification of the config.json file (as described below).

A few plugins and the ABC from which the plugins are required to inherit may be included and installed by default in the fauxmo.plugins package. Any pre-installed plugins, like the rest of the core Fauxmo code, have no third party dependencies.

So far, the pre-installed plugins include:

SimpleHTTPPlugin responds to Alexa's on and off commands by making requests to URL endpoints by way of urllib. Example uses cases relevant to the IOT community might be a Flask server served from localhost that provides a nice web interface for toggling switches, whose endpoints could be added as the on_cmd and off_cmd args to a SimpleHTTPPlugin instance to allow activation by way of Alexa -> Fauxmo.

As of Fauxmo v0.4.5, the FauxmoPlugin abstract base class (and therefore all derivate Fauxmo plugins) requires a get_state method, which tells Alexa a device's state. If you don't have a way to determine devices state, you can just have your get_state method return "unknown", but please review the notes on get_state below.

Also, see details regarding plugin configuration in each class's docstring, which I intend to continue as a convention for Fauxmo plugins. Users hoping to make more complicated requests may be interested in looking at RESTAPIPlugin in the fauxmo-plugins repository, which uses Requests for a much friendlier API.

User plugins

Users can easily create their own plugins, which is the motivation behind most of the changes in Fauxmo v0.4.0.

To get started:

  1. Decide on a name for your plugin class. I highly recommend something descriptive, CamelCase and a Plugin suffix, e.g. FooSwitcherPlugin.

  2. I strongly recommend naming your module the same as the plugin, but in all lower case, e.g. fooswitcherplugin.py.

  3. Note the path to your plugin, which will need to be included in your config.json as path (absolute path recommended, ~ for homedir is okay).

  4. Write your class, which must at minimum:

    • inherit from fauxmo.plugins.FauxmoPlugin.
    • provide the methods on(), off(), and get_state().
      • Please note that unless the Echo has a way to determine the device state, it will likely respond that your "device is not responding" after you turn a device on (or in some cases off, or both), but it should still be able to switch the device.
      • If you want to ignore the actual device's state and just return the last successful action as the current state (e.g. if device.on() succeeded then return "on"), your plugin can return super().get_state() as its get_state() method. Some of the included plugins can be configured to have this behavior using a use_fake_state flag in their configuration (please look at the documentation and source code of the plugins for further details). Note that this means it won't update to reflect state changes that occur outside of Fauxmo (e.g. manually flipping a switch, or toggling with a different program), whereas a proper get_state implementation may be able to do so.
      • If using fake state or if your device cannot readily report its state upon request (for example if you poll for state with a background process like mqtt), you should also set an initial_state in your config. As of August 2023, prior to adding a newly discovered device, Alexa requests its state and will fail to add the device if it can't report a state.
  5. Any required settings will be read from your config.json and passed into your plugin as kwargs at initialization, see below.

In addition to the above, if you intend to share your plugin with others, I strongly recommend that you:

  • Include generous documentation as a module level docstring.
  • Note specific versions of any dependencies in that docstring.
    • Because these user plugins are kind of "side-loaded," you will need to manually install their dependencies into the appropriate environment, so it's important to let other users know exactly what versions you use.

Be aware, when fauxmo loads a plugin, it will add the directory containing the plugin to the Python path, so any other Python modules in this directory might be loaded by unscrupulous code. This behavior was adopted in part to facilitate installing any plugin dependencies in a way that will be available for import (e.g. cd "$MYPLUGINPATH"; pip install -t $MYPLUGINDEPS).

Notable plugin examples

NB: You may need to manually install additional dependencies for these to work -- look for the dependencies in the module level docstring.

  • https://github.com/n8henrie/fauxmo-plugins
    • RESTAPIPlugin
      • Trigger HTTP requests with your Echo.
      • Similar to SimpleHTTPPlugin, but uses Requests for a simpler API and easier modification.
    • MQTTPlugin
      • Trigger MQTT events with your Echo
    • User contributions of interesting plugins are more than welcome!

Configuration

I recommend that you copy and modify config-sample.json. Fauxmo will use whatever config file you specify with -c or will search for config.json in the current directory, ~/.config/fauxmo, ~/.fauxmo/, and /etc/fauxmo/ (in that order). The minimal configuration settings are:

  • FAUXMO: General Fauxmo settings
    • ip_address: Optional[str] - Manually set the server's IP address. Recommended value: "auto".
  • PLUGINS: Top level key for your plugins, values should be a dictionary of (likely CamelCase) class names, spelled identically to the plugin class, with each plugin's settings as a subdictionary.
    • ExamplePlugin: Your plugin class name here, case sensitive.
      • path: The absolute path to the Python file in which the plugin class is defined (please see the section on user plugins above). Required for user plugins / plugins not pre-installed in the fauxmo.plugins subpackage.
      • example_var1: For convenience and to avoid redundancy, your plugin class can optionally use config variables at this level that will be shared for all DEVICES listed in the next section (e.g. an API key that would be shared for all devices of this plugin type). If provided, your plugin class must consume this variable in a custom __init__.
      • DEVICES: List of devices that will employ ExamplePlugin
        • name: Optional[str] -- Name for this device. Optional in the sense that you can leave it out of the config as long as you set it in your plugin code as the _name attribute, but it does need to be set somewhere. If you omit it from config you will also need to override the __init__ method, which expects a name kwarg.
        • port: Optional[int] -- Port that Echo will use connect to device. Should be different for each device, Fauxmo will attempt to set automatically if absent from config. NB: Like name, you can choose to set manually in your plugin code by overriding the _port attribute (and the __init__ method, which expects a port kwarg otherwise).
        • example_var2: Config variables for individual Fauxmo devices can go here if needed (e.g. the URL that should be triggered when a device is activated). Again, your plugin class will need to consume them in a custom __init__.

Each user plugin should describe its required configuration in its module-level docstring. The only required config variables for all plugins is DEVICES, which is a List[dict] of configuration variables for each device of that plugin type. Under DEVICES it is a good idea to set a fixed, high, free port for each device, but if you don't set one, Fauxmo will try to pick a reasonable port automatically (though it will change for each run).

Please see config-sample.json for a more concrete idea of the structure of the config file, using the built-in SimpleHTTPPlugin for demonstration purposes. Below is a description of the kwargs that SimpleHTTPPlugin accepts.

  • name: What you want to call the device (how to activate by Echo)
  • port: Port the Fauxmo device will run on
  • on_cmd: str -- URL that should be requested to turn device on.
  • off_cmd: str -- URL that should be requested to turn device off.
  • state_cmd: str -- URL that should be requested to query device state
  • method / state_method: Optional[str] = GET -- GET, POST, PUT, etc.
  • headers: Optional[dict] -- Extra headers
  • on_data / off_data / state_data: Optional[dict] -- POST data
  • state_response_on / state_response_off: str -- If this string is in contained in the response from state_cmd, then the devices is on or off, respectively
  • user / password: Optional[str] -- Enables HTTP authentication (basic or digest only)
  • use_fake_state: Optional[bool] -- If True, override the plugin's get_state method to return the latest successful action as the device state. NB: The proper json boolean value for Python's True is true, not True or "true".

Security

I am not a technology professional and make no promises regarding the security of this software. Specifically, plugins such as CommandLinePlugin execute arbitrary code from your configuration without any validation. If your configuration can be tampered with, you're in for a bad time.

That said, if your configuration can be tampered with (i.e. someone already has write access on your machine), then you likely have bigger problems.

Regardless, a few reasonable precautions that I recommend:

  • run fauxmo in a virtulaenv, even without any dependencies
  • run fauxmo as a dedicated unprivileged user with its own group
  • remove write access from the fauxmo user and group for your config file and any plugin files (perhaps chmod 0640 config.json; chown me:fauxmo config.json)
  • consider using a firewall like ufw, but don't forget that you'll need to open up ports for upnp (1900, UDP) and ports for all your devices that you've configured (in config.json).

For example, if I had 4 echo devices at 192.168.1.5, 192.168.1.10, 192.168.1.15, and 192.168.1.20, and Fauxmo was configured with devices at each of port 12345-12350, to configure ufw I might run something like:

$ for ip in 5 10 15 20; do
    sudo ufw allow \
        from 192.168.1."$ip" \
        to any \
        port 1900 \
        proto udp \
        comment "fauxmo upnp"
    sudo ufw allow \
        from 192.168.1."$ip" \
        to any \
        port 12345:12350 \
        proto tcp \
        comment "fauxmo devices"
done

You use Fauxmo at your own risk, with or without user plugins.

Troubleshooting / FAQ

Your first step in troubleshooting should probably be to "forget all devices" (which as been removed from the iOS app but is still available at alexa.amazon.com), re-discover devices, and make sure to refresh your device list (e.g. pull down on the "devices" tab in the iOS app, or just close out the app completely and re-open).

  • How can I increase my logging verbosity?
    • -v[vv]
    • -vv (logging.INFO) is a good place to start when debugging
  • How can I ensure my config is valid JSON?
    • python -m json.tool < config.json
    • Use jsonlint or one of numerous online tools
  • How can I install an older / specific version of Fauxmo?
    • Install from a tag:
    • Install from a specific commit:
      • pip install git+git://github.com/n8henrie/fauxmo.git@d877c513ad45cbbbd77b1b83e7a2f03bf0004856
  • Where can I get more information on how the Echo interacts with devices like Fauxmo?
  • Does Fauxmo work with non-Echo emulators like Alexa AVS or Echoism.io?
  • How do I find my Echo firmware version?

Installing Python 3.10 with pyenv

sudo install -o $(whoami) -g $(whoami) -d /opt/pyenv
git clone https://github.com/pyenv/pyenv /opt/pyenv
cat <<'EOF' >> ~/.bashrc
export PYENV_ROOT="/opt/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
EOF
source ~/.bashrc
pyenv install 3.10.6

You can then install Fauxmo into Python 3.10 in a few ways, including:

# Install with pip
"$(pyenv root)"/versions/3.10.6/bin/python3.10 -m pip install fauxmo

# Show full path to Fauxmo console script
pyenv which fauxmo

# Run with included console script
fauxmo -c /path/to/config.json -vvv

# I recommend using the full path for use in start scripts (e.g. systemd, cron)
"$(pyenv root)"/versions/3.10.6/bin/fauxmo -c /path/to/config.json -vvv

# Alternatively, this also works (after `pip install`)
"$(pyenv root)"/versions/3.10.6/bin/python3.10 -m fauxmo.cli -c config.json -vvv

Docker (alpha)

I'm not a heavy docker user, but I thought it might be helpful to also provide a docker image.

The Dockerfile can be run locally from a copy of the repo; you'll obviously need to change config-sample.json to an absolute path to your config.json.

$ docker run --network=host --rm -it \
    -v $(pwd)/config-sample.json:/etc/fauxmo/config.json:ro \
    "$(docker build -q .)"

As far as I'm aware the network=host will be unavoidable due to the need to listen (and respond) to UPnP broadcasts.

Buy Me a Coffee

☕️

Acknowledgements / Reading List

fauxmo's People

Contributors

clach04 avatar ddimitriou avatar dowhilegeek avatar hestela avatar howdypierce avatar jgstew avatar makermusings avatar n8henrie avatar raphael-vogel avatar roidayan avatar schneideradam avatar scop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fauxmo's Issues

Starting UDP on Windows10 Python 3.6

Hi Nathan, great concept, I'm just have some (probably self-inflicted) challenges getting it to spin-up.
Apologies if I'm being dumb. It's very likely :-)
I'm using the sample config with 'auto' ip address setting.

  • Operating system and version:
    Windows 10
  • Python version:
    3.6
  • Fauxmo version (fauxmo --help):
    v0.4

My Issue

an issue starting the UDP server.

fauxmo -c config-sample.json -vvv
D:>fauxmo -c config-sample.json -vvv
2017-04-30 11:34:49 fauxmo:38 INFO Fauxmo version 0.4.0
2017-04-30 11:34:49 fauxmo:39 DEBUG 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)]
2017-04-30 11:34:49 fauxmo:20 DEBUG Attempting to get IP address automatically
2017-04-30 11:34:49 fauxmo:33 DEBUG Using IP address: 192.168.1.93
2017-04-30 11:34:49 fauxmo:103 DEBUG plugin_vars: {}
2017-04-30 11:34:49 fauxmo:106 DEBUG device config: {'port': 12340, 'on_cmd': 'http://192.168.1.104/myserver/fakeswitches/01/on', 'off_cmd': 'http://192.168.1.104/myserver/fakeswitches/01/off', 'method': 'GET', 'name': 'fake switch one'}
2017-04-30 11:34:49 asyncio:1067 INFO <Server sockets=[<socket.socket fd=724, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.93', 12340)>]> is serving
2017-04-30 11:34:49 fauxmo:124 DEBUG Started fauxmo device: {'name': 'fake switch one', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x043121B0>}
2017-04-30 11:34:49 fauxmo:106 DEBUG device config: {'port': 12341, 'on_cmd': 'http://localhost:54321/devices/garage%20light', 'off_cmd': 'http://localhost:54321/devices/garage%20light', 'on_data': {'isOn': 1}, 'off_data': {'isOn': 0}, 'user': 'this', 'password': 'that', 'method': 'PUT', 'name': 'fake Indigo switch'}
2017-04-30 11:34:49 asyncio:1067 INFO <Server sockets=[<socket.socket fd=744, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.93', 12341)>]> is serving
2017-04-30 11:34:49 fauxmo:124 DEBUG Started fauxmo device: {'name': 'fake Indigo switch', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x03B13270>}
2017-04-30 11:34:49 fauxmo:106 DEBUG device config: {'name': 'fake home assistant switch by REST API', 'port': 12342, 'on_cmd': 'http://192.168.1.104:8123/api/services/switch/turn_on', 'off_cmd': 'http://192.168.1.104:8123/api/services/switch/turn_off', 'method': 'POST', 'headers': {'x-ha-access': 'your_hass_password'}, 'on_data': {'entity_id': 'switch.fake_hass_switch'}, 'off_data': {'entity_id': 'switch.fake_hass_switch'}}
2017-04-30 11:34:49 asyncio:1067 INFO <Server sockets=[<socket.socket fd=436, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.93', 12342)>]> is serving
2017-04-30 11:34:49 fauxmo:124 DEBUG Started fauxmo device: {'name': 'fake home assistant switch by REST API', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x045F3A10>}
2017-04-30 11:34:49 fauxmo:126 INFO Starting UDP server
UDP
Traceback (most recent call last):
File "d:\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "d:\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "D:\Scripts\fauxmo.exe_main
.py", line 9, in
File "D:\lib\site-packages\fauxmo\cli.py", line 28, in cli
main(config_path_str=args.config, verbosity=verbosity)
File "D:\lib\site-packages\fauxmo\fauxmo.py", line 131, in main
sock=make_udp_sock())
File "D:\lib\site-packages\fauxmo\utils.py", line 76, in make_udp_sock
sock.bind(('', 1900))
OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted


Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
    I'm using a clean python 3.6.0

  • Ensure you're running a supported version of Python

    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output

as above

  • Include your Fauxmo config.json
    unchanged. as per github

  • Search the existing (including closed) issues
    I dont see anyone else getting this

Does Fauxmo work with non-Echo emulators like Alexa AVS or Echoism.io?

  • RPi3 - Pixel
  • Python updated to 3.5.3
  • Latest here using "pip3 install fauxmo"

I've been going crazy trying to make this work with Alexa AVS running on the same RPi that Fauxmo with no luck. Tried setting Fauxmo to use Wifi IP and Alexa on LAN IP but nothing.... Anyone has any idea if it's possible to get it working ? I don't have my Echo cause it's not available in my country yet but I thought this should work in the meantime.

Fauxmo seams to be running fine but can't find any smart devices.

Any ideas ? What to look for ? What can I be doing wrong ?

Thanks a lot !

Function onMessage is killing my timer

What's up guys (peace),

I'm working on my first project and I have a timer issue. Short version. my timer is running way to fast than the normal time. I already got some good support from crankyoldgit (crankyoldgit/IRremoteESP8266#364 (comment)) and followed his advices. Now I can edge my issue pretty much to one of the functions in this library "onMessage()". My ino looks like that:

`
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ESP8266WiFi.h>

#include "fauxmoESP.h"

fauxmoESP fauxmo;

IRsend irsend(4);

#define WIFI_SSID "Mr. NiceGuy (.Y.)"
#define WIFI_PASS "***********"

void setup()
{
irsend.begin();
Serial.begin(115200);

wifiSetup();
fauxmo.enable(true);
devices();
MusicTest();
}

void loop()
{
fauxmo.handle();

static unsigned long last = millis();
if (millis() - last > 5000) {
    last = millis();
    Serial.printf("[MAIN] Free heap: %d bytes\n", ESP.getFreeHeap());
}

}

void MusicTest()
{
Serial.println("Anlage AN");
irsend.sendNEC(0x10E03FC, 32);
delay(4000);
Serial.println("Anlage Eingang CD");
irsend.sendNEC(0x10E23DC, 32);
delay(10000);
Serial.println("Anlage AUS");
irsend.sendNEC(0x10EF906, 32);
}

void request(unsigned char device_id, const char * device_name, bool state)
{
if (state)
{
if(device_id == 0)
{
MusicTest();
}
}
}

void wifiSetup()
{

// ----------
// WLAN SETUP
// ----------

WiFi.mode(WIFI_STA);

Serial.printf("Verbindungs zu %s wird aufgebaut ", WIFI_SSID);

WiFi.begin(WIFI_SSID, WIFI_PASS);

while (WiFi.status() != WL_CONNECTED) 
{
    Serial.print(">");
    delay(100);
}
 
Serial.println("");
Serial.printf("Verbunden! SSID: %s, IP Adresse: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());

}

void devices()
{
fauxmo.addDevice("Test"); //ID 0

//fauxmo.onMessage(request);
}
`
If I run it like that, my output is fine and the delays in MusicTest are working as they should. BUT if I use the version where I uncomment fauxmo.onMessage(request) in devices(), my output isn't delayed. Hope one of you can help me!

best regards,
Michel

Wemo Remote Access / Different Wifi Network

  • Operating system and version: Raspbian Jessie (8.0)
  • Python version: 3.6.0
  • Fauxmo version (fauxmo --version): 0.4.5
  • Echo device type (e.g. Echo, Echo Plus, Dot): Dot
  • Echo Firmware Version: 597465220

My Issue

Does fauxmo support the ability to connect via remote access (for example, connect my device to my online wemo account)? For my current internet/wifi setup (a college dorm room) my raspberry pi and echo dot must be on separate wifi networks, so it is not detecting my raspberry pi. I would like to workaround this issue by connecting the raspberry pi to my online wemo account, and then connecting the echo dot to wemo via the wemo skill. Is this possible, or are there any other options to connect the Alexa to a device at a specific IP address?

WHYT

Following all given instructions and searching for the raspberry pi device


Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues
  • Please use codeblocks around your debug output and config

Echo 2 f/w 599473420 not finding devices

  • Operating system and version:
  • Python version:
  • Fauxmo version (fauxmo --version):
  • Echo device type (e.g. Echo, Echo Plus, Dot):
  • Echo Firmware Version:

My Issue

Echo 2nd gen not discovering devices
Firmware version : 599473420

WHYT

Python 3.6.1 and 3.6.4 on Raspberry PI 3 (using pyenv)
Fauxmo 0.4.5 master and dev branch
Used SimpleHTTPPlugin & CommandLinePlugin

Can see another device retrieving setup.xml from fauxmo but cannot see Echo requesting a response during the discovery phase.
I can however see the request going out, so assume that the Echo is not recognising our response string.

My config.json is as below:


{
  "FAUXMO": {
    "ip_address": "auto"
  },
  "PLUGINS": {
    "CommandLinePlugin": {
      "path": "/opt/pyenv/versions/3.6.1/lib/python3.6/site-packages/fauxmo-plugins/commandlineplugin.py",
      "DEVICES": [
        {
            "name": "Lounge lights",
            "port": 42131,
            "on_cmd": "/home/pi/bin/socket 1 on",
            "off_cmd": "/home/pi/bin/socket 1 off",
            "state_cmd": "ls testfile.txt"
        }
      ]
    }
  }
}

The log file is attached below:

fauxmo.log

For info, the IP address of the Echo is 192.168.3.50
The .91 address is another Raspberry Pi running "an open source media player" :)
There are two Sky TV boxes which are also using DLNA - not sure if these other devices are causing an issue in the discovery process, but will try later with everything else unplugged to see if the results are any different.


Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues
  • Please use codeblocks around your debug output and config

questions on config.json

  • Operating system and version:
    Raspian 3.2.17
  • Python version:
    3.4.4
  • Fauxmo version:
    latest release

My Issue

What edits to I need to make to the config file to get fauxmo running enough to appear on my Echo?
Testing unedited, here's what I get:

fauxmo -c /home/pi/Desktop/config.json -v
2017-03-04 13:02:43 fauxmo:18 INFO Fauxmo version 0.3.6
Traceback (most recent call last):
File "/usr/local/bin/fauxmo", line 11, in
sys.exit(cli())
File "/usr/local/lib/python3.4/dist-packages/fauxmo/cli.py", line 28, in cli
main(config_path=args.config, verbosity=verbosity)
File "/usr/local/lib/python3.4/dist-packages/fauxmo/fauxmo.py", line 50, in main
config = json.load(config_file)
File "/usr/lib/python3.4/json/init.py", line 265, in load
return loads(fp.read(),
File "/usr/lib/python3.4/codecs.py", line 313, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa9 in position 1916: invalid start byte

WHYT

Tried it twice My local network happens to be the same as the 'sample' config. 192.168.0.xxx


Please make sure you've taken these steps before submitting a new issue:

  • Include the Python and Fauxmo version in your issue
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Search the existing (and closed) issues

Problems with new installation of Fauxmo

  • Operating system and version: Windows Server 2008 SP1
  • Python version: 3.5.2
  • Fauxmo version: 0.3.6

My Issue

2017-02-18 00:42:38 fauxmo:18 INFO Fauxmo version 0.3.6
2017-02-18 00:42:39 fauxmo:38 DEBUG 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)]
2017-02-18 00:42:39 fauxmo:15 DEBUG Attempting to get IP address automatically
2017-02-18 00:42:39 fauxmo:28 DEBUG Using IP address: 192.168.1.236
2017-02-18 00:42:39 asyncio:979 INFO <Server sockets=[<socket.socket fd=392, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.236', 12340)>]> is serving
2017-02-18 00:42:39 fauxmo:80 DEBUG {'action_handler': <fauxmo.handlers.rest.RESTAPIHandler object at 0x03780E70>, 'name': 'fake switch one'}
2017-02-18 00:42:39 asyncio:979 INFO <Server sockets=[<socket.socket fd=396, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.236', 12341)>]> is serving
2017-02-18 00:42:39 fauxmo:80 DEBUG {'action_handler': <fauxmo.handlers.rest.RESTAPIHandler object at 0x03B326D0>, 'name': 'fake Indigo switch'}
2017-02-18 00:42:39 asyncio:979 INFO <Server sockets=[<socket.socket fd=244, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.236', 12342)>]> is serving
2017-02-18 00:42:39 fauxmo:80 DEBUG {'action_handler': <fauxmo.handlers.rest.RESTAPIHandler object at 0x03780BB0>, 'name': 'fake hass switch by REST API'}
2017-02-18 00:42:39 asyncio:979 INFO <Server sockets=[<socket.socket fd=400, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.236', 12350)>]> is serving
2017-02-18 00:42:39 fauxmo:104 DEBUG {'action_handler': <fauxmo.handlers.hass.HassAPIHandler object at 0x03780ED0>, 'name': 'upstairs lamp'}
2017-02-18 00:42:39 fauxmo:106 INFO Starting UDP server
2017-02-18 00:42:39 asyncio:853 INFO Datagram endpoint local_addr=('0.0.0.0', 1900) remote_addr=None created: (<_SelectorDatagramTransport fd=404 read=idle write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0x03780FF0>)
Traceback (most recent call last):
File "c:\users\administrator\appdata\local\programs\python\python35-32\lib\runpy.py", line 184, in _run_module_as_main "main", mod_spec)
File "c:\users\administrator\appdata\local\programs\python\python35-32\lib\runpy.py", line 85, in run_code exec(code, run_globals)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\Scripts\fauxmo.exe_main
.py", line 9, in
File "c:\users\administrator\appdata\local\programs\python\python35-32\lib\site-packages\fauxmo\cli.py", line 28, in cli main(config_path=args.config, verbosity=verbosity)
File "c:\users\administrator\appdata\local\programs\python\python35-32\lib\site-packages\fauxmo\fauxmo.py", line 114, in main loop.add_signal_handler(getattr(signal, signame), loop.stop)
File "c:\users\administrator\appdata\local\programs\python\python35-32\lib\asyncio\events.py", line 475, in add_signal_handler
raise NotImplementedError
NotImplementedError

WHYT

Disabled the DLNA/UPnP feature of Plex (as per other issue) and confirmed nothing listening on port 1900 using Telnet.

Forced local IP address of 192.168.1.236 in config.json


Please make sure you've taken these steps before submitting a new issue:

  • [x ] Include the Python and Fauxmo version in your issue
  • [x ] Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
  • [x ] Run Fauxmo in debug mode (-vvv) and include relevant output
  • [x ] Search the existing (and closed) issues

PyPi Out of Date

Just need to upgrade that repository. Installed from there just now and I got v0.3.2 :)

commandline plugin usage exist?

My Issue

When I install fauxmo 0.4.5 it no longer comes with the commandlineplugin.py. Is this still supported? And if so does it support the state command? Can I use it along side fo the simplehttp plugin in my json?

My use case is turning off and on GPIO pins on the raspberry pi and checking the state (state seems to be a new feature with the http plugin).

{ "FAUXMO": { "ip_address": "auto" }, "PLUGINS": { "CommandLinePlugin": { "path": "/opt/pyenv/versions/3.6.1/lib/python3.6/site-packages/fauxmo/plugins/commandlineplugin.py", "DEVICES": [ { "name": "Lounge lights", "port": 42131, "on_cmd": "touch testfile.txt", "off_cmd": "rm testfile.txt", "state_cmd": "ls testfile.txt" } ] }, "SimpleHTTPPlugin": { "DEVICES": [ { "port": 12340, "on_cmd": "http://192.168.1.127/myserver/fakeswitches/01/on", "off_cmd": "http://192.168.1.127/myserver/fakeswitches/01/off", "method": "GET", "name": "fake switch one" }, { "port": 12341, "on_cmd": "http://localhost:54321/devices/garage%20light", "off_cmd": "http://localhost:54321/devices/garage%20light", "on_data": {"isOn": 1}, "off_data": {"isOn": 0}, "user": "this", "password": "that", "method": "PUT", "name": "fake Indigo switch" }, { "name": "fake home assistant switch by REST API", "port": 12342, "on_cmd": "http://192.168.1.127:8123/api/services/switch/turn_on", "off_cmd": "http://192.168.1.127:8123/api/services/switch/turn_off", "method": "POST", "headers": {"x-ha-access": "your_hass_password"}, "on_data": {"entity_id": "switch.fake_hass_switch"}, "off_data": {"entity_id": "switch.fake_hass_switch"} } ] } } }

Error:
ModuleNotFoundError: No module named 'fauxmo.plugins.commandlineplugin'
...
FileNotFoundError: [Errno 2] No such file or directory: '/opt/pyenv/versions/3.6.1/lib/python3.6/site-packages/fauxmo/plugins/commandlineplugin.py'...

WHYT


Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues
  • Please use codeblocks around your debug output and config

Command "python setup.py egg_info" failed

  • Operating system and version: Raspbian Linux raspberrypi 4.9.59-v7+
  • Python version: v3.6

My Issue

When I try to setup fauxmo the installation fails at STEP 5: pip install -e .[dev]

Errormessage

...
...
      File "/tmp/fauxmo/venv/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 665, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/tmp/fauxmo/venv/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 695, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/tmp/fauxmo/venv/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 876, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/tmp/fauxmo/venv/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1115, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/tmp/fauxmo/venv/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1103, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ngqnls1n/brotlipy/
(venv) pi@raspberrypi:/tmp/fauxmo $

I don`t find where the problem could be.

Discovery stopped working

The discovery process seems to have stopped working. At first I noticed this with an Hue emulation plugin I use with Indigo and this was confirmed to be broken, probably due to a recent Echo update that added thermostat control. Then I went back to FauxMo and could not get discovery working with it either.

I'm not sure about FauxMo, since I had deleted my discovered devices, but with the other software already discovered devices continued to work. So I suggest not forgetting other devices while anyone checks this out. I also wonder whether discovery works with real Hue or WeMo devices.

Provide Host IP to Plugin

Hi,

I am trying to work out a way to perform location awareness and have come up with the idea of creating a plugin for fauxmo that will allow virtual-virtual devices.

Basic plan is to have the ability to have multiple on_cmd for a device based on the IP of the host. Such as
Echo 1: 10.0.0.1
Echo 2: 10.0.0.2

In config.json device config have
"name":"Lights"
"on_cmd": {"10.0.0.1":"http://url/device1/on", "10.0.0.2":"http://url/device2/on"}

I have looked through the code and think I know how to do it but I am very new to Python and how to contribute to a github project. As such, if you would be able to add the requesting host being passed to a plugin, such that I can hack around and build a plugin to do this that would be great.

If I get it working will be more than happy to contribute in your plugin repo.

Great tool btw - used this for some time and works really well on RPi3 Jessie linked to Domotiga via rest api

Alexa UDP searches received but not by Fauxmo

  • Operating system and version: Debian Stretch (9.4)
  • Python version: 3.6.5 (in venv)
  • Fauxmo version: 0.4.7
  • Echo device type: Echo and Echo Dot
  • Echo Firmware Version: 611498620

My Issue

I can get fauxmo running and it says it is listening on 172.16.0.1 which is my server's local IP address. However Alexa doesn't detect the devices and there is nothing being logged by fauxmo to indicate that it is receiving the searches.

WHYT

I have tried a tcpdump on the server when Alexa is searching for devices and that shows the server is receiving the searches. Has a look through the closed issues but couldn't see anything that applies. Using more recent version of Fauxmo and Alexa firmware than most of them.


Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues
  • Please use codeblocks around your debug output and config

config.json

Using the default config for now but with the IP address set manually, as this is running on a router/firewall server and the global IP address was the one being auto-detected.

{
    "FAUXMO": {
        "ip_address": "172.16.0.1"
    },
    "PLUGINS": {
        "SimpleHTTPPlugin": {
            "DEVICES": [
                {
                    "port": 12340,
                    "on_cmd": "http://192.168.1.104/myserver/fakeswitches/01/on",
                    "off_cmd": "http://192.168.1.104/myserver/fakeswitches/01/off",
                    "method": "GET",
                    "name": "fake switch one"
                },
                {
                    "port": 12341,
                    "on_cmd": "http://localhost:54321/devices/garage%20light",
                    "off_cmd": "http://localhost:54321/devices/garage%20light",
                    "on_data": {"isOn": 1},
                    "off_data": {"isOn": 0},
                    "user": "this",
                    "password": "that",
                    "method": "PUT",
                    "name": "fake Indigo switch"
                },
                {
                    "name": "fake home assistant switch by REST API",
                    "port": 12342,
                    "on_cmd": "http://192.168.1.104:8123/api/services/switch/turn_on",
                    "off_cmd": "http://192.168.1.104:8123/api/services/switch/turn_off",
                    "method": "POST",
                    "headers": {"x-ha-access": "your_hass_password"},
                    "on_data": {"entity_id": "switch.fake_hass_switch"},
                    "off_data": {"entity_id": "switch.fake_hass_switch"}
                }
            ]
        }
    }
}

fauxmo -vvv

Appears to be listening on 172.16.0.1 but never seems to receive anything.

# fauxmo -c config.json -vvv
2018-06-24 22:17:19 fauxmo:37       INFO     Fauxmo v0.4.7
2018-06-24 22:17:19 fauxmo:38       DEBUG    3.6.5 (default, Jun 24 2018, 19:53:14) 
[GCC 6.3.0 20170516]
2018-06-24 22:17:19 fauxmo:40       DEBUG    Using IP address: 172.16.0.1
2018-06-24 22:17:19 fauxmo:100      DEBUG    plugin_vars: {}
2018-06-24 22:17:19 fauxmo:103      DEBUG    device config: {'port': 12340, 'on_cmd': 'http://192.168.1.104/myserver/fakeswitches/01/on', 'off_cmd': 'http://192.168.1.104/myserver/fakeswitches/01/off', 'method': 'GET', 'name': 'fake switch one'}
2018-06-24 22:17:19 asyncio:1069     INFO     <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('172.16.0.1', 12340)>]> is serving
2018-06-24 22:17:19 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'fake switch one', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x7f0d8c72ed30>}
2018-06-24 22:17:19 fauxmo:103      DEBUG    device config: {'port': 12341, 'on_cmd': 'http://localhost:54321/devices/garage%20light', 'off_cmd': 'http://localhost:54321/devices/garage%20light', 'on_data': {'isOn': 1}, 'off_data': {'isOn': 0}, 'user': 'this', 'password': 'that', 'method': 'PUT', 'name': 'fake Indigo switch'}
2018-06-24 22:17:19 asyncio:1069     INFO     <Server sockets=[<socket.socket fd=8, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('172.16.0.1', 12341)>]> is serving
2018-06-24 22:17:19 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'fake Indigo switch', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x7f0d8c6cada0>}
2018-06-24 22:17:19 fauxmo:103      DEBUG    device config: {'name': 'fake home assistant switch by REST API', 'port': 12342, 'on_cmd': 'http://192.168.1.104:8123/api/services/switch/turn_on', 'off_cmd': 'http://192.168.1.104:8123/api/services/switch/turn_off', 'method': 'POST', 'headers': {'x-ha-access': 'your_hass_password'}, 'on_data': {'entity_id': 'switch.fake_hass_switch'}, 'off_data': {'entity_id': 'switch.fake_hass_switch'}}
2018-06-24 22:17:19 asyncio:1069     INFO     <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('172.16.0.1', 12342)>]> is serving
2018-06-24 22:17:19 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'fake home assistant switch by REST API', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x7f0d8c624668>}
2018-06-24 22:17:19 fauxmo:123      INFO     Starting UDP server
2018-06-24 22:17:19 asyncio:949      DEBUG    Datagram endpoint remote_addr=None created: (<_SelectorDatagramTransport fd=10 read=idle write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0x7f0d8d2f5f98>)
^C2018-06-24 22:21:15 asyncio:1386     INFO     poll took 236133.066 ms: 1 events
2018-06-24 22:21:15 fauxmo:143      DEBUG    Shutdown starting...
2018-06-24 22:21:15 fauxmo:146      DEBUG    Shutting down server 0...
2018-06-24 22:21:15 fauxmo:146      DEBUG    Shutting down server 1...
2018-06-24 22:21:15 fauxmo:146      DEBUG    Shutting down server 2...
2018-06-24 22:21:15 asyncio:491      DEBUG    Close <_UnixSelectorEventLoop running=False closed=False debug=True>

tcpdump

Running tcpdump instead of Fauxmo shows that the Alexa searches are being received by the server. The local interface is called lan and has IP address 172.16.0.1. Don't think it is a firewall problem.

# tcpdump -i lan -n udp dst port 1900 -A
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lan, link-type EN10MB (Ethernet), capture size 262144 bytes
22:12:46.518525 IP 172.16.0.141.50000 > 239.255.255.250.1900: UDP, length 94
[email protected] * HTTP/1.1
Host: 239.255.255.250:1900
Man: "ssdp:discover"
MX: 3
ST: ssdp:all


22:12:46.518970 IP 172.16.0.141.50000 > 239.255.255.250.1900: UDP, length 101
[email protected]:{M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
Man: "ssdp:discover"
MX: 3
ST: upnp:rootdevice


22:12:46.519033 IP 172.16.0.141.50000 > 239.255.255.250.1900: UDP, length 94
[email protected] * HTTP/1.1
Host: 239.255.255.250:1900
Man: "ssdp:discover"
MX: 3
ST: ssdp:all


22:12:46.519096 IP 172.16.0.141.50000 > 239.255.255.250.1900: UDP, length 101
[email protected]:{M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
Man: "ssdp:discover"
MX: 3
ST: upnp:rootdevice


22:12:46.519162 IP 172.16.0.141.50000 > 239.255.255.250.1900: UDP, length 94
[email protected] * HTTP/1.1
Host: 239.255.255.250:1900
Man: "ssdp:discover"
MX: 3
ST: ssdp:all


22:12:46.519238 IP 172.16.0.141.50000 > 239.255.255.250.1900: UDP, length 101
[email protected]:{M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
Man: "ssdp:discover"
MX: 3
ST: upnp:rootdevice


22:12:46.580788 IP 172.16.0.223.50000 > 239.255.255.250.1900: UDP, length 122
[email protected] * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 15
ST: urn:schemas-upnp-org:device:basic:1


22:12:46.702524 IP 172.16.0.223.50000 > 239.255.255.250.1900: UDP, length 122
[email protected] * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 15
ST: urn:schemas-upnp-org:device:basic:1


22:12:46.782805 IP 172.16.0.223.50000 > 239.255.255.250.1900: UDP, length 107
[email protected][.........P.l.s(.M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 15
ST: urn:Belkin:device:**


22:12:46.884760 IP 172.16.0.223.50000 > 239.255.255.250.1900: UDP, length 107
E....%@...HW.........P.l.s(.M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 15
ST: urn:Belkin:device:**

Errno 48 Address already in use

I’m trying to use your version of fauxmo and almost have it working. When I run it though it complains that it can’t initialize the UPnP sockets because the address is already in use. I've tried rebooting with no change. I’m not a developer but I can usually slog through something like this. Not this time though. Any clues would be much appreciated since this is so much better than my previous attempts to integrate Echo with my Indigo home automation software via a custom skill. Thanks!

Here is the verbose terminal output:

fauxmo -vv
2016-02-19 23:15:49 fauxmo ERROR Failed to initialize UPnP sockets:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/fauxmo/upnp.py", line 189, in init_socket
self.ssock.bind(('', self.port))
OSError: [Errno 48] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/fauxmo/upnp.py", line 192, in init_socket
self.port))
IndexError: tuple index out of range
2016-02-19 23:15:49 fauxmo INFO Using config: ./config.json
2016-02-19 23:15:49 fauxmo DEBUG Attempting to get IP address automatically
2016-02-19 23:15:49 fauxmo DEBUG Using IP address: xxx
2016-02-19 23:15:49 fauxmo DEBUG Attempting to bind: xxx:12345
2016-02-19 23:15:49 fauxmo DEBUG UPnP broadcast listener: new device registered
2016-02-19 23:15:49 fauxmo DEBUG Device hall light ready on xxx:12345
2016-02-19 23:15:49 fauxmo DEBUG {'name': 'hall light', 'listener': <fauxmo.upnp.UpnpBroadcastResponder object at 0x1021c6b38>, 'root_url': 'http://{}:{}/setup.xml', 'port': 12345, 'server_version': 'Unspecified, UPnP/1.0, Unspecified', 'client_sockets': {}, 'socket': <socket.socket fd=8, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('xxx', 12345)>, 'action_handler': <fauxmo.handlers.rest.RestApiHandler object at 0x1021c6f60>, 'poller': <fauxmo.upnp.Poller object at 0x1021c6a58>, 'ip_address': 'xxx', 'uuid': UUID('xxx'), 'serial': 'xxx', 'other_headers': ['X-User-Agent: Fauxmo']}
2016-02-19 23:15:49 fauxmo DEBUG Entering main loop (polling)

Add close and lookup functionality to plugins

My Issue

I'd like to propose two additions to the plugin API. I've got both of these implemented already and I'm happy to submit a PR.

  1. Add a close function. I've got a plugin which runs on a Raspberry Pi and uses RPi.GPIO to truly implement a Wemo switch ... meaning, the Pi controls a relay which switches an electrical outlet. The problem is, when you stop the fauxmo service, there is no opportunity for the plugin code to shut down the GPIO state cleanly. More generically, I would think many plugins might need to clean up before exiting.

    I'd propose that src/fauxmo/fauxmo.py keeps track of the plugin instances it creates, and then at shutdown it runs through those instances and calls a new close function on each. For backward compatibility, I've added a do-nothing (but non abstract) FauxmoPlugin.close() function. If plugins don’t need this functionality they can ignore the whole issue, but those plugins that need to perform cleanup can override close(). Existing plugins do not need to be modified.

  2. Add a lookup function. This might be a little more of a stretch, but in some cases it might be useful for multiple plugin instances to interact with each other. An example which I have implemented is a "schedule" plugin. This schedule plugin in turn controls another plugin. So, for instance, I have my GPIO plugin named "Kitchen Light". You can use Alexa to "turn on kitchen light". Then I have a second plugin, the schedule plugin, which is set to turn the kitchen light on at 5 am and turn it off at sunrise. Because this schedule plugin is itself a fauxmo instance, you can also use Alexa to "turn on kitchen light schedule".

    However, in order for this whole approach to work, the schedule plugin instance needs to be able to find the GPIO plugin instance at runtime.

    Extending the idea from the close function above, we're already maintaining a record of created plugin instances in fauxmo.py. So I added a lookup function which allows plugins to find each other by name. Therefore in the schedule plugin case, one of the parameters in config.json is the name of the "slaved" plugin, and when it comes time for the schedule to turn on the lights, it can do so.

As I mentioned, I've got both the above implemented. Look forward to your thoughts.

Please don't use f-strings yet

f-strings are a very new feature, and this makes the library unusable on any system that's more than a few months old. It doesn't even install for me, as the interpreter for Python 3.4 (running on my raspi) doesn't know what an f-string is.

UnicodeDecodeError in protocols.py

  • Operating system and version: Raspbian Jessie on RPi 2
  • Python version: Python 3.4.2, 3.5.1
  • Fauxmo version: Fauxmo 0.1.11, 0.2.0, 0.3.0

My Issue

Migrating @acidbath's issue from #5. Getting UnicodeDecodeError even running on wget-ed config-sample.json (which runs without error for me).

  File "/opt/pyenv/versions/3.5.1/lib/python3.5/site-packages/fauxmo/protocols.py", line 150, in datagram_received
    msg = data.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 389: invalid start byte

WHYT

  • Numerous uninstall / reinstalls
  • Upgraded Python version
  • Verified locale:
pi@mqtt-pi:~ $ locale -a
C
C.UTF-8
de_DE.utf8
en_GB.utf8
POSIX
pi@mqtt-pi:~/fauxmo $ file config-sample.json 
config-sample.json: ASCII text

Thinking this may have something to do with his locale being different?

Luckily the most recent debug log (the one I used above) shows where the error is occurring (and is still occurring despite a major rewrite between 0.2.0 and 0.3.0): the msg = data.decode() in datagram_received() in SSDPServer, currently line 150 of protocols.py.

@acidbath -- AFAIK the Echo only supports English -- is that correct?

I think the next step will be to look at the actual TCP stream if you're up for it -- I'll verify the commands and post them here in the next day or two for whenever you have time.


Please make sure you've taken these steps before submitting a new issue:

  • Include the Python and Fauxmo version in your issue
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Search the existing (and closed) issues

install fails with compile errors

  • Operating system and version:
    Raspian Jessie on Raspberry PI 3
  • Python version:
    Python 3.4.2 (default, Oct 19 2014, 13:31:11)
  • Fauxmo version:
    Latest (0.3.6)?

My Issue

Install fails when running: python3 -m pip install fauxmo

WHYT

Tried twice one without sudo and one with. compile errors were generated as shown below:

pi@raspberrypi:~ $ sudo su
root@raspberrypi:/home/pi# python3 -m pip install fauxmo
Downloading/unpacking fauxmo
Downloading fauxmo-0.3.6-py3-none-any.whl
Downloading/unpacking requests==2.12.4 (from fauxmo)
Downloading requests-2.12.4-py2.py3-none-any.whl (576kB): 576kB downloaded
Downloading/unpacking homeassistant==0.31.1 (from fauxmo)
Downloading homeassistant-0.31.1-py2.py3-none-any.whl (6.4MB): 6.4MB downloaded
Downloading/unpacking pip>=7.0.0 (from homeassistant==0.31.1->fauxmo)
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Downloading/unpacking pytz>=2016.6.1 (from homeassistant==0.31.1->fauxmo)
Downloading pytz-2016.10-py2.py3-none-any.whl (483kB): 483kB downloaded
Downloading/unpacking pyyaml>=3.11,<4 (from homeassistant==0.31.1->fauxmo)
Downloading PyYAML-3.12.tar.gz (253kB): 253kB downloaded
Running setup.py (path:/tmp/pip-build-0my8jj1z/pyyaml/setup.py) egg_info for package pyyaml

Downloading/unpacking jinja2>=2.8 (from homeassistant==0.31.1->fauxmo)
Downloading Jinja2-2.9.5-py2.py3-none-any.whl (340kB): 340kB downloaded
Downloading/unpacking voluptuous==0.9.2 (from homeassistant==0.31.1->fauxmo)
Downloading voluptuous-0.9.2.tar.gz
Running setup.py (path:/tmp/pip-build-0my8jj1z/voluptuous/setup.py) egg_info for package voluptuous
WARNING: Could not locate pandoc, using Markdown long_description.

Downloading/unpacking typing>=3,<4 (from homeassistant==0.31.1->fauxmo)
Downloading typing-3.5.3.0.tar.gz (60kB): 60kB downloaded
Running setup.py (path:/tmp/pip-build-0my8jj1z/typing/setup.py) egg_info for package typing

Requirement already satisfied (use --upgrade to upgrade): MarkupSafe>=0.23 in /usr/lib/python3/dist-packages (from jinja2>=2.8->homeassistant==0.31.1->fauxmo)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=0.6b1 in /usr/lib/python3/dist-packages (from voluptuous==0.9.2->homeassistant==0.31.1->fauxmo)
Installing collected packages: fauxmo, requests, homeassistant, pip, pytz, pyyaml, jinja2, voluptuous, typing
Found existing installation: requests 2.4.3
Not uninstalling requests at /usr/lib/python3/dist-packages, owned by OS
Found existing installation: pip 1.5.6
Not uninstalling pip at /usr/lib/python3/dist-packages, owned by OS
Running setup.py install for pyyaml
checking if libyaml is compilable
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c build/temp.linux-armv7l-3.4/check_libyaml.c -o build/temp.linux-armv7l-3.4/check_libyaml.o
build/temp.linux-armv7l-3.4/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory
#include <yaml.h>
^
compilation terminated.

libyaml is not found or a compiler error: forcing --without-libyaml
(if libyaml is installed correctly, you may need to
 specify the option --include-dirs or uncomment and
 modify the parameter include_dirs in setup.cfg)

Found existing installation: Jinja2 2.7.3
Not uninstalling Jinja2 at /usr/lib/python3/dist-packages, owned by OS
*** Error compiling '/tmp/pip-build-0my8jj1z/jinja2/jinja2/asyncfilters.py'...
File "/tmp/pip-build-0my8jj1z/jinja2/jinja2/asyncfilters.py", line 7
async def auto_to_seq(value):
^
SyntaxError: invalid syntax

*** Error compiling '/tmp/pip-build-0my8jj1z/jinja2/jinja2/asyncsupport.py'...
File "/tmp/pip-build-0my8jj1z/jinja2/jinja2/asyncsupport.py", line 22
async def concat_async(async_gen):
^
SyntaxError: invalid syntax

Running setup.py install for voluptuous
WARNING: Could not locate pandoc, using Markdown long_description.

Running setup.py install for typing

Successfully installed fauxmo requests homeassistant pip pytz pyyaml jinja2 voluptuous typing
Cleaning up...
root@raspberrypi:/home/pi#


Please make sure you've taken these steps before submitting a new issue:

  • Include the Python and Fauxmo version in your issue
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Search the existing (and closed) issues

Fauxmo stopped working

Operating system and version:
Raspian 3.2.17
Python version:
3.4.4
Fauxmo version:
latest release
My Issue

Working fauxmo installation stopped working

Up until recently fauxmo has worked well. A few weeks ago, I deleted the fauxmo devices from Alexa intending to put them back later when I had the server up..

Today I restarted the server and tried to reinstall my fauxmo devices without success. I can not detect them in the phone app or with Alexa. Figuring it was something I did, I installed fauxmo on another machine. No success there either. It seems to be running okay (see below) but still no discovery. Did something change in the WeMo /Alexa universe that now prevents discovery? Sure seems like it!


auxmo -c /home/pi/Desktop/config.json -v
2017-04-03 12:55:03 fauxmo:18 INFO Fauxmo version 0.3.6
2017-04-03 12:55:17 asyncio:778 INFO <Server sockets=[<socket.socket fd=8, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.0.207', 12340)>]> is serving
2017-04-03 12:55:17 asyncio:778 INFO <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.0.207', 12341)>]> is serving
2017-04-03 12:55:17 asyncio:778 INFO <Server sockets=[<socket.socket fd=10, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.0.207', 12342)>]> is serving
2017-04-03 12:55:18 asyncio:778 INFO <Server sockets=[<socket.socket fd=11, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.0.207', 12343)>]> is serving
2017-04-03 12:55:18 asyncio:778 INFO <Server sockets=[<socket.socket fd=12, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.0.207', 12344)>]> is serving
2017-04-03 12:55:18 asyncio:689 INFO Datagram endpoint local_addr=('0.0.0.0', 1900) remote_addr=None created: (<_SelectorDatagramTransport fd=13 read=polling write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0xb6001550>)
2017-04-03 12:55:39 asyncio:1039 INFO poll took 20879.847 ms: 1 events
2017-04-03 12:56:32 asyncio:1039 INFO poll took 53039.132 ms: 1 events
2017-04-03 12:57:26 asyncio:1039 INFO poll took 53960.255 ms: 1 events
2017-04-03 12:58:20 asyncio:1039 INFO poll took 54060.654 ms: 1 events
2017-04-03 12:59:14 asyncio:1039 INFO poll took 54063.561 ms: 1 events
2017-04-03 13:00:06 asyncio:1039 INFO poll took 52011.678 ms: 1 events
2017-04-03 13:00:42 asyncio:1039 INFO poll took 35836.657 ms: 1 events
2017-04-03 13:01:00 asyncio:1039 INFO poll took 18327.820 ms: 1 events
2017-04-03 13:01:55 asyncio:1039 INFO poll took 54057.128 ms: 1 events
2017-04-03 13:02:12 asyncio:1039 INFO poll took 17197.188 ms: 1 events

** edit **
retested with a fresh microSD and and got the same result.

Device Not Discovered

Windows 10 Machine
Python 3.6.7
Fauxmo : 0.4.4

Please find below the verbose

(venv) C:\Users\310093198\AppData\Local\Programs\Python\Python36\venv\Scripts>fauxmo -c config.json -vvv
2017-11-12 12:27:30 fauxmo:37 INFO Fauxmo v0.4.4
2017-11-12 12:27:30 fauxmo:38 DEBUG 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)]
2017-11-12 12:27:30 fauxmo:37 DEBUG Using IP address: 192.168.1.33
2017-11-12 12:27:30 fauxmo:102 DEBUG plugin_vars: {}
2017-11-12 12:27:30 fauxmo:105 DEBUG device config: {'port': 12345, 'on_cmd': 'http://192.168.1.33:8000/get?switch=on', 'off_cmd': 'http://192.168.1.33:8000/get?switch=off', 'method': 'GET', 'name': 'fake switch one'}
2017-11-12 12:27:30 asyncio:1068 INFO <Server sockets=[<socket.socket fd=416, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.33', 12345)>]> is serving
2017-11-12 12:27:30 fauxmo:123 DEBUG Started fauxmo device: {'name': 'fake switch one', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x0000029AA6276940>}
2017-11-12 12:27:30 fauxmo:105 DEBUG device config: {'port': 12346, 'on_cmd': 'http://127.0.0.1:8000/digest-auth/auth/fauxmouser/fauxmopass', 'off_cmd': 'http://127.0.0.1:8000/digest-auth/auth/fauxmouser/fauxmopass', 'user': 'fauxmouser', 'password': 'fauxmopass', 'name': 'fake Indigo switch'}
2017-11-12 12:27:30 asyncio:1068 INFO <Server sockets=[<socket.socket fd=780, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.33', 12346)>]> is serving
2017-11-12 12:27:30 fauxmo:123 DEBUG Started fauxmo device: {'name': 'fake Indigo switch', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x0000029AA554C8D0>}
2017-11-12 12:27:30 fauxmo:105 DEBUG device config: {'port': 12347, 'on_cmd': 'http://192.168.1.33:8000/put', 'off_cmd': 'http://192.168.1.33:8000/put', 'on_data': {'isOn': 1}, 'off_data': {'isOn': 0}, 'method': 'PUT', 'name': 'fake Indigo switch'}
2017-11-12 12:27:30 asyncio:1068 INFO <Server sockets=[<socket.socket fd=640, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.33', 12347)>]> is serving
2017-11-12 12:27:30 fauxmo:123 DEBUG Started fauxmo device: {'name': 'fake Indigo switch', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x0000029AA6331A20>}
2017-11-12 12:27:30 fauxmo:105 DEBUG device config: {'name': 'fake post request', 'port': 12348, 'on_cmd': 'http://192.168.1.33:8000/post', 'off_cmd': 'http://192.168.1.33:8000/post', 'method': 'POST', 'headers': {'x-ha-access': 'your_hass_password'}, 'on_data': {'entity_id': 'switch.fake_hass_switch'}, 'off_data': {'entity_id': 'switch.fake_hass_switch'}}
2017-11-12 12:27:30 asyncio:1068 INFO <Server sockets=[<socket.socket fd=812, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.33', 12348)>]> is serving
2017-11-12 12:27:30 fauxmo:123 DEBUG Started fauxmo device: {'name': 'fake post request', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x0000029AA63319E8>}
2017-11-12 12:27:30 fauxmo:105 DEBUG device config: {'name': 'test https request', 'port': 12349, 'on_cmd': 'https://httpbin.org/post', 'off_cmd': 'https://httpbin.org/post', 'method': 'POST', 'headers': {'x-ha-access': 'your_hass_password'}, 'on_data': {'entity_id': 'switch.fake_hass_switch'}, 'off_data': {'entity_id': 'switch.fake_hass_switch'}}
2017-11-12 12:27:30 asyncio:1068 INFO <Server sockets=[<socket.socket fd=816, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.33', 12349)>]> is serving
2017-11-12 12:27:30 fauxmo:123 DEBUG Started fauxmo device: {'name': 'test https request', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x0000029AA6331A90>}
2017-11-12 12:27:30 fauxmo:125 INFO Starting UDP server
2017-11-12 12:27:30 asyncio:948 DEBUG Datagram endpoint remote_addr=None created: (<_SelectorDatagramTransport fd=756 read=idle write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0x0000029AA6276748>)
2017-11-12 12:27:46 asyncio:1380 INFO poll took 16297.000 ms: 1 events
2017-11-12 12:27:46 fauxmo:170 DEBUG Received data below from ('192.168.1.22', 50000):
2017-11-12 12:27:46 fauxmo:171 DEBUG b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: upnp:rootdevice\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'
2017-11-12 12:27:46 asyncio:1380 DEBUG poll took 0.000 ms: 1 events
2017-11-12 12:27:46 fauxmo:170 DEBUG Received data below from ('192.168.1.22', 50000):
2017-11-12 12:27:46 fauxmo:171 DEBUG b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: ssdp:all\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'
2017-11-12 12:27:47 asyncio:1380 DEBUG poll took 515.000 ms: 1 events
2017-11-12 12:27:47 fauxmo:170 DEBUG Received data below from ('192.168.1.22', 50000):
2017-11-12 12:27:47 fauxmo:171 DEBUG b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: ssdp:all\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'
2017-11-12 12:27:47 asyncio:1380 DEBUG poll took 407.000 ms: 1 events
2017-11-12 12:27:47 fauxmo:170 DEBUG Received data below from ('192.168.1.22', 50000):
2017-11-12 12:27:47 fauxmo:171 DEBUG b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: upnp:rootdevice\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'
2017-11-12 12:27:47 asyncio:1380 DEBUG poll took 0.000 ms: 1 events
2017-11-12 12:27:47 fauxmo:170 DEBUG Received data below from ('192.168.1.22', 50000):
2017-11-12 12:27:47 fauxmo:171 DEBUG b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: ssdp:all\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'
2017-11-12 12:27:48 asyncio:1380 DEBUG poll took 516.000 ms: 1 events
2017-11-12 12:27:48 fauxmo:170 DEBUG Received data below from ('192.168.1.22', 50000):
2017-11-12 12:27:48 fauxmo:171 DEBUG b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: upnp:rootdevice\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'
2017-11-12 12:27:48 asyncio:1380 DEBUG poll took 0.000 ms: 1 events
2017-11-12 12:27:48 fauxmo:170 DEBUG Received data below from ('192.168.1.22', 50000):
2017-11-12 12:27:48 fauxmo:171 DEBUG b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: ssdp:all\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'

confg.json file

{
"FAUXMO": {
"ip_address": "192.168.1.33"
},
"PLUGINS": {
"SimpleHTTPPlugin": {
"DEVICES": [
{
"port": 12345,
"on_cmd": "http://192.168.1.33:8000/get?switch=on",
"off_cmd": "http://192.168.1.33:8000/get?switch=off",
"method": "GET",
"name": "fake switch one"
},
{
"port": 12346,
"on_cmd": "http://127.0.0.1:8000/digest-auth/auth/fauxmouser/fauxmopass",
"off_cmd": "http://127.0.0.1:8000/digest-auth/auth/fauxmouser/fauxmopass",
"user": "fauxmouser",
"password": "fauxmopass",
"name": "fake Indigo switch"
},
{
"port": 12347,
"on_cmd": "http://192.168.1.33:8000/put",
"off_cmd": "http://192.168.1.33:8000/put",
"on_data": {"isOn": 1},
"off_data": {"isOn": 0},
"method": "PUT",
"name": "fake Indigo switch"
},
{
"name": "fake post request",
"port": 12348,
"on_cmd": "http://192.168.1.33:8000/post",
"off_cmd": "http://192.168.1.33:8000/post",
"method": "POST",
"headers": {"x-ha-access": "your_hass_password"},
"on_data": {"entity_id": "switch.fake_hass_switch"},
"off_data": {"entity_id": "switch.fake_hass_switch"}
},
{
"name": "test https request",
"port": 12349,
"on_cmd": "https://httpbin.org/post",
"off_cmd": "https://httpbin.org/post",
"method": "POST",
"headers": {"x-ha-access": "your_hass_password"},
"on_data": {"entity_id": "switch.fake_hass_switch"},
"off_data": {"entity_id": "switch.fake_hass_switch"}
}
]
}
}
}

Please help what went wrong. Trying with Echo 2

python > 3.4 puts this out of reach for OSMC

  • Operating system and version: OSMC, Debian Jessie based
  • Python version: 3.4.2
  • Fauxmo version (fauxmo --version): f4723ed

My Issue

While I understand the urge to use the new typing module and other neatness in Python 3.6 this puts it out of reach for many RPi distributions.

WHYT

sudo apt install python36

Any way to start at boot?

Great work on your extension, I have this running perfectly on my raspberry pi...

But I want to get it to start at boot...I have made a cron job, but it doesn't seem to be working..

""$(pyenv root)"/versions/3.5.1/bin/fauxmo -c /home/pi/config.json -vvv"

Works fine when I run from the command line, but not from the cronjob..

Any idea? - I believe I have just seen the answer on your readme, so I will try that..

Automatic startup instructions for Raspian unclear for noobs

  • Raspian Jessie:
  • Python version:
  • 0.3.6:

My Issue

There are two parts in the Raspian autorun at start instructions that are unclear

The first: sudo cp extras/fauxmo.service /etc/systemd/system/fauxmo.service
- when I install from pypi I don't get an extras directory, I did realise it was available from source
- when investigating I found at least one other person who ran into this asking (unanswered) on reddit where to find it

The second: Edit the paths in /etc/systemd/system/fauxmo.service
and from fauxmo.service:
WorkingDirectory=/abs/path/to/dir/fauxmo
# Fix the paths below:
ExecStart=/abs/path/to/venv/bin/fauxmo -c /abs/path/to/fauxmo/config.json -v

What should these three paths be changed too? The last, I gather is where I put config.json, but what are the other two?

All is well except On turns the relay off and Off turns the relay on.

Windows 10
D1 Mini ESP8266 ESP-12F N Compatible NodeMcu Arduino
Fauxmo ESP v. 2.4.2
Echo Dot
Echo Firmware Version: Client: 1.24.4244.0 Bridge: 2.2.2043.0

(https://github.com/n8henrie/fauxmo/blob/dev/README.md#troubleshooting--faq)**:

Sorry to bother you, and I will begin with apologizing for my lack of experience with Arduino coding. I understand the basics and can usually work my way through problems, but this one has me stumped. Thank you in advance for any help you can give me.

I've attached my sketch I've gotten everything to work with the exception of the fact that when I ask it to turn my relay on, it turns it off, and when I ask it to turn the relay off, it turns it on. I'm using a solid state relay, and I also tried it with a mechanical relay. It just seems to send the signal when it's gotten the off instruction and cuts the signal when it's received the on instruction.

Please let me know if you have any ideas and thanks so much for your time and all of your hard work. I'm very excited to see what all we can put together with these boards!

fauxmoESP_Basic_D1_AlexaV2.ino.ino.zip

Fauxmo 0.3.0 requires Python >= 3.4.4

I would much rather have Fauxmo work with Python >= 3.4.2, as that's the version that currently is available in the Raspbian Jessie repos. This would make installation far easier for many Raspberry Pi users (like myself), which may comprise a fair proportion of Fauxmo users.

The issue is that Fauxmo needs to be able to listen to UPnP / SSDP device searches, which are sent via multicast over UDP. This requires a special socket, which I'm currently creating with the make_udp_sock() function in fauxmo.utils. something like:

def make_sock():
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.bind(('', 1900))
    group = socket.inet_aton('239.255.255.250')
    mreq = struct.pack('4sL', group, socket.INADDR_ANY)
    sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)    
    return sock

This socket can then be passed to asyncio's BaseEventLoop.create_datagram_endpoint using the sock kwarg. Unfortunately, create_datagram_endpoint didn't take a sock kwarg until 3.4.4 -- hence the issue.

For the time being, I've added instructions to the README on installing a more recent Python version with pyenv, but it would be nice if there were just a simple way to be able to create a functioning multicast / UDP socket without the sock kwarg. Or at least simpler than monkeypatching BaseEventLoop.

I also brought this up on r/learnpython; as of yet I don't have any responses.

Should Fauxmo switch to emulating a Hue?

As many users have noted, something has changed in the way WeMo devices interact with the newer Echos, which breaks Fauxmo for these devices.

While we're slowly trying to figure out a workaround, one possibility would be to move from emulating a WeMo device to emulating a Hue. This is the route that HomeAssistant has taken from the beginning, and it seems to work well:

I'm not sure how much work it would be, but this may be one way to work around this new limitation.

If I go this route, I will also likely rename the library, making a break from the original work by makermusings, since it is already a near complete re-write and at that point will no longer have anything to do with WeMo. I'd like the new name to be something more descriptive -- I don't have anything in mind, but would be open to suggestions.

Echo not finding fauxmo devices after discovery

  • Operating system and version: Ubuntu MATE 1.12.1
  • Python version: 3.5.2
  • Fauxmo version: 0.3.4

My Issue

Echo Dot 2 doesn't find any devices after discovery search.

WHYT

I seem to have gotten fauxmo installed, created a config file that is correctly formatted JSON, and it seems to run without error; however, when putting the Dot through discovery mode, it does not find any of the devices configured in config.json (currently using a direct copy of the config-sample.json provided on this project).

From the verbose output, I think it's showing that the Echo is requesting and fauxmo is responding, but it still doesn't register the fake devices. Admittedly, I don't have any of the "on_cmd" or "off_cmd" destinations actually setup yet (just the dummy ip/DNS addresses that are in the config-sample). Do these need to be actual working destinations for the Echo to recognize it as a device? Or is something else not working?

Any help would be greatly appreciated. And thank you for making this fork available :)

Verbose output

2016-12-24 09:19:53 fauxmo:19       INFO     Fauxmo version 0.3.4
2016-12-24 09:19:54 fauxmo:39       DEBUG    3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609]
2016-12-24 09:19:54 fauxmo:46       INFO     Using config: /etc/fauxmo/config.json
2016-12-24 09:19:54 fauxmo:16       DEBUG    Attempting to get IP address automatically
2016-12-24 09:19:54 fauxmo:29       DEBUG    Using IP address: 192.168.132.2
2016-12-24 09:19:54 asyncio:979      INFO     <Server sockets=[<socket.socket fd=8, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.132.2', 12340)>]> is serving
2016-12-24 09:19:54 fauxmo:81       DEBUG    {'name': 'fake switch one', 'action_handler': <fauxmo.handlers.rest.RESTAPIHandler object at 0xb5e31ed0>}
2016-12-24 09:19:54 asyncio:979      INFO     <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.132.2', 12341)>]> is serving
2016-12-24 09:19:54 fauxmo:81       DEBUG    {'name': 'fake Indigo switch', 'action_handler': <fauxmo.handlers.rest.RESTAPIHandler object at 0xb605b190>}
2016-12-24 09:19:54 asyncio:979      INFO     <Server sockets=[<socket.socket fd=10, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.132.2', 12342)>]> is serving
2016-12-24 09:19:54 fauxmo:81       DEBUG    {'name': 'fake hass switch by REST API', 'action_handler': <fauxmo.handlers.rest.RESTAPIHandler object at 0xb6352710>}
2016-12-24 09:19:54 fauxmo:107      INFO     Starting UDP server
2016-12-24 09:19:54 asyncio:853      INFO     Datagram endpoint local_addr=('0.0.0.0', 1900) remote_addr=None created: (<_SelectorDatagramTransport fd=11 read=idle write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0xb5e315b0>)
2016-12-24 09:20:05 asyncio:1266     INFO     poll took 10579.304 ms: 1 events
2016-12-24 09:20:05 fauxmo:159      DEBUG    Received data below from ('192.168.132.112', 50000):
2016-12-24 09:20:05 fauxmo:160      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 15\r\nST: urn:Belkin:device:**\r\n\r\n'
2016-12-24 09:20:05 fauxmo:191      DEBUG    Sending response to ('192.168.132.112', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Sat, 24 Dec 2016 17:20:05 GMT
EXT:
LOCATION: http://192.168.132.2:12340/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: de208b1d-a1f0-43d1-816f-d7a87c66ddc9
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-2d4ac336-8683-3660-992a-d056b5382a8d::urn:Belkin:device:**


2016-12-24 09:20:05 fauxmo:191      DEBUG    Sending response to ('192.168.132.112', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Sat, 24 Dec 2016 17:20:05 GMT
EXT:
LOCATION: http://192.168.132.2:12341/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: cfd2d98c-0b0c-481b-bd68-3402745c9869
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-85a333cd-bad0-370b-b7d0-0d63a93d3c5c::urn:Belkin:device:**


2016-12-24 09:20:05 fauxmo:191      DEBUG    Sending response to ('192.168.132.112', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Sat, 24 Dec 2016 17:20:05 GMT
EXT:
LOCATION: http://192.168.132.2:12342/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: b3e72fc2-0527-4730-a541-970808fc0add
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-cbc4bc63-e0e2-3a78-8a9f-f0ff7e419b79::urn:Belkin:device:**


2016-12-24 09:20:05 fauxmo:159      DEBUG    Received data below from ('192.168.132.112', 50000):
2016-12-24 09:20:05 fauxmo:160      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 15\r\nST: urn:Belkin:device:**\r\n\r\n'
2016-12-24 09:20:05 fauxmo:191      DEBUG    Sending response to ('192.168.132.112', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Sat, 24 Dec 2016 17:20:05 GMT
EXT:
LOCATION: http://192.168.132.2:12340/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 0ff411e4-15b1-4651-a6a8-21eb15345360
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-2d4ac336-8683-3660-992a-d056b5382a8d::urn:Belkin:device:**


2016-12-24 09:20:05 fauxmo:191      DEBUG    Sending response to ('192.168.132.112', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Sat, 24 Dec 2016 17:20:05 GMT
EXT:
LOCATION: http://192.168.132.2:12341/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 2a832aef-ec62-45bd-9258-ed47a30d8f9f
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-85a333cd-bad0-370b-b7d0-0d63a93d3c5c::urn:Belkin:device:**


2016-12-24 09:20:05 fauxmo:191      DEBUG    Sending response to ('192.168.132.112', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Sat, 24 Dec 2016 17:20:05 GMT
EXT:
LOCATION: http://192.168.132.2:12342/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: b78f531d-9269-45a6-a89b-5fbf2ba0597f
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-cbc4bc63-e0e2-3a78-8a9f-f0ff7e419b79::urn:Belkin:device:**


2016-12-24 09:20:05 fauxmo:159      DEBUG    Received data below from ('192.168.132.112', 50000):
2016-12-24 09:20:05 fauxmo:160      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 15\r\nST: urn:schemas-upnp-org:device:basic:1\r\n\r\n'
2016-12-24 09:20:05 fauxmo:159      DEBUG    Received data below from ('192.168.132.112', 50000):
2016-12-24 09:20:05 fauxmo:160      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 15\r\nST: urn:schemas-upnp-org:device:basic:1\r\n\r\n'
^C2016-12-24 09:20:26 asyncio:1266     INFO     poll took 21246.405 ms: 1 events
2016-12-24 09:20:26 fauxmo:120      DEBUG    Shutdown starting...
2016-12-24 09:20:26 fauxmo:123      DEBUG    Shutting down server 0...
2016-12-24 09:20:26 fauxmo:123      DEBUG    Shutting down server 1...
2016-12-24 09:20:26 fauxmo:123      DEBUG    Shutting down server 2...

My config.json

{
    "FAUXMO": {
        "ip_address": "auto"
    },
    "DEVICES": [
        {
            "port": 12340,
            "handler": {
                "on_cmd": "http://192.168.1.104/myserver/fakeswitches/01/on",
                "off_cmd": "http://192.168.1.104/myserver/fakeswitches/01/off",
                "method": "GET"
            },
            "description": "fake switch one"
        },
        {
            "port": 12341,
            "handler": {
                "on_cmd": "http://localhost:54321/devices/garage%20light",
                "off_cmd": "http://localhost:54321/devices/garage%20light",
                "on_data": {"isOn": 1},
                "off_data": {"isOn": 0},
                "user": "this",
                "password": "that",
                "auth_type": "digest",
                "method": "PUT"
            },
            "description": "fake Indigo switch"
        },
        {
            "port": 12342,
            "handler": {
                "on_cmd": "http://192.168.1.104:8123/api/services/switch/turn_on",
                "off_cmd": "http://192.168.1.104:8123/api/services/switch/turn_off",
                "method": "POST",
                "headers": {"x-ha-access": "your_hass_password"},
                "on_json": {"entity_id": "switch.fake_hass_switch"},
                "off_json": {"entity_id": "switch.fake_hass_switch"}
            },
            "description": "fake hass switch by REST API"
        }
    ],
    "HOMEASSISTANT": {
        "enable": false,
        "host": "192.168.1.104",
        "port": 8123,
        "password": "your_hass_password",
        "DEVICES": [
            {
                "description": "hass switch by python API",
                "port": 12350,
                "entity_id": "switch.fake_hass_switch"
            }
        ]
    }
}

Fauxmo conflicts with pywemo

I've been getting a HomeAssistant error for a couple months during setup of the Wemo component. It complaints about an error setting up the wemo component, and this (among other stuff) appears in the logs:

requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('<scpd xmlns="urn:Belkin:service-1-0"><actionList><action><name>SetBinaryState</name><argumentList><argument><retval/><name>BinaryState</name><relatedStateVariable>BinaryState</relatedStateVariable><direction>in</direction></argument></argumentList></action><action><name>GetBinaryState</name><argumentList><argument><retval/><name>BinaryState</name><relatedStateVariable>BinaryState</relatedStateVariable><direction>out</direction></argument></argumentList></action></actionList><serviceStateTable><stateVariable sendEvents="yes"><name>BinaryState</name><dataType>Boolean</dataType><defaultValue>0</defaultValue></stateVariable><stateVariable sendEvents="yes"><name>level</name><dataType>string</dataType><defaultValue>0</defaultValue></stateVariable></serviceStateTable></scpd>\r\n',))

My current workaround is to disable discovery for belkin_wemo and just use the IP address.

Trying to hunt down the source of the problem, just yesterday I discovered pywemo/pywemo#45 which references Fauxmo, and made me realize maybe there was a conflict. Sure enough, I shut down Fauxmo, restarted hass, and the error went away. Just to double check, I opened up a repl and provoked the error with pywemo.discover_devices() with Fauxmo running, shut down Fauxmo and that command worked.

So now I need to figure out what to do about it.

Turning off discovery and using static IP for wemo devices is a reasonable workaround in the meantime.

In the bigger scheme of things, I could either

  1. have Fauxmo try to recognize a pywemo search and not respond, or
  2. try to figure out what part of the response isn't working for pywemo and fix it, allowing pywemo to work as a cli for Fauxmo as per the issue referenced

POST method doesn't support raw on/off data

  • Operating system and version: NixOS 17.09.3129.1dcd022f01b (Hummingbird)
  • Python version: 3.6
  • Fauxmo version (fauxmo --version): v0.4.6
  • Echo device type (e.g. Echo, Echo Plus, Dot): Echo Dot
  • Echo Firmware Version: 601481020

My Issue

To send commands to openhab items I need to be able to send raw data using POST.
I basically need to replicate a command like this:
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "OFF" "http://127.0.0.1:7080/rest/items/Lights"

on_data and off_data are required to be dict objects. And it seems that in simplehttpplugin.py#L126, urlencode forces a '=' into the POST data.
simple example:

>>> import urllib
>>> dict = {'' : 'ON'}
>>> urllib.urlencode(dict)
'=ON'

Which causes this error in the openhab logs:
2018-04-17 17:30:08.578 [WARN ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/Lights' with an invalid status value '=ON'.

I couldn't figure out the right way to force raw text to be sent with the POST command. It seems this is the only want to set the state of items using the openhab REST API.

config.json:

{
    "FAUXMO": {
        "ip_address": "auto"
    },
    "PLUGINS": {
      "SimpleHTTPPlugin": {
        "DEVICES": [
          {
            "port": 52002,
            "on_cmd":  "http://127.0.0.1:7080/rest/items/Lights",
            "off_cmd": "http://127.0.0.1:7080/rest/items/Lights",
            "method": "POST",
            "headers": {"Content-type": "text/plain", "Accept": "application/json"},
            "name": "All Lights",
            "on_data": {"": "ON"}
          }
        ]
      }
    }
}

FWIW, I was able to make this work in a much older version (v0.3.2), where i was able to put just a string into on_data.

nix expression

No such file or directory: '/path/to/commandlineplugin.py'

OS: Raspian
Python: 3.6.3
Json:
{
"FAUXMO": {
"ip_address": "auto"
},
"PLUGINS": {
"CommandLinePlugin": {
"path": "/path/to/commandlineplugin.py",
"DEVICES": [
{
"name": "output stuff to a file",
"port": 49915,
"on_cmd": "touch testfile.txt",
"off_cmd": "rm testfile.txt",
"state_cmd": "ls testfile.txt"
}
]
}
}
}

Output:
pi@raspberrypi:~/Desktop $ bash "Start Alexa Devices.sh"2018-01-21 23:20:05 fauxmo:37 INFO Fauxmo v0.4.5
2018-01-21 23:20:05 fauxmo:38 DEBUG 3.6.3 (default, Jan 20 2018, 23:01:25)
[GCC 6.3.0 20170516]
2018-01-21 23:20:05 fauxmo:24 DEBUG Attempting to get IP address automatically
2018-01-21 23:20:05 fauxmo:37 DEBUG Using IP address: 192.168.1.137
Traceback (most recent call last):
File "/opt/pyenv/versions/3.6.3/lib/python3.6/site-packages/fauxmo/fauxmo.py", line 86, in main
module = importlib.import_module(modname)
File "/opt/pyenv/versions/3.6.3/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fauxmo.plugins.commandlineplugin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/pyenv/versions/3.6.3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/opt/pyenv/versions/3.6.3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/pyenv/versions/3.6.3/lib/python3.6/site-packages/fauxmo/cli.py", line 34, in
cli()
File "/opt/pyenv/versions/3.6.3/lib/python3.6/site-packages/fauxmo/cli.py", line 30, in cli
main(config_path_str=args.config, verbosity=verbosity)
File "/opt/pyenv/versions/3.6.3/lib/python3.6/site-packages/fauxmo/fauxmo.py", line 90, in main
module = module_from_file(modname, path_str)
File "/opt/pyenv/versions/3.6.3/lib/python3.6/site-packages/fauxmo/utils.py", line 71, in module_from_file
spec.loader.exec_module(module)
File "", line 674, in exec_module
File "", line 780, in get_code
File "", line 832, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/path/to/commandlineplugin.py'


I'm starting faux with:
cd /home/pi/HomeAutomation
"$(pyenv root)"/versions/3.6.3/bin/python3.6 -m fauxmo.cli -c config.json -vvv

I receive syntax errors whenever i try to call fauxmo using just "python3"

Automatic IP address detection messed up by VPN

@candrews67 emailed me to note that Fauxmo wasn't working. He uses a VPN address and found that it would work sometimes depending on the status of the VPN. Here's his traceback:

Traceback (most recent call last):
  File "fauxmo/venv/bin/fauxmo", line 9, in <module>
    load_entry_point('fauxmo==0.1.7', 'console_scripts', 'fauxmo')()
  File "fauxmo/fauxmo/cli.py", line 37, in cli
    main(config_path=args.config, verbosity=verbosity)
  File "fauxmo/fauxmo/fauxmo.py", line 166, in main
    action_handler=action_handler)
  File "fauxmo/fauxmo/fauxmo.py", line 53, in __init__
    ip_address=self.ip_address)
  File "fauxmo/fauxmo/upnp.py", line 75, in __init__
    self.socket.bind((self.ip_address, self.port))
OSError: [Errno 49] Can't assign requested address

With some tinkering, I think we figured out that it's a problem with the get_local_ip function in upnp.py, and it works with a manually specified IP address. In cases like this, it would be nice if there was a way to override the automatic IP detection.

Help with Config.json

  • Operating system and version: Raspian Linux ver8
  • Python Version: 3.6.1
  • Fauxmo version (fauxmo --version): 0.4.4

My Issue

I updated to your latest version of Fauxmo, along with Python 3.6.1. I am trying to set up my devices but am having an issue figuring out the config.json format and was hoping someone would be kind enough to help me figure out the entries I need.

I am using home built ESP8266 devices, they all worked with the old version of Fauxmo from MakerMusing. I can access them via my cell phone app and Alexa will "Discover" the entries, but gives me a "Not responding" message with each.

WHYT

My original Fauxmo entries were:

['couch lamp', rest_api_handler('http://196.163.1.128/gpio/1', 'http://196.163.1.128/gpio/0')],
['garage door', rest_api_handler('http://196.163.1.132/gpio/1', 'http://196.163.1.132/gpio/0')],
['Universal Garage Door', rest_api_handler('http://196.163.1.120/gpio/1', 'http://196.163.1.120/gpio/0')],

['garage light', rest_api_handler('http://196.163.1.TBD/gpio/1', 'http://196.163.1.TBD/gpio/0')],
['christmas lights', rest_api_handler('http://196.163.1.131/gpio/1', 'http://196.163.1.131/gpio/0')],

I have tried several different formats for the config.json including the below:

{
                    "port": 12340,
                    "on_cmd": "http://196.163.1.120/gpio/0",
                    "off_cmd": "http://196.163.1.120/gpio/1",
                    "method": "GET",
                    "name": "Garage Door"
                },
                {
                    "port": 12341,
                    "on_cmd": "http://localhost:54321/devices/garage%20door",
                    "off_cmd": "http://localhost:54321/devices/garage%20door",
                    "on_data": {"isOn": 1},
                    "off_data": {"isOn": 0},
                    "user": "this",
                    "password": "that",
                    "method": "PUT",
                    "name": "fake Indigo switch"
                },
                {
                    "name": "Couch Lamp",
                    "port": 12342,
                  "on_cmd": "http://196.163.1.128:8123/api/services/switch/turn_on",
                    "off_cmd": "http://196.163.1.128:8123/api/services/switch/turn_off",
                    
                    "method": "POST",
                    "headers": {"x-ha-access": "your_hass_password"},
                    "on_data": {"couch lamp": "switch.couch_lamp"},
                    "off_data": {"couch": "switch.couch_lamp"}
                }

But I get the same result with each. Below is the debug output:
File "/usr/local/lib/python3.6/asyncio/events.py", line 126, in _run
self._callback(*self._args)
File "/usr/local/lib/python3.6/asyncio/selector_events.py", line 731, in _read_ready
self._protocol.data_received(data)
File "/usr/local/lib/python3.6/site-packages/fauxmo/protocols.py", line 55, in data_received
self.handle_action(msg)
File "/usr/local/lib/python3.6/site-packages/fauxmo/protocols.py", line 103, in handle_action
success = self.plugin.on()
File "/usr/local/lib/python3.6/site-packages/fauxmo/plugins/simplehttpplugin.py", line 100, in set_state
with self.urlopen(req) as resp:
File "/usr/local/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/local/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.6/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/local/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

I know this should be easy but I'm not really much of a software person.

Any Help would be greatly appreciated.

Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues

Install Failure on Raspberry Pi 3

  • Raspian Kernal 4.4 May 2016:
  • Python 3.4.2:
  • Fauxmo version V0.3.2:

My Issue: trying to install Fauxmo on a Raspberry Pi 3 and I am getting an install error

Error: Command '['/home/pi/fauxmo/venv/bin/python3, , '-| m, 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

I'm fairly new to Raspberry Pi, is this a version error? Not sure what to do here?

WHYT


Please make sure you've taken these steps before submitting a new issue:

  • Include the Python and Fauxmo version in your issue
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Search the existing (and closed) issues

Syntax error on fauxmo -c /home/pi/config.json -vvv

  • Operating system and version: raspberry pi Linux version 4.9.41-v7+
  • Python version: 3.6
  • Fauxmo version (fauxmo --version): 0.4.4.

My Issue

(venv) pi@raspberrypi:~/venv $ fauxmo -c /home/pi/config.json -vvv
Traceback (most recent call last):
File "/home/pi/venv/bin/fauxmo", line 7, in
from fauxmo.cli import cli
File "/home/pi/venv/lib/python3.5/site-packages/fauxmo/cli.py", line 10, in
from fauxmo.fauxmo import main
File "/home/pi/venv/lib/python3.5/site-packages/fauxmo/fauxmo.py", line 37
logger.info(f"Fauxmo version {version}")
^
SyntaxError: invalid syntax

I´ve worked thru the commands and with the last command i get this error.

config ist just cp the original config sample

WHYT

i´ve tried to google it but haven´t found a solution

Discovery not working on raspberry pi

Sorry to bother you with this, but after several reinstalls I am out of ideas.

I've got a current raspbian jessie installed on my raspberry pi 2 but my amazon echo won't find the virtual wemo devices.
When I was tired of new installations I finally gave it a try on a MacBook and it worked out of the box. The same is true for an Intel NUC running an older Ubuntu - all I needed were your 3 quick installation steps and it worked.
The raspberry pi is online (I've updated the system) and an installed mqtt server (mosquitto) can be reached from all my other machines.

Do you have any idea what might be wrong?

This is the output for a stripped down config.json:
2016-03-30 02:37:42 fauxmo DEBUG Listening for UPnP broadcasts
2016-03-30 02:37:42 fauxmo INFO Using config: ./config.json
2016-03-30 02:37:42 fauxmo DEBUG Using IP address: 192.168.27.52
2016-03-30 02:37:42 fauxmo DEBUG Attempting to bind: 192.168.27.52:12345
2016-03-30 02:37:42 fauxmo DEBUG UPnP broadcast listener: new device registered
2016-03-30 02:37:42 fauxmo DEBUG Device living room light ready on 192.168.27.52:12345
2016-03-30 02:37:42 fauxmo DEBUG {'uuid': UUID('e2d2c9d3-176a-410e-aa53-3448f6724c6f'), 'socket': <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=0, laddr=('192.168.27.52', 12345)>, 'port': 12345, 'other_headers': ['X-User-Agent: Fauxmo'], 'action_handler': <fauxmo.handlers.rest.RestApiHandler object at 0x7619b4f0>, 'name': 'living room light', 'server_version': 'Unspecified, UPnP/1.0, Unspecified', 'client_sockets': {}, 'poller': <fauxmo.upnp.Poller object at 0x76290e10>, 'serial': '5ff80a07-b9b1-3f20-b174-1ec5b08d2573', 'listener': <fauxmo.upnp.UpnpBroadcastResponder object at 0x76290d10>, 'ip_address': '192.168.27.52', 'root_url': 'http://{}:{}/setup.xml'}
2016-03-30 02:37:42 fauxmo DEBUG Entering main loop (polling)

Thanks a lot!

Errors after start fauxmo.py

  • Operating system and version: Windows 10 x64
  • Python version: Python 3.6.0 :: Anaconda custom (64-bit)
  • Fauxmo version (fauxmo --version): v0.4.4

My Issue

I can run the file without error, but Alexa does not find any new devices. What can I do to find out the cause of the problem? Thanks.

WHYT


Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues

Many typos from pip3 install

  • Ubuntu 16.04:
  • Python 3.5.2:
  • Fauxmo version unknown - version is all that prints (fauxmo --help):

2017-08-03 10:50:24 fauxmo:37 INFO Fauxmo version {version}

From a pip3 install, the files fauxmo.py, protocols.py, and utils.py contain many syntax errors. All of them caused by seemingly random strings that are preceded by a single, lower-case, 'f' character.

WHYT

I edited the installed files, gave up on:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/fauxmo/fauxmo.py", line 86, in main
module = importlib.import_module(modname)
File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 944, in _find_and_load_unlocked
File "", line 222, in _call_with_frames_removed
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 944, in _find_and_load_unlocked
File "", line 222, in _call_with_frames_removed
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 944, in _find_and_load_unlocked
File "", line 222, in _call_with_frames_removed
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 956, in _find_and_load_unlocked
ImportError: No module named '{package}'

I assumed the project is abandoned.


Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues

Alexa cant find the WeMo(s)

  • Raspberry Pi
  • Python version: 3.6.1
  • Fauxmo version: v0.4.4

My Issue

Alexa can't find fauxo.
I don't have any problems executing the Scripts and I can't see any problems in the DEBUG:

2017-11-04 14:22:42 fauxmo:170 DEBUG Received data below from ('192.168.178.29', 57570): 2017-11-04 14:22:42 fauxmo:171 DEBUG b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 2\r\nST: urn:schemas-upnp-org:device:MediaServer:1\r\n\r\n' 2017-11-04 14:22:42 asyncio:1379 DEBUG poll took 299.963 ms: 1 events 2017-11-04 14:22:42 fauxmo:170 DEBUG Received data below from ('192.168.178.29', 45322): 2017-11-04 14:22:42 fauxmo:171 DEBUG b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 2\r\nST: urn:schemas-upnp-org:device:MediaRenderer:1\r\n\r\n'

This repeats all over again. So i cant understand why Alexa can't find the Rpi / fauxmo :(

I guess, that Im just dumb and forgot to disable a firewall somewhere... But:

  • My network is running a Fritz!Box
  • I tried the "exposed host" option
  • I tried to open the Port UDP 1600

WHYT

  • I tried to use the original fauxmo from makermusings, no success
  • I tried to use other, different fauxo versions, no success
  • I tried to find something related to the raspberry in GUPnP Universal Control Point (I don't know if you could find it anyway there, I am quite new to this IOT thing)
  • If I run echo -e "M-SEARCH\r\nurn:Belkin:device:**" | nc.traditional -u 239.255.255.250 1900 (had that command from another GutHub issue), I see see some responses and in the version from makermusings I even saw "DEBUG:root:Responding to serarch for living room". So as I said: It's propably a network config mistake, but Im not able to find it.

Sorry for the bad english and my stupidness :P

Syntax Error while running fauxmo

  • Operating system and version: Raspberry Pi Rasbian Jessie
  • Python version: 3.4.2
  • Fauxmo version (fauxmo --help): Not able to retrieve the version

My Issue

I tried to install and run fauxmo using the instructions at README [https://github.com/n8henrie/fauxmo#simple-install-from-pypi]

Traceback (most recent call last):
  File "/home/pi/venv/bin/fauxmo", line 7, in <module>
    from fauxmo.cli import cli
  File "/home/pi/venv/lib/python3.4/site-packages/fauxmo/cli.py", line 10, in <module>
    from fauxmo.fauxmo import main
  File "/home/pi/venv/lib/python3.4/site-packages/fauxmo/fauxmo.py", line 37
    logger.info(f"Fauxmo version {__version__}")
                                              ^
SyntaxError: invalid syntax

Are there any python dependencies not satisfied here?

WHYT


Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues

Make find_unused_port a local function instead of relying on test.support

  • Operating system and version:
  • Python version: 3.6.4
  • Fauxmo version (fauxmo --version): 0.4.5
  • Echo device type (e.g. Echo, Echo Plus, Dot): Echo Plus 2nd Gen
  • Echo Firmware Version:

My Issue

I cannot get fauxmo running as a startup service. Everything works perfectly when I use it under my virtualenv:
fauxmo -c config.json -v

But when I try:
python -m fauxmo.cli -c config.json -v

I get:

(venv) pi@raspi2:~$ python -m fauxmo.cli -c config.json -v
34
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/venv/lib/python3.6/site-packages/fauxmo/cli.py", line 10, in <module>
    from fauxmo.fauxmo import main
  File "/home/pi/venv/lib/python3.6/site-packages/fauxmo/fauxmo.py", line 15, in <module>
    from test.support import find_unused_port
ModuleNotFoundError: No module named 'test.support'; 'test' is not a package

If I try starting it without loading my venv it either takes the wrong python version(2.7.?) or it brings the same error as above.

And the same happens when I start it as service.

WHYT

Alexa Response for simple URL call

  • 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?

Uninstalled newer Home Assisstant

  • Raspian Jessie:
  • Python 3.4.2:
  • Fauxmo 0.3.6:

My Issue

I had the latest Home Assistant installed on this Pi and when I installed fauxmo from pip it uninstalled it and then installed an older version. Some of the things I had configured no longer work. I wasn't aware this would happen. Did I miss a warning? I'm a bit of a pip noob.

Authentication

Now that I've got Fauxmo running, I'm trying to use it to send URLs to my Indigo home automation app running on the same server. Unfortunately, I can't seem to figure out how to send URLs with usernames and passwords and I can't turn off authentication since it's accessed from the outside. My workaround is to use Home Remote as an intermediary server and turn off its authentication since it is only used internally on my LAN.

When I try to embed a username and password in the URL, fauxmo gives no error but Alexa complains that "That command doesn’t work on that device." This happens with both Indigo and Home Remote.

Is there any trick to using authentication with fauxmo?

Echo not recognizing devices

  • Operating system and version: macOS 10.12.6
  • Python version: 3.6.3
  • Fauxmo version (fauxmo --version): v0.4.5

My Issue

Continuation from my post here (#33), have updated to 0.4.5. After updating, behavior is a little bit different. Device discovery on Echo is seemingly successful every time now, and I'm not getting hung up on the simplehttp plugin... but every time i issue a voice command to a device it says it can't find it (e.g. "sorry, i can't find T.V.").

WHYT

Upgraded fauxmo, forgetting/re-discovering devices. Here is my debug and config.json:

(venv) eschermedia:bin escher$ ./fauxmo -c config.json -vvv
2017-11-24 08:45:13 fauxmo:37       INFO     Fauxmo v0.4.5
2017-11-24 08:45:13 fauxmo:38       DEBUG    3.6.3 (v3.6.3:2c5fed86e0, Oct  3 2017, 00:32:08) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
2017-11-24 08:45:13 fauxmo:24       DEBUG    Attempting to get IP address automatically
2017-11-24 08:45:13 fauxmo:37       DEBUG    Using IP address: 192.168.1.101
2017-11-24 08:45:13 fauxmo:100      DEBUG    plugin_vars: {}
2017-11-24 08:45:13 fauxmo:103      DEBUG    device config: {'port': 12340, 'on_cmd': 'http://192.168.1.104/myserver/fakeswitches/01/on', 'off_cmd': 'http://192.168.1.101/television/off', 'method': 'GET', 'name': 'T.V.'}
2017-11-24 08:45:13 asyncio:1068     INFO     <Server sockets=[<socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12340)>]> is serving
2017-11-24 08:45:13 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'T.V.', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x102e6bbe0>}
2017-11-24 08:45:13 fauxmo:103      DEBUG    device config: {'port': 12341, 'on_cmd': 'http://192.168.1.101/television/pause', 'off_cmd': 'http://192.168.1.101/television/pause', 'method': 'GET', 'name': 'T.V. Pause'}
2017-11-24 08:45:13 asyncio:1068     INFO     <Server sockets=[<socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12341)>]> is serving
2017-11-24 08:45:13 fauxmo:121      DEBUG    Started fauxmo device: {'name': 'T.V. Pause', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x103847e80>}
2017-11-24 08:45:13 fauxmo:123      INFO     Starting UDP server
2017-11-24 08:45:13 asyncio:948      DEBUG    Datagram endpoint remote_addr=None created: (<_SelectorDatagramTransport fd=12 read=idle write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0x102e40cc0>)
2017-11-24 08:45:18 asyncio:1380     INFO     poll took 4815.082 ms: 1 events
2017-11-24 08:45:18 fauxmo:223      DEBUG    Received data below from ('192.168.1.63', 50000):
2017-11-24 08:45:18 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 15\r\nST: urn:Belkin:device:**\r\n\r\n'
2017-11-24 08:45:18 fauxmo:258      DEBUG    Sending response to ('192.168.1.63', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Fri, 24 Nov 2017 15:45:18 GMT
EXT:
LOCATION: http://192.168.1.101:12340/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 36c4fbd9-604c-45a3-ace5-a6928ed6da26
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-cc85abef-58d3-31b5-9d22-15f84f0e9ad9::urn:Belkin:device:**


2017-11-24 08:45:18 fauxmo:258      DEBUG    Sending response to ('192.168.1.63', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Fri, 24 Nov 2017 15:45:18 GMT
EXT:
LOCATION: http://192.168.1.101:12341/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 08ac2fdb-036d-4921-82a0-e22c7c142f89
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-e32c15ba-7d29-359e-b1ce-e29bd39a4238::urn:Belkin:device:**


2017-11-24 08:45:18 asyncio:1380     DEBUG    poll took 102.376 ms: 1 events
2017-11-24 08:45:18 fauxmo:223      DEBUG    Received data below from ('192.168.1.63', 50000):
2017-11-24 08:45:18 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 15\r\nST: urn:Belkin:device:**\r\n\r\n'
2017-11-24 08:45:18 fauxmo:258      DEBUG    Sending response to ('192.168.1.63', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Fri, 24 Nov 2017 15:45:18 GMT
EXT:
LOCATION: http://192.168.1.101:12340/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 9d473a6b-7e0a-4358-8381-791fc5176b42
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-cc85abef-58d3-31b5-9d22-15f84f0e9ad9::urn:Belkin:device:**


2017-11-24 08:45:18 fauxmo:258      DEBUG    Sending response to ('192.168.1.63', 50000):
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=86400
DATE: Fri, 24 Nov 2017 15:45:18 GMT
EXT:
LOCATION: http://192.168.1.101:12341/setup.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 33aa131b-31b3-47a3-be23-5c745a9f99aa
SERVER: Unspecified, UPnP/1.0, Unspecified
ST: urn:Belkin:device:**
USN: uuid:Socket-1_0-e32c15ba-7d29-359e-b1ce-e29bd39a4238::urn:Belkin:device:**


2017-11-24 08:45:18 asyncio:1380     DEBUG    poll took 134.967 ms: 1 events
2017-11-24 08:45:18 fauxmo:223      DEBUG    Received data below from ('192.168.1.63', 50000):
2017-11-24 08:45:18 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 15\r\nST: urn:schemas-upnp-org:device:basic:1\r\n\r\n'
2017-11-24 08:45:18 asyncio:1380     DEBUG    poll took 103.111 ms: 1 events
2017-11-24 08:45:18 fauxmo:223      DEBUG    Received data below from ('192.168.1.63', 50000):
2017-11-24 08:45:18 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\nMX: 15\r\nST: urn:schemas-upnp-org:device:basic:1\r\n\r\n'
2017-11-24 08:45:18 asyncio:1380     DEBUG    poll took 175.712 ms: 1 events
2017-11-24 08:45:18 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12341)>]> got a new connection from ('192.168.1.63', 35037): <socket.socket fd=13, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12341), raddr=('192.168.1.63', 35037)>
2017-11-24 08:45:18 fauxmo:38       DEBUG    Connection made with: ('192.168.1.63', 35037)
2017-11-24 08:45:18 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12340)>]> got a new connection from ('192.168.1.63', 38198): <socket.socket fd=14, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12340), raddr=('192.168.1.63', 38198)>
2017-11-24 08:45:18 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12340)>]> got a new connection from ('192.168.1.63', 38201): <socket.socket fd=15, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12340), raddr=('192.168.1.63', 38201)>
2017-11-24 08:45:18 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12341)>]> got a new connection from ('192.168.1.63', 35040): <socket.socket fd=16, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12341), raddr=('192.168.1.63', 35040)>
2017-11-24 08:45:18 fauxmo:38       DEBUG    Connection made with: ('192.168.1.63', 38198)
2017-11-24 08:45:18 fauxmo:38       DEBUG    Connection made with: ('192.168.1.63', 38201)
2017-11-24 08:45:18 fauxmo:38       DEBUG    Connection made with: ('192.168.1.63', 35040)
2017-11-24 08:45:18 fauxmo:49       DEBUG    Received message:
GET /setup.xml HTTP/1.1
Host: 192.168.1.101:12341
Accept: */*


2017-11-24 08:45:18 fauxmo:51       INFO     setup.xml requested by Echo
2017-11-24 08:45:18 fauxmo:88       DEBUG    Fauxmo response to setup request:
HTTP/1.1 200 OK
CONTENT-LENGTH: 333
CONTENT-TYPE: text/xml
DATE: Fri, 24 Nov 2017 15:45:18 GMT
LAST-MODIFIED: Sat, 01 Jan 2000 00:01:15 GMT
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<?xml version="1.0"?><root><device><deviceType>urn:Fauxmo:device:controllee:1</deviceType><friendlyName>T.V. Pause</friendlyName><manufacturer>Belkin International Inc.</manufacturer><modelName>Emulated Socket</modelName><modelNumber>3.1415</modelNumber><UDN>uuid:Socket-1_0-e32c15ba-7d29-359e-b1ce-e29bd39a4238</UDN></device></root>
2017-11-24 08:45:18 fauxmo:49       DEBUG    Received message:
GET /setup.xml HTTP/1.1
Host: 192.168.1.101:12340
Accept: */*


2017-11-24 08:45:18 fauxmo:51       INFO     setup.xml requested by Echo
2017-11-24 08:45:18 fauxmo:88       DEBUG    Fauxmo response to setup request:
HTTP/1.1 200 OK
CONTENT-LENGTH: 327
CONTENT-TYPE: text/xml
DATE: Fri, 24 Nov 2017 15:45:18 GMT
LAST-MODIFIED: Sat, 01 Jan 2000 00:01:15 GMT
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<?xml version="1.0"?><root><device><deviceType>urn:Fauxmo:device:controllee:1</deviceType><friendlyName>T.V.</friendlyName><manufacturer>Belkin International Inc.</manufacturer><modelName>Emulated Socket</modelName><modelNumber>3.1415</modelNumber><UDN>uuid:Socket-1_0-cc85abef-58d3-31b5-9d22-15f84f0e9ad9</UDN></device></root>
2017-11-24 08:45:18 fauxmo:49       DEBUG    Received message:
GET /setup.xml HTTP/1.1
Host: 192.168.1.101:12341
Accept: */*


2017-11-24 08:45:18 fauxmo:51       INFO     setup.xml requested by Echo
2017-11-24 08:45:18 fauxmo:88       DEBUG    Fauxmo response to setup request:
HTTP/1.1 200 OK
CONTENT-LENGTH: 333
CONTENT-TYPE: text/xml
DATE: Fri, 24 Nov 2017 15:45:18 GMT
LAST-MODIFIED: Sat, 01 Jan 2000 00:01:15 GMT
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<?xml version="1.0"?><root><device><deviceType>urn:Fauxmo:device:controllee:1</deviceType><friendlyName>T.V. Pause</friendlyName><manufacturer>Belkin International Inc.</manufacturer><modelName>Emulated Socket</modelName><modelNumber>3.1415</modelNumber><UDN>uuid:Socket-1_0-e32c15ba-7d29-359e-b1ce-e29bd39a4238</UDN></device></root>
2017-11-24 08:45:18 fauxmo:49       DEBUG    Received message:
GET /setup.xml HTTP/1.1
Host: 192.168.1.101:12340
Accept: */*


2017-11-24 08:45:18 fauxmo:51       INFO     setup.xml requested by Echo
2017-11-24 08:45:18 fauxmo:88       DEBUG    Fauxmo response to setup request:
HTTP/1.1 200 OK
CONTENT-LENGTH: 327
CONTENT-TYPE: text/xml
DATE: Fri, 24 Nov 2017 15:45:18 GMT
LAST-MODIFIED: Sat, 01 Jan 2000 00:01:15 GMT
SERVER: Unspecified, UPnP/1.0, Unspecified
X-User-Agent: Fauxmo
CONNECTION: close

<?xml version="1.0"?><root><device><deviceType>urn:Fauxmo:device:controllee:1</deviceType><friendlyName>T.V.</friendlyName><manufacturer>Belkin International Inc.</manufacturer><modelName>Emulated Socket</modelName><modelNumber>3.1415</modelNumber><UDN>uuid:Socket-1_0-cc85abef-58d3-31b5-9d22-15f84f0e9ad9</UDN></device></root>
2017-11-24 08:45:23 asyncio:1380     INFO     poll took 4611.996 ms: 1 events
2017-11-24 08:45:23 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 64095):
2017-11-24 08:45:23 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: "ssdp:discover"\r\nST: ssdp:all\r\nMX: 5\r\n\r\n'
2017-11-24 08:45:26 asyncio:1380     INFO     poll took 2638.086 ms: 1 events
2017-11-24 08:45:26 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 56395):
2017-11-24 08:45:26 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 1\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nHost: 239.255.255.250:1900\r\nConnection: close\r\n\r\n'
2017-11-24 08:45:26 asyncio:1380     DEBUG    poll took 0.013 ms: 1 events
2017-11-24 08:45:26 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 56395):
2017-11-24 08:45:26 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 1\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nHost: 239.255.255.250:1900\r\nConnection: close\r\n\r\n'
2017-11-24 08:45:27 asyncio:1380     INFO     poll took 1000.140 ms: 1 events
2017-11-24 08:45:27 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 53035):
2017-11-24 08:45:27 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 1\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nHost: 239.255.255.250:1900\r\nConnection: close\r\n\r\n'
2017-11-24 08:45:27 asyncio:1380     DEBUG    poll took 0.029 ms: 1 events
2017-11-24 08:45:27 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 53035):
2017-11-24 08:45:27 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 1\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nHost: 239.255.255.250:1900\r\nConnection: close\r\n\r\n'
2017-11-24 08:45:33 asyncio:1380     INFO     poll took 6350.245 ms: 1 events
2017-11-24 08:45:33 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 64095):
2017-11-24 08:45:33 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: "ssdp:discover"\r\nST: ssdp:all\r\nMX: 5\r\n\r\n'
2017-11-24 08:45:34 asyncio:1380     DEBUG    poll took 835.969 ms: 1 events
2017-11-24 08:45:34 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12341)>]> got a new connection from ('192.168.1.63', 35043): <socket.socket fd=13, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12341), raddr=('192.168.1.63', 35043)>
2017-11-24 08:45:34 asyncio:182      DEBUG    <Server sockets=[<socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12340)>]> got a new connection from ('192.168.1.63', 38204): <socket.socket fd=14, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.101', 12340), raddr=('192.168.1.63', 38204)>
2017-11-24 08:45:34 fauxmo:38       DEBUG    Connection made with: ('192.168.1.63', 35043)
2017-11-24 08:45:34 fauxmo:38       DEBUG    Connection made with: ('192.168.1.63', 38204)
2017-11-24 08:45:34 asyncio:1380     DEBUG    poll took 28.313 ms: 1 events
2017-11-24 08:45:34 fauxmo:49       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
Host: 192.168.1.101:12341
Accept: */*
Content-type: text/xml; charset="utf-8"
SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"
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>
2017-11-24 08:45:34 fauxmo:99       DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x103847e80>
2017-11-24 08:45:34 fauxmo:124      INFO     Attempting to get state for T.V. Pause
2017-11-24 08:45:34 fauxmo:134      INFO     T.V. Pause state: unknown
2017-11-24 08:45:34 fauxmo:169      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Fri, 24 Nov 2017 15:45:34 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>
2017-11-24 08:45:34 fauxmo:49       DEBUG    Received message:
POST /upnp/control/basicevent1 HTTP/1.1
Host: 192.168.1.101:12340
Accept: */*
Content-type: text/xml; charset="utf-8"
SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"
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>
2017-11-24 08:45:34 fauxmo:99       DEBUG    Handling action for plugin type <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x102e6bbe0>
2017-11-24 08:45:34 fauxmo:124      INFO     Attempting to get state for T.V.
2017-11-24 08:45:34 fauxmo:134      INFO     T.V. state: unknown
2017-11-24 08:45:34 fauxmo:169      DEBUG    HTTP/1.1 200 OK
CONTENT-LENGTH: 277
CONTENT-TYPE: text/xml charset="utf-8"
DATE: Fri, 24 Nov 2017 15:45:34 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>
2017-11-24 08:45:43 asyncio:1380     INFO     poll took 9119.744 ms: 1 events
2017-11-24 08:45:43 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 64095):
2017-11-24 08:45:43 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: "ssdp:discover"\r\nST: ssdp:all\r\nMX: 5\r\n\r\n'
2017-11-24 08:45:51 asyncio:1380     INFO     poll took 7881.797 ms: 1 events
2017-11-24 08:45:51 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 2059):
2017-11-24 08:45:51 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 5\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nConnection: close\r\nHost: 239.255.255.250:1900\r\n\r\n'
2017-11-24 08:45:51 asyncio:1380     DEBUG    poll took 0.027 ms: 1 events
2017-11-24 08:45:51 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 2059):
2017-11-24 08:45:51 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 5\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nConnection: close\r\nHost: 239.255.255.250:1900\r\n\r\n'
2017-11-24 08:45:53 asyncio:1380     INFO     poll took 2105.342 ms: 1 events
2017-11-24 08:45:53 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 64095):
2017-11-24 08:45:53 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: "ssdp:discover"\r\nST: ssdp:all\r\nMX: 5\r\n\r\n'
2017-11-24 08:46:03 asyncio:1380     INFO     poll took 10001.696 ms: 1 events
2017-11-24 08:46:03 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 64095):
2017-11-24 08:46:03 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: "ssdp:discover"\r\nST: ssdp:all\r\nMX: 5\r\n\r\n'
2017-11-24 08:46:06 asyncio:1380     INFO     poll took 3171.208 ms: 1 events
2017-11-24 08:46:06 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 56995):
2017-11-24 08:46:06 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nST: upnp:rootdevice\r\nMX: 3\r\nMAN: "ssdp:discover"\r\nHOST: 239.255.255.250:1900\r\n\r\n'
2017-11-24 08:46:13 asyncio:1380     INFO     poll took 6822.357 ms: 1 events
2017-11-24 08:46:13 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 64095):
2017-11-24 08:46:13 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: "ssdp:discover"\r\nST: ssdp:all\r\nMX: 5\r\n\r\n'
2017-11-24 08:46:23 asyncio:1380     INFO     poll took 9995.435 ms: 1 events
2017-11-24 08:46:23 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 64095):
2017-11-24 08:46:23 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: "ssdp:discover"\r\nST: ssdp:all\r\nMX: 5\r\n\r\n'
2017-11-24 08:46:26 asyncio:1380     INFO     poll took 2857.401 ms: 1 events
2017-11-24 08:46:26 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 56395):
2017-11-24 08:46:26 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 1\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nHost: 239.255.255.250:1900\r\nConnection: close\r\n\r\n'
2017-11-24 08:46:26 asyncio:1380     DEBUG    poll took 0.027 ms: 1 events
2017-11-24 08:46:26 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 56395):
2017-11-24 08:46:26 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 1\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nHost: 239.255.255.250:1900\r\nConnection: close\r\n\r\n'
2017-11-24 08:46:27 asyncio:1380     INFO     poll took 1015.806 ms: 1 events
2017-11-24 08:46:27 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 53035):
2017-11-24 08:46:27 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 1\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nHost: 239.255.255.250:1900\r\nConnection: close\r\n\r\n'
2017-11-24 08:46:27 asyncio:1380     DEBUG    poll took 0.027 ms: 1 events
2017-11-24 08:46:27 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 53035):
2017-11-24 08:46:27 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 1\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nHost: 239.255.255.250:1900\r\nConnection: close\r\n\r\n'
2017-11-24 08:46:33 asyncio:1380     INFO     poll took 6122.029 ms: 1 events
2017-11-24 08:46:33 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 64095):
2017-11-24 08:46:33 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: "ssdp:discover"\r\nST: ssdp:all\r\nMX: 5\r\n\r\n'
2017-11-24 08:46:43 asyncio:1380     INFO     poll took 9997.668 ms: 1 events
2017-11-24 08:46:43 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 64095):
2017-11-24 08:46:43 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: "ssdp:discover"\r\nST: ssdp:all\r\nMX: 5\r\n\r\n'
2017-11-24 08:46:45 asyncio:1380     INFO     poll took 2181.958 ms: 1 events
2017-11-24 08:46:45 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 2059):
2017-11-24 08:46:45 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 5\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nConnection: close\r\nHost: 239.255.255.250:1900\r\n\r\n'
2017-11-24 08:46:45 asyncio:1380     DEBUG    poll took 0.028 ms: 1 events
2017-11-24 08:46:45 fauxmo:223      DEBUG    Received data below from ('192.168.1.101', 2059):
2017-11-24 08:46:45 fauxmo:224      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 5\r\nST: upnp:rootdevice\r\nMAN: "ssdp:discover"\r\nUser-Agent: UPnP/1.0 DLNADOC/1.50 Platinum/1.0.5.13\r\nConnection: close\r\nHost: 239.255.255.250:1900\r\n\r\n'

CONFIG.JSON:

{
    "FAUXMO": {
        "ip_address": "auto"
    },
    "PLUGINS": {
        "SimpleHTTPPlugin": {
            "DEVICES": [
                {
                    "port": 12340,
                    "on_cmd": "http://192.168.1.101/television/off",
                    "off_cmd": "http://192.168.1.101/television/off",
                    "method": "GET",
                    "name": "T.V."
                },
		{
		    "port": 12341,
                    "on_cmd": "http://192.168.1.101/television/pause",
                    "off_cmd": "http://192.168.1.101/television/pause",
                    "method": "GET",
                    "name": "T.V. Pause"
		}
            ]
        }
    }
}

Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues

Implement new GetBinaryState command

It appears Echo devices are now sending request for Get BinaryState actions when entering the Devices tab in the app or alexa.amazon.com (web app). This results in any device running emulated WeMo scripts to active; all discovered "devices" turn on (or switch stated depending on their On|Off configuration.)

A check for type of action from the command sent out by the Echo might resolve this.

This fauxmo fork on ESP ?

Hi, I've been using FauxmoESP for some time and it started having some serious problems with Gen1/2 of Echo's, now 80% of the time I get an "Switch X is not responding" error, while that doesn't happen if I send the SOAP messsage from my cellphone... so it's something related to Alexa's Wemo's message probably.... so my question is, is this fauxmo version working fine with Alexa lately ?

And any change to get an ESP version of this beautiful code ? ;)

Echo not recognizing devices

  • Operating system and version: Raspbian 4.9.41
  • Python version: 3.6.1
  • Fauxmo version (fauxmo --version): 0.4.4

My Issue

The Fauxmo devices don't respond to the echo.

WHYT

I followed the instructions on the docs ( http://fauxmo.readthedocs.io/en/latest/md/protocol_notes.html ).
The Echo is sending SSDP SEARCH but the fauxmo devices are not responding.

  1 0.000000000   10.217.0.9 → 239.255.255.250 SSDP 136 M-SEARCH * HTTP/1.1
  2 0.000241300   10.217.0.9 → 239.255.255.250 SSDP 143 M-SEARCH * HTTP/1.1
  3 0.921713869   10.217.0.9 → 239.255.255.250 SSDP 136 M-SEARCH * HTTP/1.1
  4 1.020941347   10.217.0.9 → 239.255.255.250 SSDP 143 M-SEARCH * HTTP/1.1
  5 1.433808518   10.217.0.9 → 239.255.255.250 SSDP 136 M-SEARCH * HTTP/1.1
  6 1.434059663   10.217.0.9 → 239.255.255.250 SSDP 143 M-SEARCH * HTTP/1.1
  7 1.947812897   10.217.0.9 → 239.255.255.250 SSDP 136 M-SEARCH * HTTP/1.1
  8 1.947981906   10.217.0.9 → 239.255.255.250 SSDP 143 M-SEARCH * HTTP/1.1

If i run the fauxmo script with -vvv i can see that the messages are received but there is no answer.

"$(pyenv root)"/versions/3.6.1/bin/fauxmo -c /home/pi/echo-pi/config.json -vvv >> tmp
2017-11-29 18:43:28 fauxmo:37       INFO     Fauxmo v0.4.4
2017-11-29 18:43:28 fauxmo:38       DEBUG    3.6.1 (default, Nov  8 2017, 09:55:19)
[GCC 6.3.0 20170516]
2017-11-29 18:43:28 fauxmo:24       DEBUG    Attempting to get IP address automatically
2017-11-29 18:43:28 fauxmo:37       DEBUG    Using IP address: 10.217.0.10
2017-11-29 18:43:29 fauxmo:102      DEBUG    plugin_vars: {}
2017-11-29 18:43:29 fauxmo:105      DEBUG    device config: {'port': 12340, 'on_cmd': 'http://10.217.0.10:3000/myserver/fakeswitches/01/on', 'off_cmd': 'http://10.217.0.10:3000/myserver/fakeswitches/01/off', 'method': 'GET', 'name': 'fake switch one'}
2017-11-29 18:43:29 asyncio:1067     INFO     <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('10.217.0.10', 12340)>]> is serving
2017-11-29 18:43:29 fauxmo:123      DEBUG    Started fauxmo device: {'name': 'fake switch one', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x760968f0>}
2017-11-29 18:43:29 fauxmo:105      DEBUG    device config: {'port': 12341, 'on_cmd': 'http://10.217.0.10:54321/devices/garage%20light', 'off_cmd': 'http://10.217.0.10:54321/devices/garage%20light', 'on_data': {'isOn': 1}, 'off_data': {'isOn': 0}, 'user': 'this', 'password': 'that', 'method': 'PUT', 'name': 'fake Indigo switch'}
2017-11-29 18:43:29 asyncio:1067     INFO     <Server sockets=[<socket.socket fd=8, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('10.217.0.10', 12341)>]> is serving
2017-11-29 18:43:29 fauxmo:123      DEBUG    Started fauxmo device: {'name': 'fake Indigo switch', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x7600a3d0>}
2017-11-29 18:43:29 fauxmo:105      DEBUG    device config: {'name': 'fake home assistant switch by REST API', 'port': 12342, 'on_cmd': 'http://10.217.0.10:8123/api/services/switch/turn_on', 'off_cmd': 'http://10.217.0.10:8123/api/services/switch/turn_off', 'method': 'POST', 'headers': {'x-ha-access': 'your_hass_password'}, 'on_data': {'entity_id': 'switch.fake_hass_switch'}, 'off_data': {'entity_id': 'switch.fake_hass_switch'}}
2017-11-29 18:43:29 asyncio:1067     INFO     <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('10.217.0.10', 12342)>]> is serving
2017-11-29 18:43:29 fauxmo:123      DEBUG    Started fauxmo device: {'name': 'fake home assistant switch by REST API', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0x75f12930>}
2017-11-29 18:43:29 fauxmo:125      INFO     Starting UDP server
2017-11-29 18:43:29 asyncio:947      DEBUG    Datagram endpoint remote_addr=None created: (<_SelectorDatagramTransport fd=10 read=idle write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0x76096610>)
2017-11-29 18:43:35 asyncio:1379     INFO     poll took 6058.880 ms: 1 events
2017-11-29 18:43:35 fauxmo:170      DEBUG    Received data below from ('10.217.0.9', 50000):
2017-11-29 18:43:35 fauxmo:171      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: ssdp:all\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'
2017-11-29 18:43:35 asyncio:1379     DEBUG    poll took 0.105 ms: 1 events
2017-11-29 18:43:35 fauxmo:170      DEBUG    Received data below from ('10.217.0.9', 50000):
2017-11-29 18:43:35 fauxmo:171      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: upnp:rootdevice\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'
2017-11-29 18:43:36 asyncio:1379     INFO     poll took 1526.918 ms: 1 events
2017-11-29 18:43:36 fauxmo:170      DEBUG    Received data below from ('10.217.0.9', 50000):
2017-11-29 18:43:36 fauxmo:171      DEBUG    b'M-SEARCH * HTTP/1.1\r\nMX: 3\r\nST: upnp:rootdevice\r\nHOST: 239.255.255.250:1900\r\nMAN: "ssdp:discover"\r\n\r\n'
2017-11-29 18:43:36 asyncio:1379     DEBUG    poll took 0.107 ms: 1 events

Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues

CONFIG.JSON

    "FAUXMO": {
        "ip_address": "auto"
    },
    "PLUGINS": {
        "SimpleHTTPPlugin": {
            "DEVICES": [
                {
                    "port": 12340,
                    "on_cmd": "http://10.217.0.10:3000/myserver/fakeswitches/01/on",
                    "off_cmd": "http://10.217.0.10:3000/myserver/fakeswitches/01/off",
                    "method": "GET",
                    "name": "fake switch one"
                },
                {
                    "port": 12341,
                    "on_cmd": "http://10.217.0.10:54321/devices/garage%20light",
                    "off_cmd": "http://10.217.0.10:54321/devices/garage%20light",
                    "on_data": {"isOn": 1},
                    "off_data": {"isOn": 0},
                    "user": "this",
                    "password": "that",
                    "method": "PUT",
                    "name": "fake Indigo switch"
                },
                {
                    "name": "fake home assistant switch by REST API",
                    "port": 12342,
                    "on_cmd": "http://10.217.0.10:8123/api/services/switch/turn_on",
                    "off_cmd": "http://10.217.0.10:8123/api/services/switch/turn_off",
                    "method": "POST",
                    "headers": {"x-ha-access": "your_hass_password"},
                    "on_data": {"entity_id": "switch.fake_hass_switch"},
                    "off_data": {"entity_id": "switch.fake_hass_switch"}
                }
            ]
        }
    }
}```

Alexa device support status

As requested in issue #11 opening new issue. Not all Alexa devices support discovery (I think today it is limited to; Echo, Dot and Tap). See commit comment for background.

Current status is documented in commit 9ea3517 - as of 2016-08-26 Amazon's support is only partial.

  • Discovery does not work.
  • With Fire TV OS version 5.2 on-wards ON/OFF can be controlled via Fire TV (Stick).

CommandLinePlugin

OS: Raspian
Python: 3.6.3
set .json as:
{
"FAUXMO": {
"ip_address": "auto"
},
"PLUGINS": {
"CommandLinePlugin": {
"path": "/path/to/commandlineplugin.py",
"DEVICES": [
{
"name": "output stuff to a file",
"port": 49915,
"on_cmd": "touch testfile.txt",
"off_cmd": "rm testfile.txt"
"state_cmd": "ls testfile.txt"
}
]
}
}
}
Error:
2018-01-21 00:20:01 fauxmo:37 INFO Fauxmo v0.4.5
2018-01-21 00:20:01 fauxmo:38 DEBUG 3.6.3 (default, Jan 20 2018, 23:01:25)
[GCC 6.3.0 20170516]
Traceback (most recent call last):
File "/opt/pyenv/versions/3.6.3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/opt/pyenv/versions/3.6.3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/pyenv/versions/3.6.3/lib/python3.6/site-packages/fauxmo/cli.py", line 34, in
cli()
File "/opt/pyenv/versions/3.6.3/lib/python3.6/site-packages/fauxmo/cli.py", line 30, in cli
main(config_path_str=args.config, verbosity=verbosity)
File "/opt/pyenv/versions/3.6.3/lib/python3.6/site-packages/fauxmo/fauxmo.py", line 50, in main
config = json.loads(config_path.read_text())
File "/opt/pyenv/versions/3.6.3/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/opt/pyenv/versions/3.6.3/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/opt/pyenv/versions/3.6.3/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 14 column 13 (char 334)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.