ericmagnuson / rmcontrol Goto Github PK
View Code? Open in Web Editor NEWRM Control — A python app to control an RM2 from BroadLink.
License: MIT License
RM Control — A python app to control an RM2 from BroadLink.
License: MIT License
@ericmagnuson - thanks for sharing your RM controller plugin! I'm very excited to use this instead of the alternate Android+VM solution.
I am running into some issues linking the RM control with Homebridge. I'm able to get the commands through: even though I'm defining the http_method as POST in the homebridge config file, they are showing up as "GET" on the RM controller. See below:
Homebridge config file:
"accessory": "HttpMulti",
"name": "Projector Screen",
"deviceType": "switch",
"on_url": "http://127.0.0.1:5000/commands/Screen%20Up",
"off_url": "http://127.0.0.1:5000/commands/Screen%20Down",
"http_method": "POST"
Homebridge status info when toggling the switch from HomeKit:
[12/20/2016, 11:26:36 PM] [Projector Screen] Set CurrentState: 1
[12/20/2016, 11:26:36 PM] [Projector Screen] Turning On
[12/20/2016, 11:26:36 PM] [Projector Screen] on=http://127.0.0.1:5000/commands/Screen%20Up off=http://127.0.0.1:5000/commands/Screen%20Down method=undefined
[12/20/2016, 11:26:36 PM] [Projector Screen] Error getting state (status code undefined): null
[12/20/2016, 11:26:36 PM] [Projector Screen] Success turning on
Rmcontrol status info for this command:
127.0.0.1 - - [20/Dec/2016 23:26:36] "GET /commands/Screen%20Up HTTP/1.1" 405 -
Which does not appear to do anything with the Broadlink device.
For comparison, a successful command from the webpage interface with the rmcontroller gives:
127.0.0.1 - - [20/Dec/2016 23:28:04] "POST /commands/Screen%20Up HTTP/1.1" 500 -
Which does successfully send a command through the Broadlink device.
Impressive work so far! I'm looking forward to getting the last couple of issues worked out!
I seem to be doing something wrong in the config file.
It seems to keep throwing an error any chance you could point out where I'm going wrong?
thanks in advance
"accessories": [{
"accessory": "HttpMulti",
"name": "Light",
"on_url": "http://127.0.0.1:5000/POST /commands/living%20room%20lights%20on HTTP/1.1",
"off_url": "http://127.0.0.1:5000/POST /commands/living%20room%20lights%20off HTTP/1.1",
"status_url": "http://127.0.0.1:5000/status%28light%29",
"deviceType": "light"
}
When adding a command by pressing the "+" button, there is an error in the console.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/Flask-0.12-py2.7.egg/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/pi/rmcontrol/rmcontrol/__init__.py", line 146, in create
code = device.check_data()
File "/usr/local/lib/python2.7/dist-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 440, in check_data
response = self.send_packet(0x6a, packet)
File "/usr/local/lib/python2.7/dist-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 250, in send_packet
response = self.cs.recvfrom(1024)
timeout: timed out
Any clue to fix this? Thank you!
pi@hassbian:/home/rmcontrol $ export FLASK_APP=rmcontrol; python -m flask initdbTraceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/Flask-0.12-py2.7.egg/flask/main.py", line 15, in
main(as_module=True)
File "/usr/local/lib/python2.7/dist-packages/Flask-0.12-py2.7.egg/flask/cli.py", line 507, in main
cli.main(args=args, prog_name=name)
File "/usr/local/lib/python2.7/dist-packages/Flask-0.12-py2.7.egg/flask/cli.py", line 374, in main
return AppGroup.main(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click-6.7-py2.7.egg/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click-6.7-py2.7.egg/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click-6.7-py2.7.egg/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click-6.7-py2.7.egg/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click-6.7-py2.7.egg/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Flask-0.12-py2.7.egg/flask/cli.py", line 251, in decorator
return __ctx.invoke(f, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click-6.7-py2.7.egg/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "rmcontrol/init.py", line 44, in initdb_command
init_db()
File "rmcontrol/init.py", line 32, in init_db
db = get_db()
File "rmcontrol/init.py", line 65, in get_db
g.sqlite_db = connect_db()
File "rmcontrol/init.py", line 53, in connect_db
db = sqlite3.connect(os.path.join(app.root_path, 'database/rmcontrol.db'))
sqlite3.OperationalError: unable to open database file
Does anyone know about HTS2 sensor support?
I have a broadlink TC2 Light switch which I want to use with rmcontrol. It doesn't appear to work in the same way and requires pairing. Is it possible to control this with rmcontrol and if so how?
Thanks in advance.
acdeMac-mini:~ mac$ export FLASK_APP=rmcontrol; python -m flask initdb
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 111, in _get_module_details
import(mod_name) # Do not catch exceptions initializing package
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Flask-0.12-py2.7.egg/flask/init.py", line 17, in
from werkzeug.exceptions import abort
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Werkzeug-0.11.15-py2.7.egg/werkzeug/init.py", line 152, in
import('werkzeug.exceptions')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Werkzeug-0.11.15-py2.7.egg/werkzeug/exceptions.py", line 71, in
from werkzeug.wrappers import Response
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Werkzeug-0.11.15-py2.7.egg/werkzeug/wrappers.py", line 26, in
from werkzeug.http import HTTP_STATUS_CODES,
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Werkzeug-0.11.15-py2.7.egg/werkzeug/http.py", line 28, in
from urllib.request import parse_http_list as _parse_list_header
ImportError: No module named request
Ive been looking @ the RM for a while now for using with Homebridge, and with this I can buy it.
So does this do RF as well as IR, if so I may have brought those Arduino kits for nothing :(
When executing
pip install pycrypto
there was an error that prevented me from getting pycrypto installed. Something about
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. src/MD2.c:31:20: fatal error: Python.h: No such file or directory
I searched the net for a reason why and it was suggested that I had to install Python-dev
sudo apt-get install python-dev
after that, I ran pip install pycrypto again and it worked.
Hi I'm really hoping to get this working but having some issues when I get to....
export FLASK_APP=rmcontrol; python -m flask initdb
I keep getting the Error: No such command "initdb".
I've done a clean install of everything but obviously have missed something.
hope someone can point me in the right direction! cheers Keith
Hi Eric,
After sudo python run.py , I get the following when I load the webpage, and enter GET / , and then click on the + sign. Any ideas what is wrong?
pi@hassbian:/home/rmcontrol $ sudo python run.py
Is this installed a RPI or a different platform?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.