Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels