Giter VIP home page Giter VIP logo

echo's Introduction

echo

For controlling local devices with the Amazon Echo.

Instructions for installation and usage available on Instructables here

Brought to you by FabricateIO

Quick Start

  1. Create a Python Virtual Environment
  2. git clone this_repo
  3. cd this_repo
  4. pip install -r requirements.txt
  5. python example-minimal.py
  6. Tell Echo, "discover my devices"
  7. Use Echo's "turn off device" and "device on" to see True/False script output

echo's People

Contributors

liketed avatar russellvt avatar toddmedema 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

echo's Issues

CRITICAL:root:Critical exception: __init__() takes exactly 3 arguments (2 given)

DEBUG:root:Listening for UPnP broadcasts
DEBUG:root:got local address of 192.168.1.8
DEBUG:root:UPnP broadcast listener: new device registered
DEBUG:root:FauxMo device 'Room Light' ready on 192.168.1.8:52000
DEBUG:root:Entering fauxmo polling loop
DEBUG:root:POST /upnp/control/basicevent1 HTTP/1.1
Host: 192.168.1.8:52000
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>
DEBUG:root:Responding to ON for Room Light
CRITICAL:root:Critical exception: __init__() takes exactly 3 arguments (2 given)

I integrated with broadlink-python, at first all worked fine and now something went wrong.
the code:

import fauxmo
import logging
import time
import broadlink
import time
import sys

from debounce_handler import debounce_handler

logging.basicConfig(level=logging.DEBUG)

class device_handler(debounce_handler):
    """Publishes the on/off state requested,
       and the IP address of the Echo making the request.
    """
    TRIGGERS = {"device": 52000}

    def act(self, client_address, state, name):
		if state is True:
			device = broadlink.rm(host=("192.168.1.10",80), mac=bytearray.fromhex("b4430dc3de82"))
			device.auth()
			device.host
			codeData = "e90a4200df0916091609160916090916091616090916091616090916091609160916091609161609160916091609091616090916160909160916091609160916091609160916e90a4200df0916091609160916090916091616090916091616090916091609160916091609161609160916091609091616090916160909160916091609160916091609160916"
			device.send_data(codeData.decode('hex'))
			return True
		else:
			device = broadlink.rm(host=("192.168.1.10",80), mac=bytearray.fromhex("b4430dc3de82"))
			device.auth()
			device.host
			codeData = "e90a4200df0909160916091609161609091609161609160909160916091609160916091616091609160909161609091616090916160909160916160916091609160909161609e90a4200df0909160916091609161609091609161609160909160916091609160916091616091609160909161609091616090916160909160916160916091609160909161609"
			device.send_data(codeData.decode('hex'))
			return True

if __name__ == "__main__":
    # Startup the fauxmo server
    fauxmo.DEBUG = True
    p = fauxmo.poller()
    u = fauxmo.upnp_broadcast_responder()
    u.init_socket()
    p.add(u)

    # Register the device callback as a fauxmo handler
    d = device_handler()
    for trig, port in d.TRIGGERS.items():
        fauxmo.fauxmo(trig, u, p, None, port, d)

    # Loop and poll for incoming Echo requests
    logging.debug("Entering fauxmo polling loop")
    while True:
        try:
            # Allow time for a ctrl-c to stop the process
            p.poll(100)
            time.sleep(0.1)
        except Exception, e:
            logging.critical("Critical exception: " + str(e))
            break

if gate variables

I would like to make a if gate but can't, I have made a if gate for if status == true,but I get a error no value set for status. I see this, is there a way to use the example -minimal.py script and have a value for true, I am very new tp monty the python and would like to use this as a switch for novnc and a couple of other programs

Has anybody else had luck with this code ?

I initially going to use 1 similar with kodi, but that doesn't work either.
So i backed up to this code and triedc it out, even on a different rpi0, but still no luck.

I found a link to use tcpdump and monitor what was happening,, and I think i see the discover, when i tell Alexa to discover, but nothing else happens, and Alexa does not find it.

example-mqtt.py Doesn't Work

When I try to run the example-mqtt.py file, I get an error (Fedora 25, 64-bit).

$ python example-mqtt.py 
Traceback (most recent call last):
  File "example-mqtt.py", line 41, in <module>
    client.connect(MQTT_HOST, MQTT_PORT, 60)
  File "/usr/lib/python2.7/site-packages/paho/mqtt/client.py", line 760, in connect
    return self.reconnect()
  File "/usr/lib/python2.7/site-packages/paho/mqtt/client.py", line 887, in reconnect
    sock = socket.create_connection((self._host, self._port), source_address=(self._bind
_address, 0))                                                                          
  File "/usr/lib64/python2.7/socket.py", line 557, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known

example-minimal.py works as expected.

echo only supports ports 52000-52010 / maximum of 11 devices

I've tried adding more than 11 devices, using ports above and below 52000-52010 and this seems to totally break the echo device discovery.... it never requests the setup.xml for the devices on ports outside of 52000-52010, and I think it also prevents it from discovering the devices on the ports in range too (though they are discovered if the out of range device is deleted).

I don't think it's an issue w/ this library, but it's something to be aware of (and i'd love some confirmation that others are seeing this limitation).

Round-robin from Alexa prevents accurately determining the requesting Echo device

Alexa software implements a round-robin system by which requests, although heard by a specific Echo device, are not necessarily carried out by that device. I have 1 full-size Echo and 4 Echo Dots, and if I make the request to the bedroom Dot for example, it was carried out by the IP address of the full-size Echo in the Living Room. This continued for a few minutes until requests were then being carried out by the Dot in the Family Room. All of these requests were done from the Dot in the bedroom.

This round-robbin feature has been documented in many articles, which makes it impossible to reliably assign a device called "light" and have an Echo device use the specific room you are in to turn on the light in that room, because the Alexa software will start with one Echo device to carry out all requests, no matter which Echo initiated the request, and it will use that Echo for a period of time, then choose the next one in the list for a period of time and so on until it gets back to the first device.

The ability to speak individually to each Echo is being referenced in your example files as a feature when this is not the case, especially in the mqtt example, where you are attempting to specifically identify the requesting device to post to a specific mqtt topic, which will not give you the results you are expecting.

[Help Wanted] Set "off" state based on ping

I have successfully enhanced this script to allow WOL for multiple of my home devices.
I struggle to find the code section in fauxmo.py where the Device state is handled.

Ideally I would like to implement a ping function (if ping to an IP is successfull, show device as ON).
Second best would be a code change to show the device as always OFF.

Could anyone nudge me in either direction?

Did not found more examples and documentation

Hi Todd,
Gret job, I followed this echo project from yesterday and now I can able to give the command to my echo device but due to less documentation I am unable to change more variable to get it worked for my telnet controlled devices, it will very helpful for any new person to kickstart with your project.
I have a lot of queries like,

  1. How to add more devices to this project.
  2. I dedent find any other command then ON/OFF, is it possible to add other commands to work with like Deem the light to 20%, change the tv channel, set the temperature.
  3. Can I get speech to text data in the response?
    Thank you,
    Nirmal Kushwah

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.