rmcontrol
rmcontrol copied to clipboard
Web not responding when adding code
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!
I get the same error and think it might be something to do with not opening the database file?
osmc@osmc:~/rmcontrol$ export FLASK_APP=rmcontrol; python -m flask initdb
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
@ToolTheFool I had similar problem, i don't remember if exactly like this error
I made some changes to the code, try to backup /rmcontrol/rmcontrol/__init__.py
and replace it with the one with my changes here:
https://drive.google.com/open?id=0B2-DXeKeq1abMGs2YmNsRDJWMEE
I changed the following lines (original code is commented out):
04: """
05: Initializes the database.
06: """
07: #def init_db():
08: # db = get_db()
09: # with app.open_resource('database/schema.sql', mode='r') as f:
10: # db.cursor().executescript(f.read())
11: # db.commit()
12:
13:
14: def init_db():
15: with app.app_context():
16: db = get_db()
17: with app.open_resource('database/schema.sql', mode='r') as f:
18: db.cursor().executescript(f.read())
19: db.commit()
20:
21:
22:
23: """
24: Creates the database tables.
25: """
26: #@app.cli.command('initdb')
27: def initdb_command():
28: # init_db()
29: # print('Initialized the database.')
30: if __name__ == '__main__':
31: init_db()
32: app.run()
@williamccc After you click the "+" button, do you see the red light turn on on your RM2? Try pressing the desired remote control button you're trying to learn within 5 seconds of clicking the "+".
@ToolTheFool Were you able to get it working? It sounds like RM Control could not automatically create the database file (could be a weird permissions thing). Do you see a file called rmcontrol.db in the database folder?
@ericmagnuson I have checked and there is no rmcontrol.db file, so there must be something preventing its creation such as permissions as you suggested. Have you any ideas how to overcome this? What permissions need changing on what files etc.
@ericmagnuson No the red light didn't turn on after pressing the "+" button
@williamccc Hmm, ok. That makes it sound like RM Control is completely unable to talk with your device. (Disclaimer: I'm not a python pro, so I my be wrong in assessing your error.) Is your RM on the same network as the server/computer RM Control is running on? I will see if I can replicate your error on my own setup. If you'd like, I can chat with you in person (Skype, FB, Whatsapp, etc) to see if we can get it working.
@ToolTheFool For those with no rmcontrol.db file, I had the same issue. I am running this on a Raspberry Pi. But since I cannot log in as root, I have to use the default pi user. But the folders created by the installation etc belong to root:root . So I chown -R pi:pi /home/rmcontrol/* and it then allowed me to execute the export command. That created the database file.
@ericmagnuson How does rmcontrol know how to connect to the RM 2 device? Is there a configuration we need to do to tell it? Like maybe the IP address or MAC address?
@ericmagnuson Does the RM2 need to be plugged into the machine running rmcontrol?
@ericmagnuson My RM Pro and RM Control run on the same wifi network. RM Control runs on Raspberry Pi 3 which runs Raspbian.
@luketoh I know you've since got it working, but I'll still respond for others that run into this problem. The RM only needs to be on the same network as the machine running RM Control. Thanks to the underlying python lib that talks to your RM, it will automatically detect it on your network without any setup.
@williamccc It looks like RM Control is having a hard time finding your RM device on the network. Do both devices have IPs on the same subnet?